CVE-2024-35195: Requests Requests `Session` Object Does Not Vulnerability

MODERATE
Advisory Identifier: GHSA-9wx4-h78v-vm56
CVSS 5.6
CWE-670
Published
Advisory Summary

CVE-2024-35195 is a MODERATE (CVSS 5.6) requests `session` object does not vulnerability (CWE-670: Always-Incorrect Control Flow Implementation) affecting Requests libraries in the PyPI ecosystem. The issue involves requests `session` object does not verify requests after making first request with verify=false. Remediation is available by upgrading affected packages to version 2.32.0.

CVE-2024-35195 at a Glance

CVE Identifier CVE-2024-35195
GHSA Identifier GHSA-9wx4-h78v-vm56
Severity MODERATE
CVSS v3.1 Base Score 5.6
CWE Classification CWE-670: Always-Incorrect Control Flow Implementation
Affected Product Requests
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.6

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:R/S:U/C:H/I:H/A:N).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2024-35195

To remediate this vulnerability, upgrade all affected Requests dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

requests fixed: 2.32.0
pip install requests>=2.32.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show requests

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2024-35195, inspect your installed packages using pip:

pip show requests

Analyze the terminal output to locate any version of Requests in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.32.0), your application is affected.

Note: The pip show requests command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-670: Always-Incorrect Control Flow Implementation, where the code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated. In Requests, 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

When using a `requests.Session`, if the first request to a given origin is made with `verify=False`, TLS certificate verification may remain disabled for all subsequent requests to that origin, even if `verify=True` is explicitly specified later. This occurs because the underlying connection is reused from the session's connection pool, causing the initial TLS verification setting to persist for the lifetime of the pooled connection. As a result, applications may unintentionally send requests without certificate verification, leading to potential man-in-the-middle attacks and compromised confidentiality or integrity. This behavior affects versions of `requests` prior to 2.32.0.

CVE-2024-35195 Affected Requests Versions

1 component(s)
Fixed Versions:
2.32.0
Product / Package Ecosystem Affected Versions Fixed Version
requests
PyPI
< 2.32.0
2.32.0

References

Frequently Asked Questions

What is CVE-2024-35195?
CVE-2024-35195 is a security vulnerability in Requests involving Requests `Session` object does not verify requests after making first request with verify=False under CWE-670: Always-Incorrect Control Flow Implementation.
Which Requests versions are affected?
Affected versions include releases prior to 2.32.0 across affected packages: requests.
What version fixes CVE-2024-35195?
Upgrading to 2.32.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is requests affected?
Yes, requests is affected in releases prior to 2.32.0. Upgrade your dependency to 2.32.0 or later.
What is the CVSS score of CVE-2024-35195?
CVE-2024-35195 has a CVSS v3.1 base score of 5.6 (MODERATE) with vector string CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2024-35195?
CVE-2024-35195 is classified under CWE-670: Always-Incorrect Control Flow Implementation (The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.).
How can I check PyPI dependencies for CVE-2024-35195?
Run the dependency tree command: 'pip show requests'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9wx4-h78v-vm56",
  "modified" : "2026-01-16T00:02:49Z",
  "published" : "2024-05-20T20:15:00Z",
  "aliases" : [ "CVE-2024-35195" ],
  "summary" : "Requests `Session` object does not verify requests after making first request with verify=False",
  "details" : "When using a `requests.Session`, if the first request to a given origin is made with `verify=False`, TLS certificate verification may remain disabled for all subsequent requests to that origin, even if `verify=True` is explicitly specified later.\n\nThis occurs because the underlying connection is reused from the session's connection pool, causing the initial TLS verification setting to persist for the lifetime of the pooled connection. As a result, applications may unintentionally send requests without certificate verification, leading to potential man-in-the-middle attacks and compromised confidentiality or integrity.\n\nThis behavior affects versions of `requests` prior to 2.32.0.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "requests"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.32.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/psf/requests/security/advisories/GHSA-9wx4-h78v-vm56"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-35195"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/psf/requests/pull/6655"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/psf/requests/commit/a58d7f2ffb4d00b46dca2d70a3932a0b37e22fac"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/psf/requests"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/IYLSNK5TL46Q6XPRVMHVWS63MVJQOK4Q"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/N7WP6EYDSUOCOJYHDK5NX43PYZ4SNHGZ"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-670" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-20T20:15:00Z",
    "nvd_published_at" : "2024-05-20T21:15:09Z"
  }
}