Skip to main content

Scrapy: Arbitrary Module Import via Referrer-Policy Header in RefererMiddleware

0
High
Published: 08/13/2026 (08/13/2026, 17:34:19 UTC)
Source: GCVE Database
Product: scrapy

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

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

Affected software

Homebrewmore threats →ghsa
scrapy
pkg:brew/scrapy
Affected versions
>=2.9.0 <2.14.2

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

AILast updated: 09/18/2026, 01:50:07 UTC

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.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

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 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses