Scrapy: Arbitrary Module Import via Referrer-Policy Header in RefererMiddleware
Scrapy versions from 2.9.0 up to but not including 2.14.2 contain a vulnerability in the RefererMiddleware where the Referrer-Policy response header is improperly handled. If the header value resembles a valid Python import path, Scrapy imports and executes the referenced object, which can be exploited by a malicious site to execute arbitrary code such as terminating the process. This can lead to denial of service. A patch is available in Scrapy 2.14.2.
AI Analysis
Technical Summary
Since Scrapy 1.4.0, the RefererMiddleware respects the Referrer-Policy response header to determine how to set the Referer header on follow-up requests. However, if the Referrer-Policy header contains a string that looks like a Python import path, Scrapy attempts to import and instantiate the referenced object as a referrer policy class. This behavior allows an attacker controlling the Referrer-Policy header to cause arbitrary module import and execution, for example by setting it to 'sys.exit' to terminate the process. This vulnerability affects Scrapy versions >=2.9.0 and <2.14.2. The issue is fixed in Scrapy 2.14.2.
Potential Impact
An attacker controlling the Referrer-Policy header can cause Scrapy to import and execute arbitrary Python modules, potentially terminating the process or causing other unintended behavior. This results in a denial of service impact (availability). There is no indication of confidentiality or integrity impact. No known exploits in the wild have been reported.
Mitigation Recommendations
Upgrade to Scrapy version 2.14.2 or later, where this vulnerability is fixed. If upgrading is not possible, mitigate by disabling the RefererMiddleware (set REFERER_ENABLED to False) or manually setting the Referer header on requests. Alternatively, set the 'referrer_policy' request meta key to a safe value to prevent evaluating untrusted Referrer-Policy headers. Another option is to disable the built-in middleware and replace it with the patched implementation from Scrapy 2.14.2 or backport the patch to your version. Follow the vendor's advisory for detailed mitigation steps.
Scrapy: Arbitrary Module Import via Referrer-Policy Header in RefererMiddleware
Description
Scrapy versions from 2.9.0 up to but not including 2.14.2 contain a vulnerability in the RefererMiddleware where the Referrer-Policy response header is improperly handled. If the header value resembles a valid Python import path, Scrapy imports and executes the referenced object, which can be exploited by a malicious site to execute arbitrary code such as terminating the process. This can lead to denial of service. A patch is available in Scrapy 2.14.2.
CVSS v3.1
Score 7.5high
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
Since Scrapy 1.4.0, the RefererMiddleware respects the Referrer-Policy response header to determine how to set the Referer header on follow-up requests. However, if the Referrer-Policy header contains a string that looks like a Python import path, Scrapy attempts to import and instantiate the referenced object as a referrer policy class. This behavior allows an attacker controlling the Referrer-Policy header to cause arbitrary module import and execution, for example by setting it to 'sys.exit' to terminate the process. This vulnerability affects Scrapy versions >=2.9.0 and <2.14.2. The issue is fixed in Scrapy 2.14.2.
Potential Impact
An attacker controlling the Referrer-Policy header can cause Scrapy to import and execute arbitrary Python modules, potentially terminating the process or causing other unintended behavior. This results in a denial of service impact (availability). There is no indication of confidentiality or integrity impact. No known exploits in the wild have been reported.
Mitigation Recommendations
Upgrade to Scrapy version 2.14.2 or later, where this vulnerability is fixed. If upgrading is not possible, mitigate by disabling the RefererMiddleware (set REFERER_ENABLED to False) or manually setting the Referer header on requests. Alternatively, set the 'referrer_policy' request meta key to a safe value to prevent evaluating untrusted Referrer-Policy headers. Another option is to disable the built-in middleware and replace it with the patched implementation from Scrapy 2.14.2 or backport the patch to your version. Follow the vendor's advisory for detailed mitigation steps.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- BREW-scrapy-GHSA-cwxj-rr6w-m6w7
- Osv Schema Version
- 1.7.3
- Ecosystems
- ["Homebrew"]
- Cvss Version
- 3.1
Threat ID: 6aac8e5655bf5e2cf5491816
Added to database: 09/18/2026, 01:05:26 UTC
Last enriched: 09/18/2026, 01:50:07 UTC
Last updated: 09/18/2026, 02:07:36 UTC
Views: 4
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.