CVE-2024-40647
Unintentional exposure of environment variables to subprocesses in sentry-sdk
Also known as GHSA-g92j-qhmh-64v2, PYSEC-2026-1917
Mitigation
- Upgrade sentry-sdk to one of 2.8.0, 1.45.1 (or later in the same release line).
Who should check
- Projects that depend on PyPI package sentry-sdk (>= 2.0.0a1, < 2.8.0)
- Anyone running getsentry sentry-python < 2.8.0
Vulnerability facts
- Affected
- sentry-sdk >= 2.0.0a1, < 2.8.0
- Fixed in
- 2.8.0, 1.45.1
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Not remotely exploitable (local or adjacent access needed)
- CVSS
- 5.3 (v3.1, CNA)CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:N/A:NOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Local
- Attack complexity: High
- Privileges required: High
- User interaction: None
- Scope: Changed (impact reaches other components)
- Confidentiality impact: High
- Integrity impact: None
- Availability impact: None
- EPSS
- 0.27% chance of exploitation in 30 days (percentile 12, 2026-11-26)
- CWE
- CWE-200
- Modified
Description
sentry-sdk is the official Python SDK for Sentry.io. A bug in Sentry's Python SDK < 2.8.0 allows the environment variables to be passed to subprocesses despite the `env={}` setting. 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. Due to the bug in Sentry SDK, with the Stdlib integration enabled (which is enabled by default), this expectation is not fulfilled, and all environment variables are being passed to subprocesses instead. The issue has been patched in pull request #3251 and is included in sentry-sdk==2.8.0. 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, you can disable all default integrations.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| PyPI sentry-sdk | >= 2.0.0a1, < 2.8.0 | 2.8.0, 1.45.1 | osv |
| getsentry sentry-python | < 2.8.0 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2024-40647. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2024-40647.md Affected: sentry-sdk >= 2.0.0a1, < 2.8.0 Fixed in: 2.8.0, 1.45.1 Steps: 1. Search this machine and project for sentry-sdk (PyPI), getsentry sentry-python: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
Patches
Other
- 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/releases/tag/2.8.0
- https://lists.debian.org/debian-lts-announce/2026/06/msg00001.html
- https://github.com/getsentry/sentry-python
- https://github.com/getsentry/sentry-python/releases/tag/1.45.1
- https://pypi.org/project/sentry-sdk
FAQ
Is CVE-2024-40647 being exploited?
There is no confirmed exploitation: CVE-2024-40647 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.27% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2024-40647?
Medium: CVSS 5.3 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.
Which versions are affected by CVE-2024-40647?
sentry-sdk >= 2.0.0a1, < 2.8.0.
Is there a fix for CVE-2024-40647?
Yes. Fixed in 2.8.0, 1.45.1. Upgrade sentry-sdk to one of 2.8.0, 1.45.1 (or later in the same release line).
How do I check if I'm affected by CVE-2024-40647?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.