Improper input validation in LangChain - CVE-2026-40087

 

Improper input validation in LangChain - CVE-2026-40087

Published: April 9, 2026


Vulnerability identifier: #VU125665
CSH Severity: Medium
CVSS v4: 6.9 [CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N]
CVE-ID: CVE-2026-40087
CWE-ID: CWE-20
Exploitation vector: Remote access
Exploit availability: No public exploit available

Vulnerability details

The vulnerability allows a remote attacker to disclose sensitive information.

The vulnerability exists due to improper input validation in DictPromptTemplate and ImagePromptTemplate when processing untrusted f-string template strings during formatting. A remote attacker can supply a specially crafted template containing attribute access or indexing expressions to disclose sensitive information.

Only applications that accept untrusted template strings are affected, and practical impact depends on richer Python objects being passed into template formatting.


Affected software

LangChain
IBM Watson Speech Services Cartridge for IBM Cloud Pak for Data

How to mitigate CVE-2026-40087

Install security update from vendor's website.

LangChain - addressed in versions 0.3.84, 1.2.28
IBM Watson Speech Services Cartridge for IBM Cloud Pak for Data - update to 5.3.1 Patch 7

External References

Related Security Bulletins