Executive brief
LangChain is a popular framework for building AI applications with document loaders and parsers. The SitemapLoader component lacks protection against self-referential sitemaps, allowing an attacker to trigger infinite recursion that crashes the Python process, disrupting services that rely on this functionality.
Technical details
The vulnerability exists in the parse_sitemap method of the SitemapLoader document loader in langchain-community, which fails to detect or prevent infinite recursion when a sitemap URL references itself. An attacker can craft a malicious sitemap that points to itself, causing the parser to enter an infinite loop and exhaust Python's recursion depth limit, resulting in a crash. The vulnerability is triggered when the loader processes the sitemap without depth restrictions or cycle detection. This affects all versions of langchain-community below 0.2.5 and langchain below 0.2.5, and has been patched by adding depth restrictions to sitemap parsing (CVE-2024-2965).
Affected products
- LangChain langchain-community below 0.2.5
- LangChain langchain below 0.2.5
Timeline
- 2024-06-06: disclosed: Vulnerability disclosed via GitHub Advisory GHSA-3hjh-jh2h-vrg6
- 2024-06-14: patched: Fix merged in PR #22903 restricting sitemap parsing depth