# CVE-2024-1968: Authorization Header Leakage in scrapy/scrapy on Scheme Change Redirects

> Attackers can intercept sensitive Authorization headers during HTTPS to HTTP redirects, exposing credentials to unauthorized parties.

- **Severity:** High 7.5 (`CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 20 May 2024
- **Updated:** 1 Aug 2024
- **Also known as:** DEBIAN-CVE-2024-1968, GHSA-4qqq-9vqf-3h3f, PYSEC-2024-258, UBUNTU-CVE-2024-1968, openSUSE-SU-2024:14130-1

## What is CVE-2024-1968?

CVE-2024-1968 is a high-severity vulnerability in scrapy/scrapy, published on 20 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

In scrapy/scrapy, an issue was identified where the Authorization header is not removed during redirects that only change the scheme (e.g., HTTPS to HTTP) but remain within the same domain. This behavior contravenes the Fetch standard, which mandates the removal of Authorization headers in cross-origin requests when the scheme, host, or port changes. Consequently, when a redirect downgrades from HTTPS to HTTP, the Authorization header may be inadvertently exposed in plaintext, leading to potential sensitive information disclosure to unauthorized actors. The flaw is located in the _build_redirect_request function of the redirect middleware.

Weakness: CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor)

## Which versions are affected by CVE-2024-1968?

3 open source packages ship an affected version, including scrapy and Scrapy. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `scrapy` | PyPI | All versions | 2.0.0, 2.11.2 |
| `scrapy` | PyPI | All versions | 2.11.2 |
| `Scrapy` | PyPI | All versions | 2.11.2 |
| `python-Scrapy` | openSUSE:Tumbleweed | All versions | 2.11.2-1.1 |

Products: Scrapy Scrapy.

## How do I fix CVE-2024-1968?

Upgrade scrapy to a fixed version for your release line: 2.0.0 or 2.11.2.

## Is CVE-2024-1968 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-1968 exists.

## Other vulnerabilities in scrapy/scrapy

- [CVE-2024-3572](https://insights.sbomify.com/CVE-2024-3572/): XML External Entity (XXE) Vulnerability in scrapy/scrapy (high 7.5)
- [CVE-2024-3574](https://insights.sbomify.com/CVE-2024-3574/): Authorization Header Leak During Cross-Domain Redirect in scrapy/scrapy (high 7.5)
- [CVE-2024-1892](https://insights.sbomify.com/CVE-2024-1892/): ReDoS Vulnerability in scrapy/scrapy's XMLFeedSpider (high 7.5)
- [CVE-2017-14158](https://insights.sbomify.com/CVE-2017-14158/): Scrapy denial of service vulnerability (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-1968 and fix it if it is affected.

What it is: CVE-2024-1968 is a high-severity vulnerability in scrapy/scrapy, published on 20 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-1968 exists.

Affected packages and fixed versions:
- scrapy (PyPI): affected all versions; fixed in 2.0.0, 2.11.2
- scrapy (PyPI): affected all versions; fixed in 2.11.2
- Scrapy (PyPI): affected all versions; fixed in 2.11.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-1968/ (Markdown: https://insights.sbomify.com/CVE-2024-1968/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-1968
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-1968
- OSV: https://osv.dev/vulnerability/CVE-2024-1968

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-1968/
Summaries are generated and may contain mistakes; the official description above is the record.
