我在一个网站上运行 admin" or "1"="1 我已经拥有运行SQL注入的完全权限 . 该网站配置错误,让我直接登录 .
admin" or "1"="1
我不理解的是,为什么在最终的1号之后不需要双引号?
如果php的工作方式如下: username="admin" and password=md5("password") ,则admin之后的引用“关闭第一个引用 .
username="admin" and password=md5("password")
"1" is closed, but I don't understand "1
有人能为我解释一下吗?
提前致谢
想想应用程序中的SQL查询可能是什么 .
正如你所说的那样可能就像 select * from users where username="<<username>>" and password=md5("<<password>>") .
select * from users where username="<<username>>" and password=md5("<<password>>")
注入 <<username>> 和 <<password>> 后,仍然需要有一个有效的SQL查询,否则应用程序将失败并显示错误 .
<<username>>
<<password>>
使用 <<username>> 进行注入, admin 之后的引号关闭用户名字符串, or "1"="1 使查询如下:
admin
or "1"="1
select * from users where username="admin" or "1"="1" and password=md5("<<password>>")
这是有效的,并且由于 and 的优先级高于 or ,因此它会获得名称为_58508的用户或具有您在其他字段中输入的密码的用户 - 无关紧要 .
and
or
如果你在注入的字符串的末尾有一个引号,那么查询将是 select * from users where username="admin" or "1"="1"" and password=md5("<<password>>") ,由于这两个引号是无效的SQL(很容易看到,因为引号的数量是奇数) .
select * from users where username="admin" or "1"="1"" and password=md5("<<password>>")
1 回答
想想应用程序中的SQL查询可能是什么 .
正如你所说的那样可能就像
select * from users where username="<<username>>" and password=md5("<<password>>")
.注入
<<username>>
和<<password>>
后,仍然需要有一个有效的SQL查询,否则应用程序将失败并显示错误 .使用
<<username>>
进行注入,admin
之后的引号关闭用户名字符串,or "1"="1
使查询如下:select * from users where username="admin" or "1"="1" and password=md5("<<password>>")
这是有效的,并且由于
and
的优先级高于or
,因此它会获得名称为_58508的用户或具有您在其他字段中输入的密码的用户 - 无关紧要 .如果你在注入的字符串的末尾有一个引号,那么查询将是
select * from users where username="admin" or "1"="1"" and password=md5("<<password>>")
,由于这两个引号是无效的SQL(很容易看到,因为引号的数量是奇数) .