{"id":"CVE-2021-41125","aliases":["CVE-2021-41125","GHSA-jwqp-28gf-p498","PYSEC-2021-363"],"related":[],"kind":"vulnerability","state":"published","title":"HTTP authentication credential leak to target websites in scrapy","summary":"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`.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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`.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nIf you use [`HttpAuthMiddleware`](http://doc.scrapy.org/en/latest/topics/downloader-middleware.html#module-scrapy.downloadermiddlewares.httpauth) (i.e. the `http_user` and `http_pass` spider attributes) for HTTP authentication, all requests will expose your credentials to the request target.\n\nThis 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.\n\n### Patches\n\nUpgrade 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.\n\nIf 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.\n\n### Workarounds\n\nIf you cannot upgrade, set your HTTP authentication credentials on a per-request basis, using for example the [`w3lib.http.basic_auth_header`](https://w3lib.readthedocs.io/en/latest/w3lib.html#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`](http://doc.scrapy.org/en/latest/topics/downloader-middleware.html#module-scrapy.downloadermiddlewares.httpauth).\n\n### For more information\nIf you have any questions or comments about this advisory:\n* [Open an issue](https://github.com/scrapy/scrapy/issues)\n* [Email us](mailto:opensource@zyte.com)","format":"markdown","source":"ghsa"},{"lang":"es","text":"Scrapy es un marco de trabajo de alto nivel para el rastreo de la web y el scraping para Python. Si usa \"HttpAuthMiddleware\" (es decir, los atributos de araña \"http_user\" y \"http_pass\") para la autenticación HTTP, todas las peticiones expondrán sus credenciales al objetivo de la petición. Esto incluye las peticiones generadas por los componentes de Scrapy, como las peticiones \"robots.txt\" enviadas por Scrapy cuando la configuración \"ROBOTSTXT_OBEY\" se establece en \"True\", o como las peticiones alcanzadas a través de redirecciones. Actualice a Scrapy 2.5.1 y use el nuevo atributo de araña \"http_auth_domain\" para controlar qué dominios pueden recibir las credenciales de autenticación HTTP configuradas. Si está usando Scrapy versión 1.8 o una versión inferior, y la actualización a Scrapy versión 2.5.1 no es una opción, puede actualizar a Scrapy versión 1.8.1 en su lugar. Si no puede actualizar, establezca sus credenciales de autenticación HTTP por petición, usando por ejemplo la función \"w3lib.http.basic_auth_header\" para convertir sus credenciales en un valor que pueda asignar al encabezado \"Authorization\" de su petición, en lugar de definir sus credenciales globalmente usando \"HttpAuthMiddleware\"","source":"nvd"}],"published":"2021-10-06T17:15:13.000Z","modified":"2026-07-08T06:29:55.026Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:N/A:N","score":5.7,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:N/A:N","score":5.7,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:N/A:N","score":5.7,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:S/C:P/I:N/A:N","score":4,"rating":"MEDIUM"}],"cwes":["CWE-200","CWE-522"],"affected":[{"ranges":[{"version":"< 1.8.1","status":"affected"},{"version":">= 2.0.0, < 2.5.1","status":"affected"}],"vendor":"scrapy","product":"scrapy","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.8.1"}],"ecosystem":"PyPI","package":"scrapy","purl":"pkg:pypi/scrapy","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.0.0","status":"affected","fixed":"2.5.1"}],"ecosystem":"PyPI","package":"scrapy","purl":"pkg:pypi/scrapy","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.8.1"},{"status":"affected","introduced":"2.0.0","fixed":"2.5.1"}],"vendor":"scrapy","product":"scrapy","cpe":"cpe:2.3:a:scrapy:scrapy:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"9.0"}],"vendor":"debian","product":"debian_linux","cpe":"cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"b01d69a1bf48060daec8f751368622352d8b85a6"},{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.8.1"},{"type":"ecosystem","introduced":"2.0.0","status":"affected","fixed":"2.5.1"}],"ecosystem":"PyPI","package":"scrapy","purl":"pkg:pypi/scrapy","repo":"https://github.com/scrapy/scrapy","source":"pysec"}],"references":[{"url":"https://github.com/scrapy/scrapy/security/advisories/GHSA-jwqp-28gf-p498","tags":["advisory","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/scrapy/scrapy/commit/b01d69a1bf48060daec8f751368622352d8b85a6","tags":["fix","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://w3lib.readthedocs.io/en/latest/w3lib.html#w3lib.http.basic_auth_header","tags":["third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"http://doc.scrapy.org/en/latest/topics/downloader-middleware.html#module-scrapy.downloadermiddlewares.httpauth","tags":["vendor-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://lists.debian.org/debian-lts-announce/2022/03/msg00021.html","tags":["mailing-list","third-party-advisory","web","x-refsource-mlist","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-41125","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/scrapy/PYSEC-2021-363.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/scrapy/scrapy","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-41125","url":"https://www.cve.org/CVERecord?id=CVE-2021-41125","licence":"CVE Terms of Use","modified":"2024-08-04T02:59:31.432Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-jwqp-28gf-p498","url":"https://github.com/advisories/GHSA-jwqp-28gf-p498","licence":"CC-BY-4.0","modified":"2026-07-08T06:29:55.026Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-41125","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-41125","licence":"Public domain","modified":"2026-06-17T04:07:55.323Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-363","url":"https://osv.dev/vulnerability/PYSEC-2021-363","licence":"CC-BY-4.0","modified":"2023-11-08T04:06:52.040Z"}],"updatedAt":"2026-11-25T22:58:04.344Z","epss":{"score":0.01261,"percentile":0.69703,"date":"2026-11-30T12:00:22.000Z"}}