CVE-2026-40087
CVE-2026-40087 — LangChain has incomplete f-string validation in prompt templates
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…
Published Updated Sources: cvelistV5, GitHub_M
Triage
Is it exploited, how likely is exploitation, what does it touch, and how severe do the scoring sources call it.
Exploitation
Unreported
no source claims exploitation
EPSS
<1%
chance of exploitation in 30 days
CVSS base
5.3
MEDIUM
CISA SSVC assessment
Three decision points CISA publishes for the CVEs it assesses · SSVC 2.0.3. A stakeholder decision, not a severity score.
Exploitation
None
none · proof-of-concept · active
Automatable
Yes
can an attacker script all four kill-chain steps
Technical impact
Partial
partial · total control of the vulnerable component
Affected scope
The catalog records vendors and products as separate lists, not pairs, so which product belongs to which vendor is not something this page can say.
Vendors (1)
Products (1)
Every base score collected
Sources score independently and disagree; each row says who scored it and under which version.
| Score | Version | Severity | Expl. | Impact | Source |
|---|---|---|---|---|---|
| 5.3 | CVSS 3.1 | MEDIUM | n/a | n/a | cvelistV5 |
Weakness & attack patterns
- CWE-1336
References
7 on the record
- github.com/langchain-ai/langchain/security/advisories/GHSA-926x-3r5x-gfhw
x_refsource_CONFIRM
- github.com/langchain-ai/langchain/pull/36612
x_refsource_MISC
- github.com/langchain-ai/langchain/pull/36613
x_refsource_MISC
- github.com/langchain-ai/langchain/commit/6bab0ba3c12328008ddca3e0d54ff5a6151cd27b
x_refsource_MISC
- github.com/langchain-ai/langchain/commit/af2ed47c6f008cdd551f3c0d87db3774c8dfe258
x_refsource_MISC
- github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D0.3.84
x_refsource_MISC
- github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D1.2.28
x_refsource_MISC
Related CVEs
Same product first, then the same weakness or threat actor.
- CVE-2026-75650 Adobe Commerce | Improper Neutralization of Special Elements Used in a Template Engine (CWE-1336)CVSS 10.0 · CISA KEV
- CVE-2024-4040 CrushFTP VFS Sandbox Escape VulnerabilityCVSS 10.0 · CISA KEV
- CVE-2024-23692 Rejetto HTTP File Server Improper Neutralization of Special Elements Used in a Template Engine VulnerabilityCVSS 9.8 · CISA KEV
- CVE-2026-138223 David-Crty Databasement Toast Notification Helper Toast.php toast special elements in template engineCVSS 10.0
- CVE-2026-90970 Improper Neutralization of Special Elements Used in a Template Engine in GitLab AI GatewayCVSS 9.9
- CVE-2026-1868 Improper Neutralization of Special Elements Used in a Template Engine in GitLab AI GatewayCVSS 9.9
Elsewhere on this site
- Langchain Aievery CVE for this vendor
- CWE-1336other pages naming this weakness
Not in any source we poll
Listed rather than left blank: an empty field and an unmeasured one look identical on screen, and only one is a reason to look elsewhere.
- No confirmed IOCs, IP addresses, domains, file hashes, or malware artifacts supplied.
- No organization-specific asset inventory, compensating-control status, or patch deployment evidence supplied.
- No exploit packet captures, log samples, or incident case IDs supplied.