GHSA-jm3v-qxmh-hxwv: Scrapy Scrapy's Redirects Ignoring Scheme-specific Proxy Vulnerability

MODERATE
CVSS 4.3
Published
Advisory Summary

GHSA-jm3v-qxmh-hxwv is a MODERATE (CVSS 4.3) scrapy's redirects ignoring scheme-specific proxy vulnerability (General Security Weakness) affecting Scrapy libraries in the PyPI ecosystem. The issue involves scrapy's redirects ignoring scheme-specific proxy settings. Remediation is available by upgrading affected packages to version 2.11.2.

GHSA-jm3v-qxmh-hxwv at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-jm3v-qxmh-hxwv
Severity MODERATE
CVSS v3.1 Base Score 4.3
CWE Classification General Security Weakness
Affected Product Scrapy
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 4.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N).

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

How to Fix GHSA-jm3v-qxmh-hxwv

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

Scrapy fixed: 2.11.2
pip install Scrapy>=2.11.2
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 Scrapy

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-jm3v-qxmh-hxwv, inspect your installed packages using pip:

pip show Scrapy

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Scrapy, 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

### Impact When using system proxy settings, which are scheme-specific (i.e. specific to `http://` or `https://` URLs), Scrapy was not accounting for scheme changes during redirects. For example, an HTTP request would use the proxy configured for HTTP and, when redirected to an HTTPS URL, the new HTTPS request would still use the proxy configured for HTTP instead of switching to the proxy configured for HTTPS. Same the other way around. If you have different proxy configurations for HTTP and HTTPS in your system for security reasons (e.g., maybe you don’t want one of your proxy providers to be aware of the URLs that you visit with the other one), this would be a security issue. ### Patches Upgrade to Scrapy 2.11.2. ### Workarounds Replace the built-in retry middlewares (`RedirectMiddleware` and `MetaRefreshMiddleware`) and the `HttpProxyMiddleware` middleware with custom ones that implement the fix from Scrapy 2.11.2, and verify that they work as intended. ### References This security issue was reported by @redapple at https://github.com/scrapy/scrapy/issues/767.

GHSA-jm3v-qxmh-hxwv Affected Scrapy Versions

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

References

Frequently Asked Questions

What is GHSA-jm3v-qxmh-hxwv?
GHSA-jm3v-qxmh-hxwv is a security vulnerability in Scrapy involving Scrapy's redirects ignoring scheme-specific proxy settings under General Security Weakness.
Which Scrapy versions are affected?
Affected versions include releases prior to 2.11.2 across affected packages: Scrapy.
What version fixes GHSA-jm3v-qxmh-hxwv?
Upgrading to 2.11.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Scrapy affected?
Yes, Scrapy is affected in releases prior to 2.11.2. Upgrade your dependency to 2.11.2 or later.
What is the CVSS score of GHSA-jm3v-qxmh-hxwv?
GHSA-jm3v-qxmh-hxwv has a CVSS v3.1 base score of 4.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with GHSA-jm3v-qxmh-hxwv?
GHSA-jm3v-qxmh-hxwv is classified under General Security Weakness.
How can I check PyPI dependencies for GHSA-jm3v-qxmh-hxwv?
Run the dependency tree command: 'pip show Scrapy'. 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-jm3v-qxmh-hxwv",
  "modified" : "2024-05-14T20:14:43Z",
  "published" : "2024-05-14T20:14:43Z",
  "aliases" : [ ],
  "summary" : "Scrapy's redirects ignoring scheme-specific proxy settings",
  "details" : "### Impact\n\nWhen using system proxy settings, which are scheme-specific (i.e. specific to `http://` or `https://` URLs), Scrapy was not accounting for scheme changes during redirects.\n\nFor example, an HTTP request would use the proxy configured for HTTP and, when redirected to an HTTPS URL, the new HTTPS request would still use the proxy configured for HTTP instead of switching to the proxy configured for HTTPS. Same the other way around.\n\nIf you have different proxy configurations for HTTP and HTTPS in your system for security reasons (e.g., maybe you don’t want one of your proxy providers to be aware of the URLs that you visit with the other one), this would be a security issue.\n\n### Patches\n\nUpgrade to Scrapy 2.11.2.\n\n### Workarounds\n\nReplace the built-in retry middlewares (`RedirectMiddleware` and `MetaRefreshMiddleware`) and the `HttpProxyMiddleware` middleware with custom ones that implement the fix from Scrapy 2.11.2, and verify that they work as intended.\n\n### References\n\nThis security issue was reported by @redapple at https://github.com/scrapy/scrapy/issues/767.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Scrapy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.11.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/scrapy/scrapy/security/advisories/GHSA-jm3v-qxmh-hxwv"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/scrapy/scrapy/issues/767"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/scrapy/scrapy/commit/1d0502f25bbe55a22899af915623fda1aaeb9dd8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/scrapy/scrapy"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-14T20:14:43Z",
    "nvd_published_at" : null
  }
}