PYSEC-2026-3540
Vulnerability from pysec - Published: 2026-07-23 11:41 - Updated: 2026-07-23 14:33Impact
The _uid option performed an incomplete privilege drop on Linux/Unix-like systems.
When sh was run from a process with elevated privileges, such as root, and a command was launched with _uid=<unprivileged user>, the child process changed its UID and primary GID but did not reset its supplementary groups. As a result, the child process could retain the parent process’s supplementary groups, potentially including privileged groups such as root, docker, disk, shadow, or sudo.
This could allow a subprocess that was expected to run with reduced privileges to access files or resources available to the original process’s supplementary groups. Users are impacted if they rely on _uid as a privilege boundary when launching commands from a privileged parent process.
Patches
Upgrade to version >= 2.2.4
Workarounds
Avoid using _uid when the user represents a less-privileged user.
| Name | purl | sh | pkg:pypi/sh |
|---|
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "sh",
"purl": "pkg:pypi/sh"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.2.4"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"0.01",
"0.106",
"0.107",
"0.108",
"1.0",
"1.01",
"1.02",
"1.03",
"1.04",
"1.05",
"1.06",
"1.07",
"1.08",
"1.09",
"1.10",
"1.11",
"1.12.0",
"1.12.1",
"1.12.10",
"1.12.11",
"1.12.12",
"1.12.13",
"1.12.14",
"1.12.2",
"1.12.3",
"1.12.4",
"1.12.5",
"1.12.6",
"1.12.7",
"1.12.8",
"1.12.9",
"1.13.0",
"1.13.1",
"1.14.0",
"1.14.1",
"1.14.2",
"1.14.3",
"2.0.0",
"2.0.1",
"2.0.2",
"2.0.3",
"2.0.4",
"2.0.5",
"2.0.6",
"2.0.7",
"2.1.0",
"2.2.0",
"2.2.1",
"2.2.2",
"2.2.3"
]
}
],
"aliases": [
"CVE-2026-54552",
"GHSA-q38v-wp89-2w55"
],
"details": "### Impact\nThe `_uid` option performed an incomplete privilege drop on Linux/Unix-like systems.\n\nWhen `sh` was run from a process with elevated privileges, such as root, and a command was launched with `_uid=\u003cunprivileged user\u003e`, the child process changed its UID and primary GID but did not reset its supplementary groups. As a result, the child process could retain the parent process\u2019s supplementary groups, potentially including privileged groups such as root, docker, disk, shadow, or sudo.\n\nThis could allow a subprocess that was expected to run with reduced privileges to access files or resources available to the original process\u2019s supplementary groups. Users are impacted if they rely on `_uid` as a privilege boundary when launching commands from a privileged parent process.\n\n### Patches\nUpgrade to version \u003e= 2.2.4\n\n### Workarounds\nAvoid using `_uid` when the user represents a less-privileged user.",
"id": "PYSEC-2026-3540",
"modified": "2026-07-23T14:33:04.660547Z",
"published": "2026-07-23T11:41:46.915478Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/amoffat/sh/security/advisories/GHSA-q38v-wp89-2w55"
},
{
"type": "PACKAGE",
"url": "https://github.com/amoffat/sh"
},
{
"type": "WEB",
"url": "https://github.com/amoffat/sh/releases/tag/2.2.4"
},
{
"type": "PACKAGE",
"url": "https://pypi.org/project/sh"
},
{
"type": "ADVISORY",
"url": "https://github.com/advisories/GHSA-q38v-wp89-2w55"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-54552"
}
],
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:N",
"type": "CVSS_V3"
}
],
"summary": "sh _uid does not drop supplementary groups (incomplete privilege drop)"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.