Vulnerabilities in pkg:pypi/Scrapy

PACKAGE
Advisory Identifier: GHSA-cwxj-rr6w-m6w7
Advisory Summary

CVE-2026-105782 is a HIGH (CVSS 7.5) arbitrary module import vulnerability (CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')) affecting Scrapy libraries in the PyPI ecosystem. The issue involves arbitrary module import via referrer-policy header in referermiddleware. Remediation is available by upgrading affected packages to version 2.14.2.

6 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/Scrapy

6 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/Scrapy. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-cwxj-rr6w-m6w7 CVE-2026-105782 HIGH Scrapy: Arbitrary Module Import via Referrer-Policy Header in RefererMiddleware
GHSA-2qfp-q593-8484 CVE-2025-6176 HIGH Scrapy is vulnerable to a denial of service (DoS) attack due to flaws in brotli decompression implementation
GHSA-jwqp-28gf-p498 CVE-2021-41125 MODERATE Scrapy HTTP authentication credentials potentially leaked to target websites
GHSA-4qqq-9vqf-3h3f CVE-2024-1968 MODERATE Scrapy leaks the authorization header on same-domain but cross-origin redirects
GHSA-23j4-mw76-5v7h - MODERATE Scrapy allows redirect following in protocols other than HTTP
GHSA-jm3v-qxmh-hxwv - MODERATE Scrapy's redirects ignoring scheme-specific proxy settings

CVE-2026-105782 at a Glance

CVE Identifier CVE-2026-105782
GHSA Identifier GHSA-cwxj-rr6w-m6w7
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')
Affected Product Scrapy
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

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

How to Fix CVE-2026-105782

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.14.2
pip install Scrapy>=2.14.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 CVE-2026-105782, 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.14.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 CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection'), where the product uses external input with reflection to select which classes or code to use, but it does not sufficiently prevent the input from selecting improper classes or code. 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 Since version 1.4.0, Scrapy respects the `Referrer-Policy` response header to decide whether and how to set a `Referer` header on follow-up requests. If the header value looked like a valid Python import path, Scrapy would import the referenced object and call it, assuming it referred to a referrer policy class (for example, `scrapy.spidermiddlewares.referer.DefaultReferrerPolicy`) and attempting to instantiate it to handle the `Referer` header. A malicious site could exploit this by setting `Referrer-Policy` to a path such as `sys.exit`, causing Scrapy to import and execute it and potentially terminate the process. ### Patches Upgrade to Scrapy 2.14.2 (or later). ### Workarounds If you cannot upgrade to Scrapy 2.14.2, consider the following mitigations. - **Disable the middleware:** If you don't need the `Referer` header on follow-up requests, set [`REFERER_ENABLED`](https://docs.scrapy.org/en/latest/topics/spider-middleware.html#referer-enabled) to `False`. - **Set headers manually:** If you do need a `Referer`, disable the middleware and set the header explicitly on the requests that require it. - **Set `referrer_policy` in request metadata:** If disabling the middleware is not viable, set the [`referrer_policy`](https://docs.scrapy.org/en/latest/topics/spider-middleware.html#referrer-policy) request meta key on all requests to prevent evaluating preceding responses' `Referrer-Policy`. For example: ```python Request( url, meta={ "referrer_policy": "scrapy.spidermiddlewares.referer.DefaultReferrerPolicy", }, ) ``` Instead of editing requests individually, you can: - implement a custom [spider middleware](https://docs.scrapy.org/en/latest/topics/spider-middleware.html) that runs before the built-in referrer policy middleware and sets the `referrer_policy` meta key; or - set the meta key in start requests and use the [scrapy-sticky-meta-params](https://github.com/heylouiz/scrapy-sticky-meta-params) plugin to propagate it to follow-up requests. If you want to continue respecting legitimate `Referrer-Policy` headers while protecting against malicious ones, disable the built-in referrer policy middleware by setting it to `None` in [`SPIDER_MIDDLEWARES`](https://docs.scrapy.org/en/latest/topics/settings.html#std-setting-SPIDER_MIDDLEWARES) and replace it with the fixed implementation from Scrapy 2.14.2. If the Scrapy 2.14.2 implementation is incompatible with your project (for example, because your Scrapy version is older), copy the corresponding middleware from your Scrapy version, apply the same patch, and use that as a replacement.

CVE-2026-105782 Affected Scrapy Versions

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

References

Frequently Asked Questions

What is CVE-2026-105782?
CVE-2026-105782 is a security vulnerability in Scrapy involving Arbitrary Module Import via Referrer-Policy Header in RefererMiddleware under CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection').
Which Scrapy versions are affected?
Affected versions include releases prior to 2.14.2 across affected packages: Scrapy.
What version fixes CVE-2026-105782?
Upgrading to 2.14.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.14.2. Upgrade your dependency to 2.14.2 or later.
What is the CVSS score of CVE-2026-105782?
CVE-2026-105782 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-105782?
CVE-2026-105782 is classified under CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection') (The product uses external input with reflection to select which classes or code to use, but it does not sufficiently prevent the input from selecting improper classes or code.).
How can I check PyPI dependencies for CVE-2026-105782?
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-cwxj-rr6w-m6w7",
  "modified" : "2026-10-05T23:08:58Z",
  "published" : "2026-03-13T20:02:36Z",
  "aliases" : [ "CVE-2026-105782" ],
  "summary" : "Scrapy: Arbitrary Module Import via Referrer-Policy Header in RefererMiddleware",
  "details" : "### Impact\n\nSince version 1.4.0, Scrapy respects the `Referrer-Policy` response header to decide whether and how to set a `Referer` header on follow-up requests.\n\nIf the header value looked like a valid Python import path, Scrapy would import the referenced object and call it, assuming it referred to a referrer policy class (for example, `scrapy.spidermiddlewares.referer.DefaultReferrerPolicy`) and attempting to instantiate it to handle the `Referer` header.\n\nA malicious site could exploit this by setting `Referrer-Policy` to a path such as `sys.exit`, causing Scrapy to import and execute it and potentially terminate the process.\n\n### Patches\n\nUpgrade to Scrapy 2.14.2 (or later).\n\n### Workarounds\n\nIf you cannot upgrade to Scrapy 2.14.2, consider the following mitigations.\n\n- **Disable the middleware:** If you don't need the `Referer` header on follow-up requests, set [`REFERER_ENABLED`](https://docs.scrapy.org/en/latest/topics/spider-middleware.html#referer-enabled) to `False`.\n- **Set headers manually:** If you do need a `Referer`, disable the middleware and set the header explicitly on the requests that require it.\n- **Set `referrer_policy` in request metadata:** If disabling the middleware is not viable, set the [`referrer_policy`](https://docs.scrapy.org/en/latest/topics/spider-middleware.html#referrer-policy) request meta key on all requests to prevent evaluating preceding responses' `Referrer-Policy`. For example:\n\n```python\nRequest(\n    url,\n    meta={\n        \"referrer_policy\": \"scrapy.spidermiddlewares.referer.DefaultReferrerPolicy\",\n    },\n)\n```\n\nInstead of editing requests individually, you can:\n\n- implement a custom [spider middleware](https://docs.scrapy.org/en/latest/topics/spider-middleware.html) that runs before the built-in referrer policy middleware and sets the `referrer_policy` meta key; or\n- set the meta key in start requests and use the [scrapy-sticky-meta-params](https://github.com/heylouiz/scrapy-sticky-meta-params) plugin to propagate it to follow-up requests.\n\nIf you want to continue respecting legitimate `Referrer-Policy` headers while protecting against malicious ones, disable the built-in referrer policy middleware by setting it to `None` in [`SPIDER_MIDDLEWARES`](https://docs.scrapy.org/en/latest/topics/settings.html#std-setting-SPIDER_MIDDLEWARES) and replace it with the fixed implementation from Scrapy 2.14.2.\n\nIf the Scrapy 2.14.2 implementation is incompatible with your project (for example, because your Scrapy version is older), copy the corresponding middleware from your Scrapy version, apply the same patch, and use that as a replacement.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Scrapy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.4.0"
      }, {
        "fixed" : "2.14.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.14.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/scrapy/scrapy/security/advisories/GHSA-cwxj-rr6w-m6w7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/scrapy/scrapy/commit/945b787a263586cb5803c01c6da57daad8997ae5"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/scrapy/scrapy"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-470" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-13T20:02:36Z",
    "nvd_published_at" : null
  }
}