CVE-2024-1892: Scrapy Denial of Service Vulnerability
HIGHCVE-2024-1892 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Scrapy libraries in the PyPI ecosystem. The issue involves scrapy vulnerable to redos via xmlfeedspider. Remediation is available by upgrading affected packages to version 2.11.1, 1.8.4.
CVE-2024-1892 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2024-1892
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>=2.11.1
pip install scrapy>=1.8.4
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 CVE-2024-1892, 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 2.11.1), 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 CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. 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
CVE-2024-1892 Affected Scrapy Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
scrapy
|
PyPI |
≥ 2
< 2.11.1
|
2.11.1
|
|
scrapy
|
PyPI |
< 1.8.4
|
1.8.4
|
References
Frequently Asked Questions
What is CVE-2024-1892?
Which Scrapy versions are affected?
What version fixes CVE-2024-1892?
Is scrapy affected?
What is the CVSS score of CVE-2024-1892?
What CWE is associated with CVE-2024-1892?
How can I check PyPI dependencies for CVE-2024-1892?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cc65-xxvf-f7r9",
"modified" : "2025-01-14T16:35:57Z",
"published" : "2024-02-15T15:22:02Z",
"aliases" : [ "CVE-2024-1892" ],
"summary" : "Scrapy vulnerable to ReDoS via XMLFeedSpider",
"details" : "### Impact\n\nThe following parts of the Scrapy API were found to be vulnerable to a [ReDoS attack](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS):\n\n- The [`XMLFeedSpider`](https://docs.scrapy.org/en/latest/topics/spiders.html#scrapy.spiders.XMLFeedSpider) class or any subclass that uses the default node iterator: `iternodes`, as well as direct uses of the `scrapy.utils.iterators.xmliter` function.\n\n- **Scrapy 2.6.0 to 2.11.0**: The [`open_in_browser`](https://docs.scrapy.org/en/latest/topics/debug.html#scrapy.utils.response.open_in_browser) function for a response without a [base tag](https://www.w3schools.com/tags/tag_base.asp). \n\nHandling a malicious response could cause extreme CPU and memory usage during the parsing of its content, due to the use of vulnerable regular expressions for that parsing.\n\n### Patches\n\nUpgrade to Scrapy 2.11.1.\n\nIf you are using Scrapy 1.8 or a lower version, and upgrading to Scrapy 2.11.1 is not an option, you may upgrade to Scrapy 1.8.4 instead.\n\n### Workarounds\n\nFor `XMLFeedSpider`, switch the node iterator to ``xml`` or ``html``.\n\nFor `open_in_browser`, before using the function, either manually review the response content to discard a ReDos attack or manually define the base tag to avoid its automatic definition by `open_in_browser` later.\n\n### Acknowledgements\n\nThis security issue was reported by @nicecatch2000 [through huntr.com](https://huntr.com/bounties/271f94f2-1e05-4616-ac43-41752389e26b/).\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "scrapy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2"
}, {
"fixed" : "2.11.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "scrapy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.8.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/scrapy/scrapy/security/advisories/GHSA-cc65-xxvf-f7r9"
}, {
"type" : "WEB",
"url" : "https://github.com/scrapy/scrapy/commit/479619b340f197a8f24c5db45bc068fb8755f2c5"
}, {
"type" : "WEB",
"url" : "https://github.com/scrapy/scrapy/commit/73e7c0ed011a0565a1584b8052ec757b54e5270b"
}, {
"type" : "WEB",
"url" : "https://docs.scrapy.org/en/latest/news.html#scrapy-1-8-4-2024-02-14"
}, {
"type" : "WEB",
"url" : "https://docs.scrapy.org/en/latest/news.html#scrapy-2-11-1-2024-02-14"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/scrapy/PYSEC-2024-162.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/scrapy/scrapy"
}, {
"type" : "WEB",
"url" : "https://huntr.com/bounties/271f94f2-1e05-4616-ac43-41752389e26b"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1333" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-02-15T15:22:02Z",
"nvd_published_at" : null
}
}