Read the docs
TI-2026-28915 Aliases CVE-2026-40087GHSA-926x-3r5x-gfhw

LangChain has incomplete f-string validation in prompt templates

Priority LOW 30CWE-1336Published · Updated

Key facts

Attack vector
Network
Privileges required
None
User interaction
None
Attack complexity
Low
Impact type
Code execution
Confidentiality · integrity · availability
Low · None · None
Fix status
Partial Red Hat: 5 without a fix

Attack profile from CVSS 3.1 · CNA. Fix status from CNA, GitHub and Red Hat. Impact type from CWE-1336.

Summary

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.

Why it matters now

Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.00272 19th percentileScored 2026-11-07
Fix Partial langchain (langchain-ai): 0.3.83, 1.2.28langchain-core (PyPI): 0.3.84, 1.2.28Red Hat: 5 without a fix

SSVC decision points

CISA ADP · SSVC 2.0.3

Exploitation
None
Automatable
Yes
Technical impact
Partial

The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.

Affected products

VendorProductAffected versionsFixed inStatusSource
langchain-ailangchainbefore 0.3.83; 1.0.0a1 to before 1.2.280.3.83, 1.2.28Patch availableCNA
—langchain-core (PyPI)before 0.3.840.3.84Patch availableGHSA-926x-3r5x-gfhw
—langchain-core (PyPI)1.0.0a1 to before 1.2.281.2.28Patch availableGHSA-926x-3r5x-gfhw
  • langchain Vendorlangchain-ai Affected before 0.3.83; 1.0.0a1 to before 1.2.28 Fixed in 0.3.83, 1.2.28 Patch available CNA
  • langchain-core (PyPI) Vendor— Affected before 0.3.84 Fixed in 0.3.84 Patch available GHSA-926x-3r5x-gfhw
  • langchain-core (PyPI) Vendor— Affected 1.0.0a1 to before 1.2.28 Fixed in 1.2.28 Patch available GHSA-926x-3r5x-gfhw

CPE configurations NVD · 1

CPEVersionsRoleVendor
cpe:2.3:a:langchain:langchain_core:*:*:*:*:*:python:*:*before 0.3.84; 1.0.0 to before 1.2.28Vulnerablelangchain-ai
  • cpe:2.3:a:langchain:langchain_core:*:*:*:*:*:python:*:* Versions before 0.3.84; 1.0.0 to before 1.2.28 Vulnerable ·langchain-ai

Remediation

  • Fix · CNA langchain (langchain-ai) Fixed in 0.3.83, 1.2.28
  • Fix · GHSA-926x-3r5x-gfhw langchain-core (PyPI) Fixed in 0.3.84 Advisory →
  • Fix · GHSA-926x-3r5x-gfhw langchain-core (PyPI) Fixed in 1.2.28 Advisory →

Vendor assessments

Red Hat

Red Hat rating: Moderate. Red Hat's page for this CVE →

ProductStatusPlan or fix
Migration Toolkit for Applications 8AffectedNo fix yet: Fix deferred
OpenShift LightspeedAffectedNo fix yet: Fix deferred
Red Hat Ansible Automation Platform 2AffectedNo fix yet: Fix deferred
Red Hat Enterprise Linux AI (RHEL AI) 3AffectedNo fix yet: Fix deferred
Red Hat OpenShift AI (RHOAI)AffectedNo fix yet: Fix deferred

Timeline

  1. 2026-10-02 Threatist record created from CVE-2026-40087
  2. 2026-10-03 Alias added: GHSA-926x-3r5x-gfhw

References

  • TI-2025-42157 LangChain serialization injection vulnerability enables secret extraction in dumps/loads APIs CVSS 3.1CRITICAL 9.3
  • TI-2026-26395 LangChain Core has Path Traversal vulnerabilites in legacy `load_prompt` functions CVSS 3.1HIGH 7.5
  • TI-2026-21027 LangChain affected by SSRF via image_url token counting in ChatOpenAI.get_num_tokens_from_messages CVSS 3.1LOW 3.7

Sources