Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. scrapy
  4. ›
  5. GHSA-cwxj-rr6w-m6w7

GHSA-cwxj-rr6w-m6w7: Scrapy: Arbitrary Module Import via Referrer-Policy Header in RefererMiddleware

March 13, 2026

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.

References

  • github.com/advisories/GHSA-cwxj-rr6w-m6w7
  • github.com/scrapy/scrapy
  • github.com/scrapy/scrapy/commit/945b787a263586cb5803c01c6da57daad8997ae5
  • github.com/scrapy/scrapy/security/advisories/GHSA-cwxj-rr6w-m6w7

Code Behaviors & Features

Detect and mitigate GHSA-cwxj-rr6w-m6w7 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 1.4.0 before 2.14.2

Fixed versions

  • 2.14.2

Solution

Upgrade to version 2.14.2 or above.

Impact 7.5 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Learn more about CVSS

Weakness

  • CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')

Source file

pypi/scrapy/GHSA-cwxj-rr6w-m6w7.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 24 Mar 2026 12:19:21 +0000.