CVE-2025-65106: CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine in langchain-ai langchain
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 Analysis
Technical Summary
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.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Ireland, Belgium
CVE-2025-65106: CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine in langchain-ai 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
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.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
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 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-13384: CWE-862 Missing Authorization in codepeople CP Contact Form with PayPal
HighCVE-2025-13317: CWE-862 Missing Authorization in codepeople Appointment Booking Calendar
MediumCVE-2025-12877: CWE-862 Missing Authorization in themeatelier IDonate – Blood Donation, Request And Donor Management System
MediumCVE-2025-12752: CWE-345 Insufficient Verification of Data Authenticity in scottpaterson Subscriptions & Memberships for PayPal
MediumCVE-2025-11186: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in humanityco Cookie Notice & Compliance for GDPR / CCPA
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.