CVE-2026-40087 | langchain-ai langchain up to 0.3.82/1.2.27 special elements used in a template engine
VulDBArchived Apr 10, 2026✓ Full text saved
A vulnerability, which was classified as problematic , was found in langchain-ai langchain up to 0.3.82/1.2.27 . Impacted is an unknown function. Executing a manipulation can lead to improper neutralization of special elements used in a template engine. This vulnerability is registered as CVE-2026-40087 . It is possible to launch the attack remotely. No exploit is available. You should upgrade the affected component.
Full text archived locally
✦ AI Summary· Claude Sonnet
VDB-356681 · CVE-2026-40087 · GCVE-0-2026-40087
LANGCHAIN-AI LANGCHAIN UP TO 0.3.82/1.2.27 SPECIAL ELEMENTS USED IN A TEMPLATE ENGINE
HISTORYDIFFRELATEJSONXMLCTI
CVSS Meta Temp Score Current Exploit Price (≈) CTI Interest Score
5.2 $0-$5k 1.37
Summaryinfo
A vulnerability has been found in langchain-ai langchain up to 0.3.82/1.2.27 and classified as problematic. The affected element is an unknown function. The manipulation leads to improper neutralization of special elements used in a template engine. This vulnerability is documented as CVE-2026-40087. The attack can be initiated remotely. There is not any exploit available. The affected component should be upgraded.
Detailsinfo
A vulnerability, which was classified as problematic, has been found in langchain-ai langchain up to 0.3.82/1.2.27. This issue affects an unknown part. The manipulation with an unknown input leads to a improper neutralization of special elements used in a template engine vulnerability. Using CWE to declare the problem leads to CWE-1336. The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine. Impacted is confidentiality. The summary by CVE is:
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.
The advisory is shared at github.com. The identification of this vulnerability is CVE-2026-40087 since 04/09/2026. The exploitation is known to be easy. The attack may be initiated remotely. No form of authentication is needed for a successful exploitation. Neither technical details nor an exploit are publicly available. MITRE ATT&CK project uses the attack technique T1221 for this issue.
Upgrading to version 0.3.83 or 1.2.28 eliminates this vulnerability.
Productinfo
Type
Artificial Intelligence Software
Vendor
langchain-ai
Name
langchain
Version
0.3.0
0.3.1
0.3.2
0.3.3
0.3.4
0.3.5
0.3.6
0.3.7
0.3.8
0.3.9
0.3.10
0.3.11
0.3.12
0.3.13
0.3.14
0.3.15
0.3.16
0.3.17
0.3.18
0.3.19
0.3.20
0.3.21
0.3.22
0.3.23
0.3.24
0.3.25
0.3.26
0.3.27
0.3.28
0.3.29
0.3.30
0.3.31
0.3.32
0.3.33
0.3.34
0.3.35
0.3.36
0.3.37
0.3.38
0.3.39
0.3.40
0.3.41
0.3.42
0.3.43
0.3.44
0.3.45
0.3.46
0.3.47
0.3.48
0.3.49
0.3.50
0.3.51
0.3.52
0.3.53
0.3.54
0.3.55
0.3.56
0.3.57
0.3.58
0.3.59
0.3.60
0.3.61
0.3.62
0.3.63
0.3.64
0.3.65
0.3.66
0.3.67
0.3.68
0.3.69
0.3.70
0.3.71
0.3.72
0.3.73
0.3.74
0.3.75
0.3.76
0.3.77
0.3.78
0.3.79
0.3.80
0.3.81
0.3.82
1.2.0
1.2.1
1.2.2
1.2.3
1.2.4
1.2.5
1.2.6
1.2.7
1.2.8
1.2.9
1.2.10
1.2.11
1.2.12
1.2.13
1.2.14
1.2.15
1.2.16
1.2.17
1.2.18
1.2.19
1.2.20
1.2.21
1.2.22
1.2.23
1.2.24
1.2.25
1.2.26
1.2.27
Website
Product: https://github.com/langchain-ai/langchain/
CPE 2.3info
🔒
🔒
🔒
CPE 2.2info
🔒
🔒
🔒
CVSSv4info
VulDB Vector: 🔒
VulDB Reliability: 🔍
CVSSv3info
VulDB Meta Base Score: 5.3
VulDB Meta Temp Score: 5.2
VulDB Base Score: 5.3
VulDB Temp Score: 5.1
VulDB Vector: 🔒
VulDB Reliability: 🔍
CNA Base Score: 5.3
CNA Vector (GitHub_M): 🔒
CVSSv2info
Vector Complexity Authentication Confidentiality Integrity Availability
Unlock Unlock Unlock Unlock Unlock Unlock
Unlock Unlock Unlock Unlock Unlock Unlock
Unlock Unlock Unlock Unlock Unlock Unlock
VulDB Base Score: 🔒
VulDB Temp Score: 🔒
VulDB Reliability: 🔍
Exploitinginfo
Class: Improper neutralization of special elements used in a template engine
CWE: CWE-1336 / CWE-791 / CWE-790
CAPEC: 🔒
ATT&CK: 🔒
Physical: No
Local: No
Remote: Yes
Availability: 🔒
Status: Not defined
Price Prediction: 🔍
Current Price Estimation: 🔒
0-Day Unlock Unlock Unlock Unlock
Today Unlock Unlock Unlock Unlock
Threat Intelligenceinfo
Interest: 🔍
Active Actors: 🔍
Active APT Groups: 🔍
Countermeasuresinfo
Recommended: Upgrade
Status: 🔍
0-Day Time: 🔒
Upgrade: langchain 0.3.83/1.2.28
Timelineinfo
04/09/2026 Advisory disclosed
04/09/2026 +0 days CVE reserved
04/09/2026 +0 days VulDB entry created
04/09/2026 +0 days VulDB entry last update
Sourcesinfo
Product: github.com
Advisory: github.com
Status: Confirmed
CVE: CVE-2026-40087 (🔒)
GCVE (CVE): GCVE-0-2026-40087
GCVE (VulDB): GCVE-100-356681
Entryinfo
Created: 04/09/2026 22:13
Changes: 04/09/2026 22:13 (63)
Complete: 🔍
Cache ID: 99:A35:101
Discussion
No comments yet. Languages: en.
Please log in to comment.
◂ PreviousOverviewNext ▸