Skip to content
OpenAdvisories
Medium · 6.1 CVE-2023-6507 EUVD-2023-58738GHSA-4wxh-fpjf-c8wf

Groups not dropped before running subprocess when using empty 'extra_groups' parameter

Published Dec 8, 2023 · Updated Jul 31, 2026 · Assigned by PSF

Description

An issue was found in CPython 3.12.0 `subprocess` module on POSIX platforms. The issue was fixed in CPython 3.12.1 and does not affect other stable releases.

When using the `extra_groups=` parameter with an empty list as a value (ie `extra_groups=[]`) the logic regressed to not call `setgroups(0, NULL)` before calling `exec()`, thus not dropping the original processes' groups before starting the new process. There is no issue when the parameter isn't used or when any value is used besides an empty list.

This issue only impacts CPython processes run with sufficient privilege to make the `setgroups` system call (typically `root`).

Affected products

VendorProductAffectedFixed
Python Software Foundation CPython < 3.12.1, 3.13.0a1 – < 3.13.0a3 3.12.1

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Ubuntu 22.04 LTS python3.10 3.10.12-1~22.04.4 USN-6891-1
Ubuntu 20.04 LTS python3.8 3.8.10-0ubuntu1~20.04.10 USN-6891-1
Show 5 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 22.04 LTS python3.11 3.11.0~rc1-1~22.04.1~esm1 USN-6891-1
Ubuntu Pro 20.04 LTS python3.9 3.9.5-3ubuntu0~20.04.1+esm2 USN-6891-1
Ubuntu Pro 18.04 LTS python3.6 3.6.9-1~18.04ubuntu1.13+esm2 USN-6891-1
Ubuntu Pro 18.04 LTS python3.7 3.7.5-2ubuntu1~18.04.2+esm3 USN-6891-1
Ubuntu Pro 18.04 LTS python3.8 3.8.0-3ubuntu1~18.04.2+esm2 USN-6891-1
Ubuntu Pro 16.04 LTS python3.5 3.5.2-2ubuntu0~16.04.13+esm13 USN-6891-1
Ubuntu Pro 14.04 LTS python3.5 3.5.2-2ubuntu0~16.04.4~14.04.1+esm1 USN-6891-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed python312 3.12.1-1.1 openSUSE-SU-2024:13511-1

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 3 python3 3.12.3-1 —

Advisories 3

References