CVE-2021-41125 HTTP authentication credential leak to target websites in scrapy
Scrapy leaks HTTP authentication credentials to all request targets, including redirects and robots.txt, when using global HttpAuthMiddleware.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2021-41125?
CVE-2021-41125 is a medium-severity vulnerability in Debian Debian Linux, published on 6 Oct 2021. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Official description
Scrapy is a high-level web crawling and scraping framework for Python. If you use `HttpAuthMiddleware` (i.e. the `http_user` and `http_pass` spider attributes) for HTTP authentication, all requests will expose your credentials to the request target. This includes requests generated by Scrapy components, such as `robots.txt` requests sent by Scrapy when the `ROBOTSTXT_OBEY` setting is set to `True`, or as requests reached through redirects. Upgrade to Scrapy 2.5.1 and use the new `http_auth_domain` spider attribute to control which domains are allowed to receive the configured HTTP authentication credentials. If you are using Scrapy 1.8 or a lower version, and upgrading to Scrapy 2.5.1 is not an option, you may upgrade to Scrapy 1.8.1 instead. If you cannot upgrade, set your HTTP authentication credentials on a per-request basis, using for example the `w3lib.http.basic_auth_header` function to convert your credentials into a value that you can assign to the `Authorization` header of your request, instead of defining your credentials globally using `HttpAuthMiddleware`.
Which versions are affected by CVE-2021-41125?
5 open source packages ship an affected version, including scrapy and Scrapy. It affects 2 products.
| Package | Affected | Fixed in |
|---|---|---|
scrapy PyPI | All versions | 1.8.1, 2.5.1 |
scrapy PyPI | All versions | 1.8.1 |
scrapy PyPI | From 2.0.0 | 2.5.1 |
Scrapy PyPI | All versions | 1.8.1 |
Scrapy PyPI | From 2.0.0 | 2.5.1 |
Linux distribution packages (1)
python-Scrapy openSUSE:Tumbleweed | All versions | 2.5.1-1.1 |
Products include Debian Debian Linux, Scrapy Scrapy.
How do I fix CVE-2021-41125?
Upgrade scrapy to a fixed version for your release line: 1.8.1 or 2.5.1.
Is CVE-2021-41125 being exploited?
There is no known exploitation of CVE-2021-41125 in the wild and no public exploit code.
Other vulnerabilities in Debian Debian Linux
Sources
Also known as DEBIAN-CVE-2021-41125, GHSA-jwqp-28gf-p498, PYSEC-2021-363, UBUNTU-CVE-2021-41125, openSUSE-SU-2024:11558-1.