另一种Tomcat渗透Getshell技巧 作者: admin 时间: 2019-04-14 分类: 渗透技巧 *假设manager不可登录而host-manager可以登录...* # 1. 实验环境 > Target:Windows server 2008 r2 x64 – Tomcat8 Smbserver:kali # 2. 复现过程 先将tomcat的host-manager配置可登录。  可以看到有这么一个功能。**Add Virtual Host** 什么意思呢,根据译文说呢。大概就是一个虚拟host app可以远程部署war在tomcat上面。 > 官方解释:http://tomcat.apache.org/tomcat-7.0-doc/host-manager-howto.html The Tomcat Host Manager application enables you to create, delete, and otherwise manage virtual hosts within Tomcat.  根据原作者的测试,App base 可以接受smb协议的请求,即 UNC 路径`\\servername\sharename`。 先开启smbserver.py。 > 下载地址:https://github.com/SecureAuthCorp/impacket 用法: `smbserver.py -debug -smb2support -comment "test" sharename sharepath`  然后去tomcat添加 app host  可以看到添加成功  Smbserver这边也是有相应的数据回显  证明确实可以接受smb协议。 如何 getshell 呢?很简单。把 war 包放进 sharepath 的目录中。然后部署即可。 > 注意:name字段其实就是域名。所以如果我们要是渗透外网机器的话。需要将域名解析到tomcat服务器的ip才能成功。SMBserver也必须要在外网才能成功。 这里我直接在hosts文件修改。把win.2008r2.lab添加进去。    访问试试  看看kali机器  已经成功部署了。 # 3. 总结 #### 缺点: 1. 在大马中目录功能失效。指向的是smbserver的目录。 1. 要保持smb服务不中断。 #### 优点: 1. 隐秘性好。木马文件都在自己的机器。 **PS:如果报错为FAIL - Couldn't install manager.xml。把Manager App勾去掉即可。** 参看文献 > 原文:https://www.certilience.fr/2019/03/tomcat-exploit-variant-host-manager/ > 译文:https://xz.aliyun.com/t/4435 标签: 渗透技巧