CVE-2026-40087LangChain is a framework for building agents and LLM-powered applications.
Updated under an hour ago ()
Does this affect you?
It affects langchain_core. Add what you run to find out whether that includes you.
No exploitation reported and no EPSS estimate yet.
Do this next
Free account, 1 product
LangChain is a framework for building agents and LLM-powered applications. Prior to 0.3.84 and 1.2.28, LangChain's f-string prompt-template validation was incomplete in two respects. First, some prompt template classes accepted f-string templates and formatted them without enforcing the same attribute-access validation as PromptTemplate. In particular, DictPromptTemplate and ImagePromptTemplate could accept templates containing attribute access or indexing expressions and subsequently evaluate those expressions during formatting. Second, f-string validation based on parsed top-level field names did not reject nested replacement fields inside format specifiers. In this pattern, the nested replacement field appears in the format specifier rather than in the top-level field name. As a result, earlier validation based on parsed field names did not reject the template even though Python formatting would still attempt to resolve the nested expression at runtime. This vulnerability is fixed in 0.3.84 and 1.2.28.
- CVSS
- 5.3 MEDIUM (v3.1, NVD)CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
- Weakness (CWE)
- CWE-1336
- Known exploited
- Not in CISA's KEV catalog
- EPSS (exploitation in the next 30 days)
- Not loaded for this CVE
- Assigned by
- Not given
- NVD analysis
- Analyzed
- Record last updated
- Jun 17, 2026
- First seen by InfoSec Signals
- Oct 9, 2026
Affected products
langchain langchain_core langchain:langchain_core | before 0.3.84; from 1.0.0 before 1.2.28 | NVD |
References
- https://github.com/langchain-ai/langchain/commit/6bab0ba3c12328008ddca3e0d54ff5a6151cd27bpatch
- https://github.com/langchain-ai/langchain/commit/af2ed47c6f008cdd551f3c0d87db3774c8dfe258patch
- https://github.com/langchain-ai/langchain/pull/36612issue-tracking, patch
- https://github.com/langchain-ai/langchain/pull/36613issue-tracking, patch
- https://github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D0.3.84product, release-notes
- https://github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D1.2.28product, release-notes
- https://github.com/langchain-ai/langchain/security/advisories/GHSA-926x-3r5x-gfhwmitigation, vendor-advisory
The CVE record on cve.org NVD's entry
The CVE record is authoritative. Products marked “from the name” were identified from the CNA's free-text names, not a CPE, and are matched less certainly. This product uses the NVD API but is not endorsed or certified by the NVD.