
上QQ阅读APP看书,第一时间看更新
1.3 实验#3:testaspnet网站有SQL注入风险
缺陷标题 testaspnet网站下存在SQL注入风险。
测试平台与浏览器 Windows XP+IE 8。
测试步骤
(1)打开testaspnet网站http://testaspnet.vulnweb.com。
(2)单击导航条上的login链接。
(3)在Username文本框中输入Try'or 1=1 or'test'='test,单击Login按钮登录,如图1-5所示。

图1-5 登录页面
期望结果 登录失败。
实际结果 以admin身份登录成功,如图1-6所示。

图1-6 登录成功
专家点评
SQL注入攻击利用的是数据库SQL语法,对SQL语法使用越深入,攻击得到的信息就越多。常见的攻击语法如下。
(1)获取数据库版本。

(2)获取当前数据库名。

(3)获取当前数据库用户名。

(4)猜解所有数据库名称。

(5)猜解表的字段名称。

如果知道了表名和字段名就可以得出准确的值。
union select 1,2,username,password,5,6,7,8,9,10,11,12 from usertable where id=6
(6)爆账号。

(7)修改管理员的密码为123。
.asp?id=××;update admin set password='123'where id=1 .asp?id=××;insert into admin(asd,..)values(123,..) //就能往admin中写入123了
(8)猜解数据库中用户名表的名称。
