Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2025-65106: CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine in langchain-ai langchain

0
High
VulnerabilityCVE-2025-65106cvecve-2025-65106cwe-1336
Published: Fri Nov 21 2025 (11/21/2025, 21:43:02 UTC)
Source: CVE Database V5
Vendor/Project: langchain-ai
Product: langchain

Description

LangChain is a framework for building agents and LLM-powered applications. From versions 0.3.79 and prior and 1.0.0 to 1.0.6, a template injection vulnerability exists in LangChain's prompt template system that allows attackers to access Python object internals through template syntax. This vulnerability affects applications that accept untrusted template strings (not just template variables) in ChatPromptTemplate and related prompt template classes. This issue has been patched in versions 0.3.80 and 1.0.7.

AI-Powered Analysis

AILast updated: 11/21/2025, 22:02:07 UTC

Technical Analysis

CVE-2025-65106 is a template injection vulnerability classified under CWE-1336, affecting the LangChain framework, a popular tool for building agents and large language model (LLM)-powered applications. The vulnerability exists in LangChain's prompt template system, specifically in versions 0.3.79 and earlier, as well as versions 1.0.0 through 1.0.6. The root cause is improper neutralization of special elements used in the template engine, which allows attackers to inject malicious template syntax. This injection enables attackers to access Python object internals, potentially exposing sensitive data or enabling further code execution within the application context. The vulnerability is exploitable without authentication or user interaction, and it affects applications that accept untrusted template strings, not just template variables, in classes like ChatPromptTemplate. This broadens the attack surface significantly, as developers might inadvertently allow untrusted input to be processed as templates. The vulnerability has been addressed and patched in LangChain versions 0.3.80 and 1.0.7. The CVSS 4.0 score of 8.3 indicates a high-severity issue, with a network attack vector, low attack complexity, no privileges required, no user interaction, and a high impact on confidentiality. Although no known exploits are currently reported in the wild, the potential for exploitation is significant given the widespread adoption of LangChain in AI applications. Organizations using vulnerable versions should prioritize patching and review their use of template inputs to ensure untrusted data is never processed as templates.

Potential Impact

For European organizations, the impact of CVE-2025-65106 can be substantial, particularly for those leveraging LangChain in AI-driven applications such as chatbots, virtual assistants, and automated agents. Exploitation could lead to unauthorized access to sensitive internal data structures, exposing confidential information or intellectual property. This may result in data breaches, loss of customer trust, and regulatory penalties under GDPR if personal data is compromised. The vulnerability’s ability to be exploited remotely without authentication increases the risk of widespread attacks. Sectors such as finance, healthcare, and critical infrastructure that increasingly adopt AI technologies are particularly vulnerable. Additionally, organizations relying on third-party AI services built on LangChain may face indirect risks. The disruption or compromise of AI-powered systems could degrade service availability or integrity, impacting business operations and competitive advantage.

Mitigation Recommendations

1. Immediately upgrade all LangChain deployments to versions 0.3.80 or later, or 1.0.7 or later, where the vulnerability is patched. 2. Audit all applications using LangChain to identify any acceptance of untrusted template strings, especially in ChatPromptTemplate and related classes. 3. Implement strict input validation and sanitization to ensure that template strings are never sourced from untrusted or user-controlled inputs. 4. Where dynamic template generation is necessary, use safe templating practices that separate template logic from data inputs, avoiding direct injection of template syntax. 5. Employ runtime application self-protection (RASP) or web application firewalls (WAF) with custom rules to detect and block suspicious template injection attempts. 6. Conduct security code reviews and penetration testing focusing on template injection vectors. 7. Monitor application logs for unusual template processing behavior or errors indicative of exploitation attempts. 8. Educate developers on secure use of template engines and the risks of processing untrusted template strings.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2025-11-17T20:55:34.694Z
Cvss Version
4.0
State
PUBLISHED

Threat ID: 6920de31ac1487f7bb25177e

Added to database: 11/21/2025, 9:48:33 PM

Last enriched: 11/21/2025, 10:02:07 PM

Last updated: 11/22/2025, 7:56:14 AM

Views: 8

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats