CVE-2025-65106 LangChain Vulnerable to Template Injection via Attribute Access in Prompt Templates
Attackers can execute arbitrary code by injecting malicious template syntax into LangChain prompt templates that accept untrusted input.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2025-65106?
CVE-2025-65106 is a high-severity code injection vulnerability in langchain-ai langchain, published on 21 Nov 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official 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.
Weakness: CWE-1336
Which versions are affected by CVE-2025-65106?
5 open source packages ship an affected version, including langchain-core.
| Package | Affected | Fixed in |
|---|---|---|
langchain-core PyPI | All versions | 0.3.80, 1.0.7 |
langchain-core PyPI | All versions | 0.3.80 |
langchain-core PyPI | All versions | 0.3.80 |
langchain-core PyPI | From 1.0.0 | 1.0.7 |
langchain-core PyPI | From 1.0.0 | 1.0.7 |
How do I fix CVE-2025-65106?
Upgrade langchain-core to a fixed version for your release line: 0.3.80 or 1.0.7.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2025-65106 being exploited?
There is no known exploitation of CVE-2025-65106 in the wild and no public exploit code.
Sources
Also known as ECHO-159f-63a0-e634, GHSA-6qv9-48xg-fc7f, PYSEC-2026-1518, ROOT-APP-PYPI-CVE-2025-65106.