GHSA-mfjm-vh54-3f96: Scrapy Scrapy Cookie-setting Is Not Restricted Vulnerability

MODERATE
Published
Advisory Summary

GHSA-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

CVE Identifier N/A
GHSA Identifier GHSA-mfjm-vh54-3f96
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Scrapy
Package Ecosystem PyPI
Published Date
Last Updated

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.

scrapy fixed: 1.8.2
pip install scrapy>=1.8.2
scrapy fixed: 2.6.0
pip install scrapy>=2.6.0
Verify Direct and Transitive Dependencies

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

### Impact Responses 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. ### Patches Upgrade to Scrapy 2.6.0, which restricts cookies with their domain set to any of those in the [public suffix list](https://publicsuffix.org/). 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. ### Workarounds The 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). ### References * https://publicsuffix.org/ ### For more information If you have any questions or comments about this advisory: * [Open an issue](https://github.com/scrapy/scrapy/issues) * [Email us](mailto:opensource@zyte.com)

GHSA-mfjm-vh54-3f96 Affected Scrapy Versions

2 component(s)
Fixed Versions:
1.8.22.6.0
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?
GHSA-mfjm-vh54-3f96 is a security vulnerability in Scrapy involving Scrapy cookie-setting is not restricted based on the public suffix list under General Security Weakness.
Which Scrapy versions are affected?
Affected versions include releases prior to 1.8.2, 2.6.0 across affected packages: scrapy.
What version fixes GHSA-mfjm-vh54-3f96?
Upgrading to 1.8.2, 2.6.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is scrapy affected?
Yes, scrapy is affected in releases prior to 1.8.2, 2.6.0. Upgrade your dependency to 1.8.2, 2.6.0 or later.
What CWE is associated with GHSA-mfjm-vh54-3f96?
GHSA-mfjm-vh54-3f96 is classified under General Security Weakness.
How can I check PyPI dependencies for GHSA-mfjm-vh54-3f96?
Run the dependency tree command: 'pip show scrapy'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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
  }
}