All vulnerabilities
CVE-2022-0577GHSA-cjvr-mfj7-j4j8PYSEC-2022-159

Incorrect Authorization and Exposure of Sensitive Information to an Unauthorized Actor in scrapy

scrapy scrapypipLibraries & packages
CVSS
6.5Medium
ExploitationNo known exploitationNot in CISA KEV, which does not prove it is unexploitedCISA KEV
Exploit odds (EPSS)1.23%Chance of exploitation activity in the next 30 days, higher than 68% of CVEs. Scored 23 Oct 2026FIRST EPSS
Fixed in1.8.2Also 2.6.0, 2.6.1GitHub
Published2 Mar 2022Updated 24 Sep 2026CVE List

What fixes it

  • 1.8.2scrapy, pipGitHub
  • 2.6.0scrapy, pipGitHub
  • 2.6.1scrapy/scrapyCVE List
  • 1.8.2scrapy, PyPIOSVpip install "scrapy>=1.8.2"
  • 2.6.0scrapy, PyPIOSVpip install "scrapy>=2.6.0"

A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.

Description

Impact

If you manually define cookies on a [Request](https://docs.scrapy.org/en/latest/topics/request-response.html#scrapy.http.Request) object, and that Request object gets a redirect response, the new Request object scheduled to follow the redirect keeps those user-defined cookies, regardless of the target domain.

Patches

Upgrade to Scrapy 2.6.0, which resets cookies when creating Request objects to follow redirects¹, and drops the `Cookie` header if manually-defined if the redirect target URL domain name does not match the source URL domain name².

If you are using Scrapy 1.8 or a lower version, and upgrading to Scrapy 2.6.0 is not an option, you may upgrade to Scrapy 1.8.2 instead.

¹ At that point the original, user-set cookies have been processed by the cookie middleware into the global or request-specific cookiejar, with their domain restricted to the domain of the original URL, so when the cookie middleware processes the new (redirect) request it will incorporate those cookies into the new request as long as the domain of the new request matches the domain of the original request.

² This prevents cookie leaks to unintended domains even if the cookies middleware is not used.

Workarounds

If you cannot upgrade, set your cookies using a list of dictionaries instead of a single dictionary, as described in the [Request documentation](https://docs.scrapy.org/en/latest/topics/request-response.html#scrapy.http.Request), and set the right domain for each cookie.

Alternatively, you can disable cookies altogether, or limit target domains to domains that you trust with all your user-set cookies.

References

For more information

If you have any questions or comments about this advisory:

Text from GitHub Advisory Database

Affected versions 65

  • scrapy, pip< 1.8.2GitHub
  • scrapy, pip>= 2.0.0, < 2.6.0GitHub
  • scrapy/scrapyaffected: unspecified before 2.6.1CVE List
  • scrapy, PyPIfrom first release, fixed in 1.8.2OSV
  • scrapy, PyPI0.10.4.2364OSV
  • scrapy, PyPI0.12.0.2550OSV
  • scrapy, PyPI0.14.1OSV
  • scrapy, PyPI0.14.2OSV
  • scrapy, PyPI0.14.3OSV
  • scrapy, PyPI0.14.4OSV
  • scrapy, PyPI0.16.0OSV
  • scrapy, PyPI0.16.1OSV
  • scrapy, PyPI0.16.2OSV
  • scrapy, PyPI0.16.3OSV
  • scrapy, PyPI0.16.4OSV
  • scrapy, PyPI0.16.5OSV
  • scrapy, PyPI0.18.0OSV
  • scrapy, PyPI0.18.1OSV
  • scrapy, PyPI0.18.2OSV
  • scrapy, PyPI0.18.3OSV
  • scrapy, PyPI0.18.4OSV
  • scrapy, PyPI0.20.0OSV
  • scrapy, PyPI0.20.1OSV
  • scrapy, PyPI0.20.2OSV
  • scrapy, PyPI0.22.0OSV
  • scrapy, PyPI0.22.1OSV
  • scrapy, PyPI0.22.2OSV
  • scrapy, PyPI0.24.0OSV
  • scrapy, PyPI0.24.1OSV
  • scrapy, PyPI0.24.2OSV
  • scrapy, PyPI0.24.3OSV
  • scrapy, PyPI0.24.4OSV
  • scrapy, PyPI0.24.5OSV
  • scrapy, PyPI0.24.6OSV
  • scrapy, PyPI0.7OSV
  • scrapy, PyPI0.8OSV
  • scrapy, PyPI0.9OSV
  • scrapy, PyPI1.0.0OSV
  • scrapy, PyPI1.0.0rc1OSV
  • scrapy, PyPI1.0.0rc2OSV
  • scrapy, PyPI1.0.0rc3OSV
  • scrapy, PyPI1.0.1OSV
  • scrapy, PyPI1.0.2OSV
  • scrapy, PyPI1.0.3OSV
  • scrapy, PyPI1.0.4OSV
  • scrapy, PyPI1.0.5OSV
  • scrapy, PyPI1.0.6OSV
  • scrapy, PyPI1.0.7OSV
  • scrapy, PyPI1.1.0OSV
  • scrapy, PyPI1.1.0rc1OSV
  • scrapy, PyPI1.1.0rc2OSV
  • scrapy, PyPI1.1.0rc3OSV
  • scrapy, PyPI1.1.0rc4OSV
  • scrapy, PyPI1.1.1OSV
  • scrapy, PyPIfrom 2.0.0, fixed in 2.6.0OSV
  • scrapy, PyPI2.0.0OSV
  • scrapy, PyPI2.0.1OSV
  • scrapy, PyPI2.1.0OSV
  • scrapy, PyPI2.2.0OSV
  • scrapy, PyPI2.2.1OSV
  • scrapy, PyPI2.3.0OSV
  • scrapy, PyPI2.4.0OSV
  • scrapy, PyPI2.4.1OSV
  • scrapy, PyPI2.5.0OSV
  • scrapy, PyPI2.5.1OSV

References 7