CVE-2026-40087

Published: Apr 09, 2026 Last Modified: Apr 16, 2026
ExploitDB:
Other exploit source:
Google Dorks:
MEDIUM 5,3
Attack Vector: network
Attack Complexity: low
Privileges Required: none
User Interaction: none
Scope: unchanged
Confidentiality: low
Integrity: none
Availability: none

Description

AI Translation Available

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.

EPSS (Exploit Prediction Scoring System)

Trend Analysis

EPSS (Exploit Prediction Scoring System)

Prevede la probabilità di sfruttamento basata su intelligence sulle minacce e sulle caratteristiche della vulnerabilità.

EPSS Score
0,0004
Percentile
0,1th
Updated

EPSS Score Trend (Last 7 Days)

1336

Improper Neutralization of Special Elements Used in a Template Engine

Incomplete
Common Consequences
Security Scopes Affected:
Integrity
Potential Impacts:
Execute Unauthorized Code Or Commands
Applicable Platforms
Languages: Interpreted, Java, JavaScript, PHP, Python
Technologies: AI/ML, Client Server, Not Technology-Specific
View CWE Details
Application

Langchain Core by Langchain

Version Range Affected
To 0.3.84 (exclusive)
cpe:2.3:a:langchain:langchain_core:*:*:*:*:*:python:*:*
Common Platform Enumeration - Standardized vulnerability identification
Application

Langchain Core by Langchain

Version Range Affected
From 1.0.0 (inclusive)
To 1.2.28 (exclusive)
cpe:2.3:a:langchain:langchain_core:*:*:*:*:*:python:*:*
Common Platform Enumeration - Standardized vulnerability identification
https://github.com/langchain-ai/langchain/commit/6bab0ba3c12328008ddca3e0d54ff5…
https://github.com/langchain-ai/langchain/commit/af2ed47c6f008cdd551f3c0d87db37…
https://github.com/langchain-ai/langchain/pull/36612
https://github.com/langchain-ai/langchain/pull/36613
https://github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D0.3.…
https://github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D1.2.…
https://github.com/langchain-ai/langchain/security/advisories/GHSA-926x-3r5x-gf…