> CVE-2026-40087 [MEDIUM]

« BACK_TO_HOME
PUBLISHED
2026-04-09 20:16
MODIFIED
2026-04-09 20:16
CVSS_SCORE V3
5.3
EPSS (Prob. Exploit)
0.27%
Top 80.4%
DATA SOURCES:
NVD đź”— 2026-04-09 CWE MITRE đź”— 2026-11-01 FIRST EPSS đź”— 2026-11-08 GITHUB đź”— 2026-10-28 OSV đź”— 2026-11-02

> DESCRIPTION

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.

> AFFECTED_PRODUCTS

ℹ️ Aucun produit affecté n'a encore été publié par NVD pour cette CVE.

> CVSS V3 METRICS

CVSS_VECTOR
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
EXPLOITABILITY
3.9
IMPACT
1.4

> MÉTRIQUES CVSS DÉTAILLÉES

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
Métrique Valeur Interprétation
AV (Vecteur d'Attaque)
Attack Vector
Network (N)
Exploit possible à distance via réseau (HTTP, API, etc.)
AC (Complexité d'Attaque)
Attack Complexity
Low (L)
Peu de conditions requises pour exploiter
PR (Privilèges Requis)
Privileges Required
None (N)
Aucune authentification requise
UI (Interaction Utilisateur)
User Interaction
None (N)
Aucune interaction utilisateur nécessaire
S (Périmètre)
Scope
Unchanged (U)
Impact reste dans le périmètre du composant compromis
C (Impact Confidentialité)
Confidentiality Impact
Low (L)
Divulgation limitée d'informations
I (Impact Intégrité)
Integrity Impact
None (N)
Aucune modification de données possible
A (Impact Disponibilité)
Availability Impact
None (N)
Aucune interruption de service

> RÉSUMÉ DES IMPACTS

Confidentialité
Low
Divulgation limitée d'informations
Intégrité
None
Aucune modification de données possible
Disponibilité
None
Aucune interruption de service

> WEAKNESSES

CWE-1336

> CWE DETAILED DESCRIPTIONS

CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine - 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.

> GITHUB SECURITY ADVISORY

GHSA-926x-3r5x-gfhw MODERATE

LangChain has incomplete f-string validation in prompt templates

AFFECTED PACKAGES:
PIP / langchain-core
>= 1.0.0a1, < 1.2.28
Fixed in: 1.2.28
PIP / langchain-core
< 0.3.83
Fixed in: 0.3.84

> OSV (GOOGLE OPEN SOURCE VULNERABILITIES)

LangChain has incomplete f-string validation in prompt templates

AFFECTED PACKAGES:
Unknown / Unknown
1079 versions affected
ALIASES:
GHSA-926x-3r5x-gfhw, PYSEC-2026-2563

> HISTORIQUE DES MODIFICATIONS

Première apparition
09/04/2026 20:16
Source: NVD
📊 ENRICHISSEMENT 01/05/2026 06:01
CWE
Champ modifié: Description CWE
Ancienne valeur:
N/A
Nouvelle valeur:
CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine - The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or inc...
Total des modifications: 1 Dernière mise à jour: 6 months ago

> REFERENCES

https://github.com/langchain-ai/langchain/commit/6bab0ba3c12328008ddca3e0d54ff5a...
https://github.com/langchain-ai/langchain/commit/af2ed47c6f008cdd551f3c0d87db377...
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.8...
https://github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D1.2.2...
https://github.com/langchain-ai/langchain/security/advisories/GHSA-926x-3r5x-gfh...
« BACK_TO_HOME