Advisory

PYSEC-2026-3540

Also known as: CVE-2026-54552, GHSA-q38v-wp89-2w55

Summary

sh _uid does not drop supplementary groups (incomplete privilege drop)

Details

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.

Severity

High Basis: CVSS v3 score 7.9, vector CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:N

Dates

Published
2026-07-23 11:41 UTC
Modified
2026-07-23 15:00 UTC

Affected packages and fixes

sh

PyPI · All systems

Affected

  • introduced 0, fixed 2.2.4 (ecosystem)

Fixed versions

2.2.4

Fix

  • Fixed version 2.2.4
    pip install --upgrade sh==2.2.4

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: PyPA Advisory Database · CC BY 4.0

Sources & licences