CVE-2023-6507 Groups not dropped before running subprocess when using empty 'extra_groups' parameter
Attackers can retain original group privileges when spawning subprocesses with empty extra_groups in privileged Python applications.
- Exploited in the wild
- Not known
- Login needed
- An administrator
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2023-6507?
CVE-2023-6507 is a medium-severity vulnerability in Python Python, published on 8 Dec 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Official 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`).
Weakness: CWE-269
Which versions are affected by CVE-2023-6507?
3 open source packages ship an affected version, including libpython, python and python-min. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
libpython Bitnami | From 3.12.0 | 3.12.1 |
python Bitnami | From 3.12.0 | 3.12.1 |
python-min Bitnami | From 3.12.0 | 3.12.1 |
Linux distribution packages (1)
python312 openSUSE:Tumbleweed | All versions | 3.12.1-1.1 |
Products include Python Python.
How do I fix CVE-2023-6507?
Upgrade libpython to 3.12.1 or later.
Is CVE-2023-6507 being exploited?
There is no known exploitation of CVE-2023-6507 in the wild and no public exploit code.
Other vulnerabilities in Python Python
Sources
Also known as AZL-35143, BIT-libpython-2023-6507, BIT-python-2023-6507, BIT-python-min-2023-6507, GHSA-4wxh-fpjf-c8wf, PSF-2023-12 and 2 more.