Vulnerabilities in pkg:pypi/sentry-sdk
PACKAGECVE-2024-40647 is a LOW (CVSS 2.5) sentry's python sdk unintentionally exposes vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Sentry sdk libraries in the PyPI ecosystem. The issue involves sentry's python sdk unintentionally exposes environment variables to subprocesses. Remediation is available by upgrading affected packages to version 1.45.1, 2.8.0.
pkg:pypi/sentry-sdk
Vulnerability advisories affecting package pkg:pypi/sentry-sdk. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-g92j-qhmh-64v2 | CVE-2024-40647 | LOW | Sentry's Python SDK unintentionally exposes environment variables to subprocesses |
| GHSA-29pr-6jr8-q5jm | CVE-2023-28117 | HIGH | Sentry SDK leaks sensitive session information when `sendDefaultPII` is set to `True` |
CVE-2024-40647 at a Glance
Security Impact
CVSS: 2.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:L/I:N/A:N).
How to Fix CVE-2024-40647
To remediate this vulnerability, upgrade all affected Sentry sdk dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install sentry-sdk>=1.45.1
pip install sentry-sdk>=2.8.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show sentry-sdk
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-40647, inspect your installed packages using pip:
pip show sentry-sdk
Analyze the terminal output to locate any version of Sentry sdk in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.45.1), your application is affected.
Note: The pip show sentry-sdk command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Sentry sdk, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-40647 Affected Sentry sdk Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
sentry-sdk
|
PyPI |
< 1.45.1
|
1.45.1
|
|
sentry-sdk
|
PyPI |
≥ 2.0.0a1
< 2.8.0
|
2.8.0
|
References
Frequently Asked Questions
What is CVE-2024-40647?
Which Sentry sdk versions are affected?
What version fixes CVE-2024-40647?
Is sentry-sdk affected?
What is the CVSS score of CVE-2024-40647?
What CWE is associated with CVE-2024-40647?
How can I check PyPI dependencies for CVE-2024-40647?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-g92j-qhmh-64v2",
"modified" : "2026-06-01T09:31:10Z",
"published" : "2024-07-18T17:18:46Z",
"aliases" : [ "CVE-2024-40647" ],
"summary" : "Sentry's Python SDK unintentionally exposes environment variables to subprocesses",
"details" : "### Impact\n\nThe bug in Sentry's Python SDK <2.8.0 results in the unintentional exposure of environment variables to subprocesses despite the `env={}` setting.\n\n### Details\n\nIn 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:\n\n```\n>>> subprocess.check_output([\"env\"], env={\"TEST\":\"1\"})\nb'TEST=1\\n'\n```\n\nIf you'd want to not pass any variables, you can set an empty dict:\n\n```\n>>> subprocess.check_output([\"env\"], env={})\nb''\n```\n\nHowever, 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](https://docs.sentry.io/platforms/python/integrations/default-integrations/#stdlib) integration is disabled. The Stdlib integration is enabled by default.\n\n### Patches\nThe issue has been patched in https://github.com/getsentry/sentry-python/pull/3251 and the fix released in [sentry-sdk==2.8.0](https://github.com/getsentry/sentry-python/releases/tag/2.8.0). The fix was also backported to [sentry-sdk==1.45.1](https://github.com/getsentry/sentry-python/releases/tag/1.45.1).\n\n### Workarounds\n\nWe 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:\n\n1. In your application, replace `env={}` with the minimal dict `env={\"EMPTY_ENV\":\"1\"}` or similar.\n\nOR\n\n2. Disable Stdlib integration:\n```\nimport sentry_sdk\n\n# Should go before sentry_sdk.init\nsentry_sdk.integrations._DEFAULT_INTEGRATIONS.remove(\"sentry_sdk.integrations.stdlib.StdlibIntegration\")\n\nsentry_sdk.init(...)\n```\n\n### References\n* Sentry docs: [Default integrations](https://docs.sentry.io/platforms/python/integrations/default-integrations/)\n* Python docs: [subprocess module](https://docs.python.org/3/library/subprocess.html)\n* Patch https://github.com/getsentry/sentry-python/pull/3251",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:L/I:N/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:P/PR:H/UI:N/VC:N/VI:N/VA:N/SC:L/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "sentry-sdk"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0a1"
}, {
"fixed" : "2.8.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "sentry-sdk"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.45.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/getsentry/sentry-python/security/advisories/GHSA-g92j-qhmh-64v2"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-40647"
}, {
"type" : "WEB",
"url" : "https://github.com/getsentry/sentry-python/pull/3251"
}, {
"type" : "WEB",
"url" : "https://github.com/getsentry/sentry-python/commit/763e40aa4cb57ecced467f48f78f335c87e9bdff"
}, {
"type" : "WEB",
"url" : "https://docs.python.org/3/library/subprocess.html"
}, {
"type" : "WEB",
"url" : "https://docs.sentry.io/platforms/python/integrations/default-integrations"
}, {
"type" : "WEB",
"url" : "https://docs.sentry.io/platforms/python/integrations/default-integrations/#stdlib"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/getsentry/sentry-python"
}, {
"type" : "WEB",
"url" : "https://github.com/getsentry/sentry-python/releases/tag/1.45.1"
}, {
"type" : "WEB",
"url" : "https://github.com/getsentry/sentry-python/releases/tag/2.8.0"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2026/06/msg00001.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-200" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2024-07-18T17:18:46Z",
"nvd_published_at" : "2024-07-18T17:15:05Z"
}
}