Sentry's Python SDK unintentionally exposes environment variables to subprocesses
Impact
The bug in Sentry's Python SDK <2.8.0 results in the unintentional exposure of environment variables to subprocesses despite the env={} setting.
Details
In Python's subprocess calls, all environment variables are passed to subprocesses by default. However, if you specifically do not want them to be passed to subprocesses, you may use env argument in subprocess calls, like in this example:
>>> subprocess.check_output(["env"], env={"TEST":"1"})
b'TEST=1\n'
If you'd want to not pass any variables, you can set an empty dict:
>>> subprocess.check_output(["env"], env={})
b''
However, the bug in Sentry SDK <2.8.0 causes all environment variables to be passed to the subprocesses when env={} is set, unless the Sentry SDK's Stdlib integration is disabled. The Stdlib integration is enabled by default.
Patches
The issue has been patched in https://github.com/getsentry/sentry-python/pull/3251 and the fix released in sentry-sdk==2.8.0. The fix was also backported to sentry-sdk==1.45.1.
Workarounds
We strongly recommend upgrading to the latest SDK version. However, if it's not possible, and if passing environment variables to child processes poses a security risk for you, there are two options:
- In your application, replace
env={}with the minimal dictenv={"EMPTY_ENV":"1"}or similar.
OR
- Disable Stdlib integration:
import sentry_sdk
# Should go before sentry_sdk.init
sentry_sdk.integrations._DEFAULT_INTEGRATIONS.remove("sentry_sdk.integrations.stdlib.StdlibIntegration")
sentry_sdk.init(...)
References
- Sentry docs: Default integrations
- Python docs: subprocess module
- Patch https://github.com/getsentry/sentry-python/pull/3251
Betroffene Software
Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.
| Plattform | Paket | Anfällige Versionen | Behoben in |
|---|---|---|---|
| Python (PyPI) | sentry-sdk | >= 2.0.0a1, < 2.8.0, < 1.45.1 | 2.8.0, 1.45.1 |
Verweise
- https://github.com/getsentry/sentry-python/security/advisories/GHSA-g92j-qhmh-64v2
- https://nvd.nist.gov/vuln/detail/CVE-2024-40647
- https://github.com/getsentry/sentry-python/pull/3251
- https://github.com/getsentry/sentry-python/commit/763e40aa4cb57ecced467f48f78f335c87e9bdff
- https://docs.python.org/3/library/subprocess.html
- https://docs.sentry.io/platforms/python/integrations/default-integrations
- https://docs.sentry.io/platforms/python/integrations/default-integrations/#stdlib
- https://github.com/getsentry/sentry-python
- https://github.com/getsentry/sentry-python/releases/tag/1.45.1
- https://github.com/getsentry/sentry-python/releases/tag/2.8.0
- https://lists.debian.org/debian-lts-announce/2026/06/msg00001.html
- https://pypi.org/project/sentry-sdk
- https://github.com/advisories/GHSA-g92j-qhmh-64v2
- CVSS-Vektor
CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:L/I:N/A:N- Schwäche (CWE)
CWE-200- Plattform
- Python (PyPI)
- Paket
sentry-sdk- Veröffentlicht
- 18.07.2024
- Aktualisiert
- 11.10.2026 13:19
Quellen und Lizenzen
OSV / GitHub Advisory Database - PYSEC-2026-1917 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-g92j-qhmh-64v2 - CC BY 4.0
Schwachstellenhistorie: sentry-sdk
Alle veröffentlichten Schwachstellen dieses Pakets (Python (PyPI)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.
- Einträge insgesamt
- 2
- Erste → letzte
- 03.2023 07.2024
- Ohne Fix
- 0
- In Angriffen ausgenutzt
- 0
Verteilung nach Schweregrad
- Hoch 1
- Niedrig 1
Veröffentlichungen pro Jahr
- 2023: 1
- 2024: 1
- 2025: 0
- 2026: 0
-
Sentry's Python SDK unintentionally exposes environment variables to subprocesses dieser Eintrag
Erkennen Sie Schwachstellen in Ihrer Anwendung
Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.