LiveActive security incident?Get immediate response
CVE Record

CVE-2024-40647: Unintentional exposure of environment variables to subprocesses in sentry-sdk

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.

MediumCVSS 5.3Not KEV-listedUpdated
Glexia's TakeAutomated analysismoderate

Security readout for executives and security teams

Plain-English summary

This issue can cause Python applications using sentry-sdk before 2.8.0 to pass environment variables into child processes even when developers tried to block that with env={}. Business risk is secret exposure, such as tokens or credentials, if those child processes are less trusted, logged, crashed, or observable.

Executive priority

Treat this as a targeted secret-exposure risk, not an internet-wide emergency. Prioritize services that run subprocesses and store credentials in environment variables. Upgrade during the next security patch window, sooner for systems handling production secrets or untrusted subprocess output.

Technical view

With Sentry Python SDK Stdlib integration enabled by default, subprocess handling could ignore the caller's intent to provide an empty environment. Affected versions are sentry-sdk < 2.8.0. The vendor fixed the issue in PR #3251 and released it in sentry-sdk 2.8.0. The CVSS vector indicates local, high-complexity conditions requiring high privileges.

Likely exposure

Exposure is likely limited to Python services using sentry-sdk < 2.8.0 that launch subprocesses with sanitized or empty env settings. Risk increases when environment variables contain credentials and the child process is lower-trust, emits diagnostics, or can be observed by another party.

Exploitation context

The provided sources do not report active exploitation, and KEV is false. Exploitation depends on a vulnerable application invoking subprocesses under conditions where inherited environment variables can be read or leaked. This is not described as a remote unauthenticated flaw.

Researcher notes

Key condition is mismatch between Python subprocess env semantics and Sentry SDK instrumentation. Validate behavior around env replacement without publishing reproduction details. Evidence supports affected product/version, default Stdlib integration relevance, and fixed release, but not active exploitation or broader product impact.

Mitigation direction

  • Upgrade sentry-sdk to version 2.8.0 or later.
  • Prefer the latest supported sentry-sdk release where compatibility allows.
  • If upgrade is blocked, review Sentry guidance on disabling default integrations.
  • Assess whether subprocesses could receive sensitive environment variables.
  • Rotate exposed secrets only when logs or evidence indicate leakage.

Validation and detection

  • Inventory Python applications using sentry-sdk versions earlier than 2.8.0.
  • Identify code paths that call subprocess APIs with env={} or sanitized env values.
  • Confirm whether Sentry Stdlib/default integrations are enabled in those applications.
  • Review child process logs, crash output, and telemetry for environment leakage.
  • Verify package updates through lockfiles, runtime images, and deployed artifacts.
Prepared
Confidence
high
Sources
7

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Potential ATT&CK relevance

Conservative CVE-to-ATT&CK context

These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.

ATT&CK lookup starting points

Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.

cwe · medium confidence lookup

CWE-200: Information exposure and cloud metadata lookup

Information exposure and SSRF weaknesses can make discovery, cloud metadata, and credential material review relevant. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2024-40647 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
Medium
CVSS
5.3 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:N/A:N

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.

1CVSS vectors
3Timeline events
2ADP providers
8Source links

SSVC decision data

CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: partial

CVSS vector scores

1 official score

We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.

ScoreVersionSeverityVectorExploitImpactSource
5.3CVSS 3.1MediumCVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:N/A:N0.84GitHub_M

Vulnerability scoring details

Base CVSS 3.1 score

5.3Medium
CVSS 3.1 vector shape for CVE-2024-40647Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:N/A:N

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone

Vulnerability timeline

Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.

  1. CVE reservedCVE Program

    The CVE ID was reserved by the assigning CNA.

  2. CVE publishedCVE Program

    The CVE record was published.

  3. CVE updatedCVE Program

    The CVE record metadata indicates this as the latest update time.

ADP provider summaries

CISA-ADPCISA ADP Vulnrichment
other:ssvc
CVECVE Program Container
Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
getsentrysentry-python< 2.8.0Listed
Weakness

CWE details

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.

CWE-200 · source CWE mapping

Exposure of Sensitive Information to an Unauthorized Actor

Exposure of Sensitive Information to an Unauthorized Actor represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.