Skip to main content
VulnerabilityPublished Updated

CVE-2024-2965: langchain-ai/langchain · Uncontrolled Recursion

Affects langchain-ai/langchainSource CVE Database V5

0

Not known to be exploited · CVSS 4.2 Medium.

Data as of 26 Oct 2026, 09:15 UTC

CVSS 3.0 base score
4.2Medium
How severe the flaw is on the 0–10 CVSS scale.
EPSS
0.3% chance of exploitation in 30 days – higher than 22% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
CVSS:3.0/AV:P/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 6 Jun 2024

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponised: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 26 Oct 2026.

What to do

Affected software

ProductAffectedFixed in
PyPIlangchainpkg:pypi/langchainOther threatsAffected
  • *
Fixed in–

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

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

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.

References

Community reviews

Loading reviews…