LangChain Vulnerable to Template Injection via Attribute Access in Prompt Templates
langchain-ai langchain
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| langchain-core PyPI |
|
|
Original 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.
From the CVE record · GitHub_M
References
- github.com/langchain-ai/langchain/security/advisories/GHSA-6qv9-48xg-fc7f
- github.com/langchain-ai/langchain/commit/c4b6ba254e1a49ed91f2e268e6484011c540542a
- github.com/langchain-ai/langchain/commit/fa7789d6c21222b85211755d822ef698d3b34e00
- github.com/CVEProject/cvelistV5/tree/main/cves/2025/65xxx/CVE-2025-65106.json
- nvd.nist.gov/vuln/detail/CVE-2025-65106
- github.com/langchain-ai/langchain
- pypi.org/project/langchain-core
- github.com/advisories/GHSA-6qv9-48xg-fc7f