GHSA-mfjm-vh54-3f96: Scrapy Scrapy Cookie-setting Is Not Restricted Vulnerability
MODERATEGHSA-mfjm-vh54-3f96 is a MODERATE scrapy cookie-setting is not restricted vulnerability (General Security Weakness) affecting Scrapy libraries in the PyPI ecosystem. The issue involves scrapy cookie-setting is not restricted based on the public suffix list. Remediation is available by upgrading affected packages to version 1.8.2, 2.6.0.
GHSA-mfjm-vh54-3f96 at a Glance
How to Fix GHSA-mfjm-vh54-3f96
To remediate this vulnerability, upgrade all affected Scrapy dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install scrapy>=1.8.2
pip install scrapy>=2.6.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show scrapy
How to Check if You Are Affected
To determine whether your Python environment is affected by GHSA-mfjm-vh54-3f96, inspect your installed packages using pip:
pip show scrapy
Analyze the terminal output to locate any version of Scrapy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.8.2), your application is affected.
Note: The pip show scrapy command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under General Security Weakness. In Scrapy, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-mfjm-vh54-3f96 Affected Scrapy Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
scrapy
|
PyPI |
< 1.8.2
|
1.8.2
|
|
scrapy
|
PyPI |
≥ 2.0.0
< 2.6.0
|
2.6.0
|
References
Frequently Asked Questions
What is GHSA-mfjm-vh54-3f96?
Which Scrapy versions are affected?
What version fixes GHSA-mfjm-vh54-3f96?
Is scrapy affected?
What CWE is associated with GHSA-mfjm-vh54-3f96?
How can I check PyPI dependencies for GHSA-mfjm-vh54-3f96?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mfjm-vh54-3f96",
"modified" : "2023-11-15T18:30:34Z",
"published" : "2022-03-01T22:13:28Z",
"aliases" : [ ],
"summary" : "Scrapy cookie-setting is not restricted based on the public suffix list",
"details" : "### Impact\n\nResponses from domain names whose public domain name suffix contains 1 or more periods (e.g. responses from `example.co.uk`, given its public domain name suffix is `co.uk`) are able to set cookies that are included in requests to any other domain sharing the same domain name suffix.\n\n### Patches\n\nUpgrade to Scrapy 2.6.0, which restricts cookies with their domain set to any of those in the [public suffix list](https://publicsuffix.org/).\n\nIf 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.\n\n### Workarounds\n\nThe only workaround for unpatched versions of Scrapy is to [disable cookies altogether](https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#std-setting-COOKIES_ENABLED), or [limit target domains](https://docs.scrapy.org/en/latest/topics/spiders.html#scrapy.spiders.Spider.allowed_domains) to a subset that does not include domain names with one of the public domain suffixes affected (those with 1 or more periods).\n\n### References\n* https://publicsuffix.org/\n\n### For more information\n\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)\n",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "scrapy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.8.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "scrapy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0"
}, {
"fixed" : "2.6.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/scrapy/scrapy/security/advisories/GHSA-mfjm-vh54-3f96"
}, {
"type" : "WEB",
"url" : "https://github.com/scrapy/scrapy/commit/e865c4430e58a4faa0e0766b23830f8423d6167a"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/scrapy/scrapy"
} ],
"database_specific" : {
"cwe_ids" : [ ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-03-01T22:13:28Z",
"nvd_published_at" : null
}
}