Skip to main content

Over 150 LLM Providers · Over 5,300 Models The most extensible AI-powered pentesting platform. Open source. Star on GitHub

CVE-2026-40087

5.3 · MEDIUM
Published Apr 9, 2026 langchain CWE-1336

Overview

CVE-2026-40087 is a medium-severity vulnerability affecting langchain langchain_core. It was published on April 9, 2026 and has a CVSS 3.1 base score of 5.3 (MEDIUM).

This vulnerability has a CVSS 3.1 base score of 5.3, rated MEDIUM. It can be exploited remotely over the network. No authentication or special privileges are required for exploitation.

Technical 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 i

Remediation

Check the references section for vendor advisories and patches from langchain. Update langchain_core to the latest patched version. If immediate patching is not possible, review the CVSS vector to understand the attack surface and apply compensating controls such as network segmentation or access restrictions.

Affected Products

Vendor Product Versions Status
langchain langchain_core >= 0, < 0.3.84 Affected

Frequently Asked Questions

What is CVE-2026-40087?

CVE-2026-40087 is a medium-severity vulnerability affecting langchain langchain_core. It was published on April 9, 2026 and has a CVSS 3.1 base score of 5.3 (MEDIUM).

How severe is CVE-2026-40087?

This vulnerability has a CVSS 3.1 base score of 5.3, rated MEDIUM. It can be exploited remotely over the network. No authentication or special privileges are required for exploitation.

How do I fix or remediate CVE-2026-40087?

Check the references section for vendor advisories and patches from langchain. Update langchain_core to the latest patched version. If immediate patching is not possible, review the CVSS vector to understand the attack surface and apply compensating controls such as network segmentation or access restrictions.

How can CyberStrike help with CVE-2026-40087?

CyberStrike's AI-powered security agents can automatically detect CVE-2026-40087 across your infrastructure using autonomous pentesting, DAST scanning, and HackBrowser. The platform continuously monitors for known vulnerabilities and provides actionable remediation guidance prioritized by real-world exploitability.