Skip to content
Info disclosure Disclosed report Intermediate CVE-2024-1968

Scrapy leaks the authorization header on same-domain but cross-origin redirects

Scrapy kept the Authorization header when a redirect changed only the scheme or port on the same domain, although it should have dropped it. An attacker who can intercept traffic could obtain the header value.

scrapy/scrapy

Originally disclosed on huntr

Impact

Since version 2.11.1, Scrapy drops the Authorization header when a request is redirected to a different domain. However, it keeps the header if the domain remains the same but the scheme (http/https) or the port change, all scenarios where the header should also be dropped.

In the context of a man-in-the-middle attack, this could be used to get access to the value of that Authorization header

Patches

Upgrade to Scrapy 2.11.2.

Workarounds

There is no easy workaround for unpatched versions of Scrapy. You can replace the built-in redirect middlewares with custom ones patched for this issue, but you have to patch them yourself, manually.

References

This security issue was reported and fixed by @szarny at https://huntr.com/bounties/27f6a021-a891-446a-ada5-0226d619dd1a/.

From the GitHub Advisory Database (GHSA-4qqq-9vqf-3h3f, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

In a man-in-the-middle scenario, an attacker could obtain the Authorization header value.

What the attacker needed

Man-in-the-middle position; Scrapy version 2.11.1 or later

The fix

It was fixed in Scrapy 2.11.2; for older versions, custom redirect middlewares must be patched manually.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When a web scraper follows a redirect, it should not send sensitive login information to a different place. Here, it kept sending the Authorization header even when the redirect went to a different port or from https to http on the same domain. Someone who can intercept network traffic could steal that header.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More from scrapy/scrapy

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.