{"id":"CVE-2025-65106","published":"2025-11-21T21:43:02Z","modified":"2025-11-21T21:53:19Z","title":"LangChain Vulnerable to Template Injection via Attribute Access in Prompt Templates","vendor":"langchain-ai","product":"langchain","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.3,"severity":"HIGH","version":"4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00524,"percentile":0.45364,"provenance":"source"},"cwes":[{"id":"CWE-1336","name":"Improper Neutralization of Special Elements Used in a Template Engine"}],"references":[{"url":"https://github.com/langchain-ai/langchain/security/advisories/GHSA-6qv9-48xg-fc7f","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/langchain-ai/langchain/commit/c4b6ba254e1a49ed91f2e268e6484011c540542a","tags":["x_refsource_MISC"]},{"url":"https://github.com/langchain-ai/langchain/commit/fa7789d6c21222b85211755d822ef698d3b34e00","tags":["x_refsource_MISC"]}],"priority":{"score":14.9,"factors":[{"name":"EPSS percentile","points":9.07},{"name":"CVSS severity","points":5.81}]},"vendorSlug":"langchain-ai","affectedVersions":[{"vendor":"langchain-ai","product":"langchain","versions":[">= 1.0.0, < 1.0.7","< 0.3.80"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2025-11-21T21:53:02.259742Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"langchain-core","vulnerableRanges":[">=1.0.0, <1.0.7","<0.3.80"],"patched":["1.0.7","0.3.80"],"from":["GHSA-6qv9-48xg-fc7f","PYSEC-2026-1518"],"provenance":"source"}],"summary":{"text":"The LangChain framework's prompt template system (langchain, in ChatPromptTemplate and related prompt template classes) contains a template injection flaw that lets template syntax reach Python object internals when applications accept untrusted template strings rather than only template variables. An attacker who can supply such a template string over the network, without authentication or user interaction, can read sensitive data held in those object internals, with the attack depending on the application passing untrusted input as the template itself.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:31:08Z"},"euvd":{"id":"EUVD-2025-198318","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-langchain-ai-langchain-cve-2024-10940","children":[{"from":"CVE-2025-65106","to":"CVE-2026-40087","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["libs/core/langchain_core/prompts/string.py"],"commits":["https://github.com/langchain-ai/langchain/commit/c4b6ba254e1a49ed91f2e268e6484011c540542a","https://github.com/langchain-ai/langchain/commit/fa7789d6c21222b85211755d822ef698d3b34e00","https://github.com/langchain-ai/langchain/commit/6bab0ba3c12328008ddca3e0d54ff5a6151cd27b","https://github.com/langchain-ai/langchain/commit/af2ed47c6f008cdd551f3c0d87db3774c8dfe258"],"basis":"shared function","functions":["get_template_variables"]}]}],"packageHistory":[{"cve":"CVE-2024-28088","published":"2024-03-03","fixed":"0.1.30","kev":false},{"cve":"CVE-2024-1455","published":"2024-03-26","fixed":"0.1.35","kev":false},{"cve":"CVE-2024-10940","published":"2025-03-20","fixed":"0.3.15","kev":false,"link":{"from":"CVE-2024-10940","to":"CVE-2025-65106","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:langchain-core","fromFixed":"0.3.15","toFixed":"0.3.80","daysApart":246}]}},{"cve":"CVE-2025-65106","published":"2025-11-21","fixed":"1.0.7","kev":false},{"cve":"CVE-2025-68664","published":"2025-12-23","fixed":"1.2.5","kev":false,"link":{"from":"CVE-2025-65106","to":"CVE-2025-68664","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:langchain-core","fromFixed":"1.0.7","toFixed":"1.2.5","daysApart":32},{"kind":"version-step","provenance":"source","package":"PyPI:langchain-core","fromFixed":"0.3.80","toFixed":"0.3.81","daysApart":32}]}},{"cve":"CVE-2026-26013","published":"2026-02-10","fixed":"1.2.11","kev":false},{"cve":"CVE-2026-34070","published":"2026-03-31","fixed":"1.2.22","kev":false}],"package":"PyPI:langchain-core"}}