Wysoka

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

  • Ujawniono: 13.03.2026
  • Aktualizacja: 15.10.2026 18:17

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 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 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 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 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 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.

Czego dotyczy

Kliknij technologię, aby zobaczyć wszystkie dotyczące jej podatności.

PlatformaPaczkaPodatne wersjePoprawka w wersji
Python (PyPI) scrapy >= 1.4.0, < 2.14.2 2.14.2

Odnośniki

Ocena CVSS 7.5/10
Wektor CVSS
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Słabość (CWE)
CWE-470
Platforma
Python (PyPI)
Paczka
scrapy
Ujawniono
13.03.2026
Aktualizacja
15.10.2026 18:17

Źródła i licencje

OSV / GitHub Advisory Database - PYSEC-2026-4299 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-cwxj-rr6w-m6w7 - CC BY 4.0

Historia podatności: scrapy

Wszystkie opisane podatności tej paczki (Python (PyPI)), od najnowszej. Widać, czy to jednorazowa wpadka, czy paczka, której trzeba pilnować.

Wszystkie (14) w archiwum
Wszystkich wpisów
14
Pierwsza → ostatnia
09.2017 09.2026
Bez poprawki
1
Wykorzystywana w atakach
0

Rozkład istotności

  • Wysoka 6
  • Średnia 8

Ujawnienia w latach

  1. 2017: 1
  2. 2018: 0
  3. 2019: 0
  4. 2020: 0
  5. 2021: 1
  6. 2022: 3
  7. 2023: 0
  8. 2024: 6
  9. 2025: 1
  10. 2026: 2
Istotność:
  1. Scrapy: Arbitrary Module Import via Referrer-Policy Header in RefererMiddleware ten wpis
    Wysoka · 7.5 CVE-2026-105782 >= 1.4.0, < 2.14.2 2.14.2
  2. Wysoka · 7.5 CVE-2024-3572 >= 2.0.0, < 2.11.1, < 1.8.4 2.11.1, 1.8.4
  3. Wysoka · 7.5 CVE-2024-3574 >= 2, < 2.11.1, < 1.8.4 2.11.1, 1.8.4
  4. Wysoka · 7.5 CVE-2017-14158 >= 0.7, <= 2.15.2 brak poprawki

Dowiedz się, które podatności dotyczą Twojej aplikacji

Po podłączeniu integracji DockRay i włączeniu raportowania oprogramowania DockRay porównuje zgłoszone wersje komponentów ze znanymi podatnościami i powiadamia o potwierdzonych dopasowaniach. Zakres zależy od obsługiwanej technologii i dostępnych biuletynów.

Podłącz swoją aplikację
Newsletter DockRay

Bezpieczeństwo aplikacji w Twojej skrzynce

Najważniejsze podatności, konkretne zalecenia i praktyczne wskazówki dla Twoich aplikacji. Wybierz technologie i śledź to, co ma znaczenie dla Twojego projektu.

  • Codzienne zestawienie nowych podatności, także krytycznych.
  • Powiadomienia o ważnych aktualizacjach.
  • Praktyczne porady o bezpieczeństwie i monitoringu aplikacji.

Pozostaw puste, aby otrzymywać informacje o wszystkich technologiach.

Zapis jest bezpłatny. Wypiszesz się jednym kliknięciem w wiadomości.