CVE-2024-2965: CWE-674 Uncontrolled Recursion in langchain-ai langchain-ai/langchain
A Denial-of-Service (DoS) vulnerability exists in the `SitemapLoader` class of the `langchain-ai/langchain` repository, affecting all versions. The `parse_sitemap` method, responsible for parsing sitemaps and extracting URLs, lacks a mechanism to prevent infinite recursion when a sitemap URL refers to the current sitemap itself. This oversight allows for the possibility of an infinite loop, leading to a crash by exceeding the maximum recursion depth in Python. This vulnerability can be exploited to occupy server socket/port resources and crash the Python process, impacting the availability of services relying on this functionality.
AI Analysis
Technical Summary
CVE-2024-2965 identifies a Denial-of-Service vulnerability in the langchain-ai/langchain repository, specifically within the SitemapLoader class's parse_sitemap method. This method is designed to parse XML sitemaps and extract URLs for further processing. However, it lacks safeguards against infinite recursion when a sitemap URL points back to the same sitemap, creating a recursive loop. When exploited, this causes the Python interpreter to exceed its maximum recursion depth, leading to a crash of the Python process. The consequence is a denial of service, as the affected service becomes unavailable due to the crash. The vulnerability does not affect confidentiality or integrity but impacts availability. Exploitation requires an attacker to supply or control sitemap URLs that trigger the recursion, which may require network access to the target environment. The CVSS v3.0 score of 4.2 reflects a medium severity, with attack vector being physical or local network (AV:P), high attack complexity (AC:H), no privileges required (PR:N), no user interaction (UI:N), unchanged scope (S:U), and impact limited to availability (A:H). No patches or fixes are currently linked, and no known exploits have been reported in the wild. This vulnerability is relevant for any deployment of langchain that uses the SitemapLoader for automated sitemap parsing, especially in web crawling, AI data ingestion, or SEO tools.
Potential Impact
The primary impact of CVE-2024-2965 is on service availability. European organizations using langchain for sitemap parsing in AI-driven applications, web crawling, or data aggregation could experience service interruptions if an attacker exploits this vulnerability. The DoS condition could lead to downtime, affecting business continuity and user experience. While the vulnerability does not compromise data confidentiality or integrity, the disruption of services could impact critical operations, especially in sectors relying on automated data ingestion or AI workflows. Additionally, resource exhaustion from repeated crashes could increase operational costs and complicate incident response. Given the medium CVSS score and the requirement for an attacker to supply malicious sitemap URLs, the risk is moderate but should not be ignored. Organizations in Europe with public-facing services or internal tools using langchain should evaluate exposure and potential attack vectors.
Mitigation Recommendations
To mitigate CVE-2024-2965, organizations should implement the following specific measures: 1) Update or patch langchain to a version that includes a fix preventing infinite recursion in SitemapLoader, if available. 2) If no official patch exists, modify the parse_sitemap method to include recursion depth limits or cycle detection mechanisms to prevent processing the same sitemap URL repeatedly. 3) Validate and sanitize all sitemap URLs before processing, rejecting or flagging URLs that reference the current sitemap or create loops. 4) Employ network segmentation and access controls to limit exposure of sitemap parsing services to untrusted sources. 5) Monitor application logs for repeated sitemap parsing failures or crashes indicative of exploitation attempts. 6) Consider implementing rate limiting or request throttling on sitemap ingestion endpoints to reduce the risk of resource exhaustion. 7) Conduct regular security reviews and fuzz testing of sitemap processing components to identify similar logic flaws. These steps go beyond generic advice by focusing on code-level fixes, input validation, and operational controls tailored to the nature of this vulnerability.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden
CVE-2024-2965: CWE-674 Uncontrolled Recursion in langchain-ai langchain-ai/langchain
Description
A Denial-of-Service (DoS) vulnerability exists in the `SitemapLoader` class of the `langchain-ai/langchain` repository, affecting all versions. The `parse_sitemap` method, responsible for parsing sitemaps and extracting URLs, lacks a mechanism to prevent infinite recursion when a sitemap URL refers to the current sitemap itself. This oversight allows for the possibility of an infinite loop, leading to a crash by exceeding the maximum recursion depth in Python. This vulnerability can be exploited to occupy server socket/port resources and crash the Python process, impacting the availability of services relying on this functionality.
AI-Powered Analysis
Technical Analysis
CVE-2024-2965 identifies a Denial-of-Service vulnerability in the langchain-ai/langchain repository, specifically within the SitemapLoader class's parse_sitemap method. This method is designed to parse XML sitemaps and extract URLs for further processing. However, it lacks safeguards against infinite recursion when a sitemap URL points back to the same sitemap, creating a recursive loop. When exploited, this causes the Python interpreter to exceed its maximum recursion depth, leading to a crash of the Python process. The consequence is a denial of service, as the affected service becomes unavailable due to the crash. The vulnerability does not affect confidentiality or integrity but impacts availability. Exploitation requires an attacker to supply or control sitemap URLs that trigger the recursion, which may require network access to the target environment. The CVSS v3.0 score of 4.2 reflects a medium severity, with attack vector being physical or local network (AV:P), high attack complexity (AC:H), no privileges required (PR:N), no user interaction (UI:N), unchanged scope (S:U), and impact limited to availability (A:H). No patches or fixes are currently linked, and no known exploits have been reported in the wild. This vulnerability is relevant for any deployment of langchain that uses the SitemapLoader for automated sitemap parsing, especially in web crawling, AI data ingestion, or SEO tools.
Potential Impact
The primary impact of CVE-2024-2965 is on service availability. European organizations using langchain for sitemap parsing in AI-driven applications, web crawling, or data aggregation could experience service interruptions if an attacker exploits this vulnerability. The DoS condition could lead to downtime, affecting business continuity and user experience. While the vulnerability does not compromise data confidentiality or integrity, the disruption of services could impact critical operations, especially in sectors relying on automated data ingestion or AI workflows. Additionally, resource exhaustion from repeated crashes could increase operational costs and complicate incident response. Given the medium CVSS score and the requirement for an attacker to supply malicious sitemap URLs, the risk is moderate but should not be ignored. Organizations in Europe with public-facing services or internal tools using langchain should evaluate exposure and potential attack vectors.
Mitigation Recommendations
To mitigate CVE-2024-2965, organizations should implement the following specific measures: 1) Update or patch langchain to a version that includes a fix preventing infinite recursion in SitemapLoader, if available. 2) If no official patch exists, modify the parse_sitemap method to include recursion depth limits or cycle detection mechanisms to prevent processing the same sitemap URL repeatedly. 3) Validate and sanitize all sitemap URLs before processing, rejecting or flagging URLs that reference the current sitemap or create loops. 4) Employ network segmentation and access controls to limit exposure of sitemap parsing services to untrusted sources. 5) Monitor application logs for repeated sitemap parsing failures or crashes indicative of exploitation attempts. 6) Consider implementing rate limiting or request throttling on sitemap ingestion endpoints to reduce the risk of resource exhaustion. 7) Conduct regular security reviews and fuzz testing of sitemap processing components to identify similar logic flaws. These steps go beyond generic advice by focusing on code-level fixes, input validation, and operational controls tailored to the nature of this vulnerability.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- @huntr_ai
- Date Reserved
- 2024-03-26T19:55:25.763Z
- Cvss Version
- 3.0
- State
- PUBLISHED
Threat ID: 68ef9b26178f764e1f470b79
Added to database: 10/15/2025, 1:01:26 PM
Last enriched: 10/15/2025, 1:26:01 PM
Last updated: 10/16/2025, 1:04:51 PM
Views: 3
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2025-9804: Vulnerability in WSO2 WSO2 Identity Server as Key Manager
CriticalCVE-2025-9152: Vulnerability in WSO2 WSO2 API Manager
CriticalCVE-2025-9955: Vulnerability in WSO2 WSO2 Enterprise Integrator
MediumCVE-2025-10611: Vulnerability in WSO2 WSO2 API Manager
CriticalFuji Electric HMI Configurator Flaws Expose Industrial Organizations to Hacking
MediumActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.