Vulnerabilities in pkg:pypi/Scrapy
PACKAGECVE-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.
pkg:pypi/Scrapy
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
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).
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.
pip install Scrapy>=2.14.2
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
CVE-2026-105782 Affected Scrapy Versions
1 component(s)| 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?
Which Scrapy versions are affected?
What version fixes CVE-2026-105782?
Is Scrapy affected?
What is the CVSS score of CVE-2026-105782?
What CWE is associated with CVE-2026-105782?
How can I check PyPI dependencies for CVE-2026-105782?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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
}
}