Skip to main content

sh (Python) CVE-2026-54552

| EUVDEUVD-2026-61127 HIGH
Improper Check for Dropped Privileges (CWE-273)
2026-07-17 https://github.com/amoffat/sh GHSA-q38v-wp89-2w55 PYSEC-2026-3540
7.9
CVSS 3.1 · Vendor: https://github.com/amoffat/sh
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Root process invokes sh with _uid
  2. Delivery
    Child sets UID/GID but keeps supplementary groups
  3. Exploit
    Subprocess retains docker/shadow/disk membership
  4. Execution
    Access privileged group resources
  5. Impact
    Escalate to full host compromise

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V8 - Authorization Privilege drop verification
Exploitation Conditions

Requires a Linux/Unix host where a privileged parent process (typically root) invokes sh with the _uid=<unprivileged user> option AND relies on _uid as its privilege boundary, while that root process is itself a member of powerful supplementary groups such as docker, disk, shadow, sudo, or root. The attacker must control the code or command executed in the supposedly-reduced subprocess. Exploitation is limited to sh versions < 2.2.4; it does not apply if _uid is unused, if the parent is not privileged, if the parent carries no sensitive supplementary groups, or on non-Unix platforms. There is no remote or network exposure and no unauthenticated path.

Impact

The vendor CVSS 3.1 vector (AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:N, 7.9 High) is internally consistent: exploitation is local and low-complexity but requires a high-privilege context (a root parent using _uid), with a scope change reflecting the crossed privilege boundary and high confidentiality/integrity impact. No EPSS score, KEV listing, or POC was provided, so real-world exploitation pressure appears low and opportunistic rather than mass-scale - this is a latent privilege-boundary weakness dangerous only in deployments that specifically use _uid as a security boundary from a privileged parent. The key limiting factor is that a developer must already run sh as root and rely on _uid for isolation; environments not using _uid this way are unaffected. Priority is elevated for container/orchestration tooling that shells out as root but moderate overall given the narrow prerequisite.

Exploit ScenarioDerived

A daemon running as root uses sh with _uid to execute a plugin or user-supplied command as an unprivileged account, trusting _uid to sandbox it. Because supplementary groups are never cleared, the command still belongs to the docker group and mounts a container bind-mounting the host filesystem, or belongs to shadow and reads /etc/shadow - achieving full host compromise despite the reduced UID. No public POC is known, but the technique is straightforward for anyone controlling the launched command.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 17, 2026

Privilege escalation via incomplete privilege drop in the Python 'sh' subprocess library (versions < 2.2.4): when a root/privileged process launches a command with the _uid option, the child changes UID and primary GID but fails to clear the parent's supplementary groups via setgroups(). Any subprocess expected to run unprivileged can therefore retain sensitive parent groups (root, docker, disk, shadow, sudo), reading or writing resources those groups grant. No public exploit identified at time of analysis and it is not in CISA KEV; the fix is confirmed in release 2.2.4.

RemediationAI

Vendor-released patch: 2.2.4 - upgrade the sh dependency to version >= 2.2.4 (pip install --upgrade 'sh>=2.2.4') as the primary fix, per GHSA-q38v-wp89-2w55. If upgrading is not immediately possible, apply the vendor workaround of avoiding _uid when the target user is meant to be less-privileged; instead drop privileges yourself before invoking sh (e.g. call os.initgroups()/os.setgroups([]) then setgid/setuid, or launch via a wrapper that fully clears groups), which removes reliance on the broken path at the cost of extra glue logic. Additionally, minimize the supplementary groups of the privileged parent process (do not run it as a member of docker, disk, shadow, or sudo) so a leaked group list carries no dangerous privileges - the trade-off is that legitimate parent functionality needing those groups must be redesigned.

Affected VersionsENISA

sh < 2.2.4

Affected Packages

pypi sh fix: 2.2.4

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The 'sh' library (pkg:pip/sh) is a popular Python convenience wrapper that runs external commands as fluent function calls. Its _uid option is meant to launch a child with a reduced identity. On Linux/Unix a full privilege drop requires three syscalls in order: setgroups() to clear supplementary groups, setgid() for the primary GID, then setuid() for the UID. This flaw is CWE-273 (Improper Check for Dropped Privileges): sh set the UID and primary GID but omitted the setgroups() call, so the inherited supplementary group list persisted. Because groups like docker, disk, shadow, and sudo confer powerful host access independent of UID, the residual membership defeats the intended sandbox. The 2.2.4 release notes describe fixing a regression where the correct gid was not set on the launched process.

Know when Docker gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/amoffat/sh) PRIMARY 7.9 HIGH
AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:N
vuln.today AI 7.9 HIGH

Local low-complexity attack needing a privileged root parent using _uid (PR:H); the crossed privilege boundary gives S:C with high confidentiality/integrity impact and no availability effect.

3.1 AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:N
4.0 AV:L/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:N/SC:H/SI:H/SA:N
SUSE 8.2 HIGH
AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N
Red Hat 7.9 HIGH

Primary rating from Vendor (https://github.com/amoffat/sh).

CVSS VectorVendor: https://github.com/amoffat/sh

Attack Vector
Local
Attack Complexity
Low
Privileges Required
High
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None

DescriptionCVE.org

Impact

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.

Executive ViewAI

Why It Matters

The Python 'sh' library prior to version 2.2.4 contains a privilege escalation vulnerability that could allow attackers to bypass access controls and gain unauthorized access to sensitive system resources in containerized or multi-tenant environments. Organizations using vulnerable versions risk data compromise and loss of privilege isolation protections that are security-critical for shared infrastructure.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.2%
Top 93% exploitable
Prevalence
Medium
widely-used Python subprocess library, but privileged _uid usage is narrow
Threat Intel
1
1 source
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS GHSA Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Small
Automatable· derived
No
Human Impact
High

Priority Score

40
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +40
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

More in Docker

View all
CVE-2024-55964 CRITICAL POC
9.8 Mar 26

An issue was discovered in Appsmith before 1.52. Rated critical severity (CVSS 9.8), this vulnerability is remotely expl

CVE-2019-5736 HIGH POC
8.6 Feb 11

runc through version 1.0-rc6 (used in Docker before 18.09.2) contains a container escape vulnerability that allows attac

CVE-2023-32077 HIGH POC
7.5 Aug 24

Netmaker makes networks with WireGuard. Rated high severity (CVSS 7.5), this vulnerability is remotely exploitable, no a

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2023-5815 HIGH POC
8.1 Nov 22

The News & Blog Designer Pack - WordPress Blog Plugin - (Blog Post Grid, Blog Post Slider, Blog Post Carousel, Blog Post

CVE-2026-66384 MEDIUM POC
5.3 Aug 12

Path traversal in JFrog Artifactory (CWE-22) enables an authenticated low-privilege user to write data outside the inten

CVE-2014-9357 CRITICAL
10.0 Dec 16

Docker 1.3.2 allows remote attackers to execute arbitrary code with root privileges via a crafted (1) image or (2) build

CVE-2026-52806 CRITICAL POC
9.9 Jun 23

Remote code execution in Gogs through 0.14.2 allows authenticated users (and unauthenticated attackers on default-config

CVE-2025-14707 HIGH POC
8.9 Dec 15

Unauthenticated remote command injection in SGWBOX N3 firmware 2.0.25 lets attackers execute arbitrary operating-system

CVE-2026-56274 HIGH POC
8.7 Jun 23

Remote code execution in Flowise before 3.1.2 allows any authenticated user (or API caller with chatflow view/update per

CVE-2026-34156 CRITICAL POC
9.9 Mar 30

Remote code execution in NocoBase Workflow Script Node (npm @nocobase/plugin-workflow-javascript) allows authenticated l

CVE-2019-15752 HIGH POC
7.8 Aug 28

Docker Desktop Community Edition before 2.1.0.1 allows local users to gain privileges by placing a Trojan horse docker-c

Vendor StatusVendor

SUSE

Severity: Important
Product Status
SUSE Linux Enterprise Desktop 15 SP7 Affected
SUSE Linux Enterprise High Performance Computing 15 SP7 Affected
SUSE Linux Enterprise Module for Python 3 15 SP7 Affected
SUSE Linux Enterprise Server 15 SP7 Affected
SUSE Linux Enterprise Server 16.0 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy