
A local privilege escalation vulnerability in VMware vCenter Server (and VMware Cloud Foundation) caused by a misconfiguration of sudo, allowing an authenticated user with non-administrative privileges to elevate to root.
This repository contains a proof of concept (PoC) for the vulnerability CVE-2024-37081 in VMware vCenter. The vulnerability is due to a misconfiguration in the /etc/sudoers file that allows the preservation of dangerous environment variables when executing sudo commands. This can be exploited by attackers to execute arbitrary commands with root privileges.
Defaults env_keep parameter in the /etc/sudoers file allows the propagation of dangerous environment variables (PYTHONPATH, VMWARE_PYTHON_PATH, VMWARE_PYTHON_BIN, etc.) during the execution of sudo commands, enabling arbitrary code execution with root privileges.%operator (group)%admin (group)infraprofile (user)vpxd (user)sts (user)pod (user)Clone this repository:
git clone https://github.com/Mr-r00t11/CVE-2024-37081.git
cd CVE-2024-37081
Run the PoC script:
python3 poc.py
poc.py: Python script that demonstrates the exploitation of the vulnerability.README.md: This file.The poc.py script performs the following steps:
/tmp/malicious/__init__.py directory that executes the id command and saves the output to /tmp/pwned.PYTHONPATH environment variable to /tmp/malicious and executes a sudo command to import a Python module as the operator user.execute_with_pythonpath(), but uses the VMWARE_PYTHON_PATH environment variable and executes the command as the pod user.VMWARE_PYTHON_BIN environment variable to this script, and executes a sudo command as the admin user.vpxd user to read the file using .This script should only be used in a controlled environment and for educational purposes. Exploiting vulnerabilities in systems without authorization is illegal and punishable by law. Ensure you have proper permissions and fully understand the implications of running this type of code.
This project is licensed under the terms of the MIT License.
/etc/shadowsendmail/tmp/pwned file has been created, indicating that the malicious code was executed successfully.