CVE-2024-40647
Python vulnerability analysis and mitigation

Overview

A vulnerability in Sentry's Python SDK versions prior to 2.8.0 allows environment variables to be passed to subprocesses despite the env={} setting. The issue was discovered and disclosed in July 2024, affecting applications using the Sentry Python SDK with the Stdlib integration enabled (which is enabled by default). The vulnerability is tracked as CVE-2024-40647 (GitHub Advisory).

Technical details

In Python's subprocess module, environment variables are passed to subprocesses by default. While developers can use the env argument in subprocess calls to control this behavior, setting env={} to prevent environment variable inheritance, the bug in Sentry SDK causes all environment variables to be passed regardless when the Stdlib integration is enabled. This occurs because during the arguments modification to subprocess.Popen.init, an explicitly empty environment of {} is incorrectly confused with a None environment, causing Sentry to pass the entire environment of the parent process instead of just the injected environment variables. The vulnerability has been assigned a CVSS v3.1 score of 5.3 (Medium) with vector: CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:N/A:N (GitHub Advisory).

Impact

The vulnerability can lead to unintended exposure of sensitive environment variables to subprocess calls, even when explicitly configured not to do so. This could potentially expose sensitive information such as API keys, credentials, or other confidential data stored in environment variables to child processes that should not have access to them (GitHub Advisory).

Mitigation and workarounds

The issue has been patched in sentry-sdk version 2.8.0 and backported to version 1.45.1. For users unable to upgrade, two workarounds are available: 1) Replace env={} with a minimal dict like env={"EMPTY_ENV":"1"}, or 2) Disable the Stdlib integration by removing it from the default integrations before initializing Sentry. The recommended approach is to upgrade to the latest SDK version (GitHub Advisory).

Additional resources


SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-66471HIGH8.9
  • PythonPython
  • py3-urllib3
NoYesDec 05, 2025
CVE-2025-66418HIGH8.9
  • PythonPython
  • python-urllib3
NoYesDec 05, 2025
CVE-2025-65958HIGH8.5
  • PythonPython
  • cpe:2.3:a:openwebui:open_webui
NoYesDec 04, 2025
CVE-2025-56427HIGH7.5
  • PythonPython
  • composio
NoNoDec 04, 2025
CVE-2025-63681MEDIUM4.3
  • PythonPython
  • open-webui
NoNoDec 04, 2025

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management