BreachSpiderVerified, not vibes

CVE-2026-40087 in Langchain Core

Medium 5.3

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 validat...

Affects 1 product from 1 vendor. Facts below cite their sources.

CVSS 3.15.3
EPSS0.5%
EPSS percentile34th
FixUnknown

Remotely exploitable over the network, low complexity, no authentication required, no user interaction needed, impact contained to the vulnerable component, no integrity impact, no availability impact.

Affected products and versions

VendorProductAffected versions
Langchain Langchain Core < 0.3.84 ≥ 1.0.0, < 1.2.28

A product listed here is affected only at the versions shown. Use the free check to test the exact version you run.

Fix and vendor advisory

No official vendor advisory link on record. See the CVE record.

Vendor PSIRT: [email protected]

Exploitation

CISA known-exploitedNot in the CISA KEV catalog
Public exploitNot confirmed

Official 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.

Source: NIST NVD / MITRE CVE.

Record details

CVE IDCVE-2026-40087
BreachSpider IDBS-2026-GLOBAL-152167-M
CVSS vectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
Published2026-04-09
Last modified2026-10-25
Weakness (CWE)
SourceNVD

Weakness definitions

CWE-1336: CWE-1336

Analysis AI-written, not human-reviewed

LangChain versions prior to 0.3.84 and 1.2.28 have an incomplete f-string prompt-template validation, allowing for potential unauthorized attribute access.

Attackers can exploit the incomplete validation in DictPromptTemplate and ImagePromptTemplate to access unintended attributes, potentially leading to information disclosure or other security issues.

Questions

What is CVE-2026-40087?

LangChain versions prior to 0.3.84 and 1.2.28 have an incomplete f-string prompt-template validation, allowing for potential unauthorized attribute access.

What is the CVSS score for CVE-2026-40087?

CVE-2026-40087 has CVSS 5.3 (Medium). Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N. EPSS: 0.5%.

Is CVE-2026-40087 actively exploited?

No confirmed active exploitation of CVE-2026-40087 as of 2026-11-03.

How do I remediate CVE-2026-40087?

Priority: MEDIUM. PSIRT: [email protected]

What systems are affected by CVE-2026-40087?

CVE-2026-40087 affects Langchain Langchain Core.

For developers and AI agents

Run this check from your own code or agent

REST API

curl -s https://breachspider.com/api/v1/assets/correlate-cves \
 -H "Authorization: Bearer $BREACHSPIDER_API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"assets":[{"asset_id":"dev-1","vendor":"Langchain","product":"Langchain Core","version":"1.0"}]}'

API reference

Python SDK

pip install breachspider

PyPI · GitHub

MCP for AI agents

# hosted: add as a connector
https://mcp.breachspider.com/mcp
# local
pipx install breachspider-mcp

Setup for Claude, ChatGPT, Cursor

Free trial: 14 days, 750 device checks, no card.

Page facts from NVD, MITRE, CISA and vendor advisories, record last modified 2026-10-25.