CVE-2026-54552
Incomplete UID drop in sh ≤2.2.3 lets child retain parent’s groups, breaching privilege boundary.
- CVSS 7.9
- CWE-273
- Authentication, Authorization, and Session Management
- Local
sh provides Python process launching. Prior to 2.2.4, the _uid option in sh.py performs an incomplete privilege drop on Linux and Unix-like systems. When sh runs from an elevated process and launches a command with _uid set to an unprivileged user, the child changes its UID but can retain the parent process's supplementary groups because the privilege-drop sequence does not fully establish the target user's UID, primary GID, and supplementary groups. The child can therefore retain access to files or resources granted to privileged groups such as root, docker, disk, shadow, or sudo, violating the expected _uid privilege boundary. This issue is fixed in version 2.2.4.
- CWE
- CWE-273
- CVSS base score
- 7.9
- Published
- 2026-08-18
- OWASP
- A01 Broken Access Control
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Authentication, Authorization, and Session Management
- Subcategory
- Privilege Escalation
- Accessibility scope
- Local
- Impact
- Privilege Escalation
- Affected component
- sh
- Fixed by upgrading
- Yes
Solution
Upgrade sh to version 2.2.4 or later.
Vulnerable code sample
import sh
def run_unprivileged(cmd, user):
# VULNERABLE: retains parent supplementary groups
return sh.Command(cmd)(_uid=user)Patched code sample
import sh
def run_unprivileged(cmd, user):
# FIX: drop supplementary groups by setting gid and groups
return sh.Command(cmd)(_uid=user, _gid=None, _groups=[])Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- gid regression and priv tests (#776) (amoffat/sh)
sh.py · OProc.__init__
Cite this entry
@misc{vaitp:cve202654552,
title = {{Incomplete UID drop in sh ≤2.2.3 lets child retain parent’s groups, breaching privilege boundary.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-54552},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-54552/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
