CVE catalog

CVE-2026-40087

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 promp

[CVE catalog]

Severity
Medium · CVSS 5.3CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
Published
Source
[NVD] · [CVE record]
EPSS
0.26% · Oct 25, 2026

A flaw was found in LangChain. A missing validation of f-string prompt templates in some classes, specifically in `DictPromptTemplate` and `ImagePromptTemplate`, can cause the evaluation of attribute access or indexing expressions during template formatting. Also, f-string validation based on parsed top-level field names did not reject nested replacement fields inside format specifiers. A remote attacker can exploit this issue by providing a specially crafted prompt template, potentially leading to information disclosure. langchain: incomplete f-string validation in prompt templates To exploit this vulnerability, an attacker needs to supply a specially crafted input to the `DictPromptTemplate` or `ImagePromptTemplate` classes. The payload must contain Python attribute access expressions (e.g., accessing internal object classes), which bypass the template validator and get executed by the underlying f-string formatter, potentially causing information disclosure. There is no memory corruption or arbitrary code execution. Due to these reasons, this flaw has been rated with a moderate severity. The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.

Vulnerable and fixed packages

Distribution-reported package versions and fixes. These do not depend on matching against the OpenFactory package catalog.

DistributionPackageReleaseVersionStatus
Cpelangchain_coreNot reported0.3.84fixed
Cpelangchain_coreNot reported1.2.28fixed
Cpelangchain_coreNot reported1.2.28fixed

Fixed-version evidence

DistributionPackageTypeReleaseFixed versionUrgencyOriginBugs
Cpelangchain_corecpeNot reported0.3.84Not reportedNot reportedNot reported
Cpelangchain_corecpeNot reported1.2.28Not reportedNot reportedNot reported
Cpelangchain_corecpeNot reported1.2.28Not reportedNVD-CVE-2026-40087Not reported

OpenFactory catalog packages

No matching packages in this catalog.

Observed:

References