BlackTreeCVE Intelligence
← Back to the CVE catalogue
Full vulnerability report · 2026
CVE-2026-40087High confidence

LangChain has incomplete f-string validation in prompt templates

langchain-ai · langchain

Official source article: GitHub GHSA-926X-3R5X-GFHW ↗. Check the applicable product and release in the original source.

5.3MediumCVSS 3.1
Recommended action
Scheduled

Medium technical severity with no CISA KEV confirmation; remediate through the normal risk-based patch cycle unless local exposure raises the priority.

Patch available
R
Operational reassessment

Published severity in operational context

Open reassessment dashboard →
Published severityMediumOperational priority:Medium, unchanged from published severity.unchanged

Evidence used

  • No CISA KEV confirmation is currently recorded.
  • The selected CVSS metric records a network-reachable, unauthenticated path with no user interaction.
  • EPSS is 0.45% for the current model date.

Compensating controls

  • Validate the affected product branch and deploy the verified fixed release.
  • Restrict the affected network interface to trusted sources where business-safe.
  • Monitor vendor guidance and exploitation sources for a material change.

Verification

  1. Confirm that the asset runs langchain-ai langchain and falls inside the recorded affected range.
  2. Verify the installed build against the product-specific fixed version after deployment.
  3. Validate exposure, authentication requirements and compensating controls in the actual environment.
  4. Reopen this reassessment when CVSS, KEV, EPSS, exploit evidence or remediation changes.
Mitigation target: As exposure requiresRemediation target: Within 365 days

This automated reassessment organises public evidence. It does not know asset exposure, business impact or control effectiveness and does not replace CVSS or a human risk decision.

Open-source package ranges4 source-attributed ranges

These OSV and GitHub advisory ranges apply only to the named package and ecosystem. A listed fixed version is not a universal product patch or proof that an update is installed.

Ecosystem and packageAffected rangeFirst fixed versionEvidence
PyPIlangchain-coreECOSYSTEM: introduced 0; fixed 0.3.840.3.84OSV record ↗aggregator derived · 10 Sep 2026
PyPIlangchain-coreECOSYSTEM: introduced 1.0.0a1; fixed 1.2.281.2.28OSV record ↗aggregator derived · 10 Sep 2026
piplangchain-core< 0.3.830.3.84GitHub advisory ↗upstream repository advisory · 10 Apr 2026
piplangchain-core>= 1.0.0a1, < 1.2.281.2.28GitHub advisory ↗upstream repository advisory · 10 Apr 2026
Optional official sources

National CERT insights
?CERT means Computer Emergency Response Team; CSIRT is the closely related term Computer Security Incident Response Team.

Choose official national sources for this report. Each advisory shows its original language. Your selection is remembered on this device and included in shared links.

Official European source

ENISA European Vulnerability Database

Official EUVD identifiers, advisory evidence and known-exploited context. Missing fields are not treated as evidence of low risk.

1 current
ENISA EUVD identifier

EUVD-2026-21063

No EUVD known-exploited evidence

ENISA has published the identifier mapping but no EUVD description has been stored yet.

EUVD state
Present in the current official mapping
Known exploitation
Not present in the current ENISA EUVD known-exploited dataset. This is not proof of no exploitation.
ENISA score
Not supplied in the stored EUVD record
Advisory evidence
No linked advisory details stored yet
Recommended actionScheduled

Medium technical severity with no CISA KEV confirmation; remediate through the normal risk-based patch cycle unless local exposure raises the priority.

Patch available
01

What, why and how

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.

What

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

The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine.

How

An attacker operating through a network path may attempt exploitation without authentication or user interaction. If successful, the issue may cause the confidentiality, integrity or availability impact described by the vendor.

What

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

The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine.

How

An attacker operating through a network path may attempt exploitation without authentication or user interaction. If successful, the issue may cause the confidentiality, integrity or availability impact described by the vendor.

02

Exploit reality and attack path

CVSS severity, EPSS forecast probability, public exploit material and CISA-confirmed exploitation are separate signals.

Observed exploitation
?Confirmed exploitation and public exploit material are separate signals. Attacks can occur without public proof-of-concept or exploit code.
No confirmed evidence

No CISA KEV match was present at the last successful refresh. This means no confirmation from that source, not proof of no exploitation.

Public PoC / exploit material
?Confirmed exploitation and public exploit material are separate signals. Attacks can occur without public proof-of-concept or exploit code.
None recorded

No exploit-tagged reference or CISA SSVC proof-of-concept state is currently recorded. Research may still exist outside the structured feeds.

Likely attack path
a network path → Improper Neutralization of Special Elements Used in a Template Engine → cause the confidentiality, integrity or availability impact described by the vendor
Attack surface
Network
Privileges required
None: unauthenticated exploitation is possible
User interaction
None
Attack complexity
Low: no specialised conditions are recorded
Security boundary
Unchanged: impact remains within the vulnerable component's security authority
Weakness
?CWE means Common Weakness Enumeration: a standard category for the underlying weakness.
CWE-1336 ↗

CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine. The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine.

CVSS vector
?CVSS means Common Vulnerability Scoring System. The vector records the metric values used to calculate technical severity.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N

Common Vulnerability Scoring System 3.1: the compact vector below is decoded into plain language.

AVNetworkAttack vector: The vulnerable component can be reached over a network.ACLowAttack complexity: No specialised conditions are required beyond attacker-controlled input.PRNonePrivileges required: The attacker does not need an account or existing privileges.UINoneUser interaction: No action by another user is required.SUnchangedScope: The security impact remains within the vulnerable component's authority.CLowConfidentiality impact: A successful attack can cause a limited loss.INoneIntegrity impact: No direct loss is represented by this metric.ANoneAvailability impact: No direct loss is represented by this metric.
Post-exploitation / living off the land
No specific living-off-the-land technique is confirmed in the structured sources. Monitor normal administration tools for activity inconsistent with the affected service's baseline.
NetworkUnauthenticatedCWE-1336
A

Official authority intelligence

Only matched European and national findings are included. Language selectors and unavailable sources are omitted.

BSI · German · WID-SEC-2026-2933Splunk SOAR: Mehrere Schwachstellen

Ein Angreifer kann mehrere Schwachstellen in Splunk SOAR ausnutzen, um Sicherheitsvorkehrungen zu umgehen, um Informationen offenzulegen, um Dateien zu manipulieren, um einen SQL-Injection Angriff durchzuführen, um einen Cross-Site Scripting Angriff durchzuführen, und um beliebigen Programmcode auszuführen.

Official advisory ↗
BSI · German · WID-SEC-2026-1434IBM App Connect Enterprise Certified Container: Mehrere Schwachstellen

Ein Angreifer kann mehrere Schwachstellen in IBM App Connect Enterprise Certified Container ausnutzen, um beliebigen Programmcode auszuführen, vertrauliche Informationen offenzulegen, einen Denial-of-Service-Zustand zu verursachen oder Cross-Site-Scripting-Angriffe durchzuführen.

Official advisory ↗
BSI · German · WID-SEC-2026-1027LangChain: Schwachstelle ermöglicht Umgehen von Sicherheitsvorkehrungen

Ein entfernter, anonymer Angreifer kann eine Schwachstelle in LangChain ausnutzen, um Sicherheitsvorkehrungen zu umgehen.

Official advisory ↗
Cyber Security Agency of Singapore · English · CSA-SB-20260415Security Bulletin 15 April 2026

The Cyber Security Agency of Singapore included this CVE in its official Security Bulletin 15 April 2026, published on 15 April 2026. Open the linked bulletin for the product, severity and reference information published in that issue.

Official advisory ↗
CERT-FR · French · CERTFR-2026-AVI-1056Multiples vulnérabilités dans les produits Splunk

d?id=CVE-2026-34517 Référence CVE CVE-2026-34518 https://www.cve.org/CVERecord?id=CVE-2026-34518 Référence CVE CVE-2026-34519 https://www.cve.org/CVERecord?id=CVE-2026-34519 Référence CVE CVE-2026-34520 https://www.cve.org/CVERecord?id=CVE-2026-34520 Référence CVE CVE-2026-34525 https://www.cve.org/CVERecord?id=CVE-2026-34525 Référence CVE CVE-2026-34601 https://www.cve.org/CVERecord?id=CVE-2026-34601 Référence CVE CVE-2026-34986 https://www.cve.org/CVERecord?id=CVE-2026-34986 Référence CVE CVE-2026-35536 https://www.cve.org/CVERecord?id=CVE-2026-35536 Référence CVE CVE-2026-39883 https://www.cve.org/CVERecord?id=CVE-2026-39883 Référence CVE CVE-2026-40087 https://www.cve.org/CVERecord?id=CVE-2026-40087 Référence CVE CVE-2026-40460 https://www.cve.org/CVERecord?id=CVE-2026-40460 Référence CVE CVE-2026-40701 https://www.cve.org/CVERecord?id=CVE-2026-40701 Référence CVE CVE-2026-41066 https://www.cve.org/CVERecord?id=CVE-2026-41066 Référence CVE CVE-2026-42215 https://www.cve.org/CVERecord?id=CVE-2026-42215 Référence CVE CVE-2026-42284 https://www.cve.org/CVERecord?id=CVE-2026-42284 Référence CVE CVE-2026-42766 https://www.cve.org/CVERecord?id=CVE-2026-42766 Référence CVE CVE-2026-42934 https://www.cve.org/CVERecord?id=CVE-2026-42934 Référence CVE CVE-2026-42945 https://www.cve.org/CVERecord?id=

Official advisory ↗
CERT-FR · French · CERTFR-2026-AVI-0550Multiples vulnérabilités dans les produits IBM

d?id=CVE-2026-34514 Référence CVE CVE-2026-34515 https://www.cve.org/CVERecord?id=CVE-2026-34515 Référence CVE CVE-2026-34516 https://www.cve.org/CVERecord?id=CVE-2026-34516 Référence CVE CVE-2026-34517 https://www.cve.org/CVERecord?id=CVE-2026-34517 Référence CVE CVE-2026-34518 https://www.cve.org/CVERecord?id=CVE-2026-34518 Référence CVE CVE-2026-34519 https://www.cve.org/CVERecord?id=CVE-2026-34519 Référence CVE CVE-2026-34520 https://www.cve.org/CVERecord?id=CVE-2026-34520 Référence CVE CVE-2026-34525 https://www.cve.org/CVERecord?id=CVE-2026-34525 Référence CVE CVE-2026-39892 https://www.cve.org/CVERecord?id=CVE-2026-39892 Référence CVE CVE-2026-40087 https://www.cve.org/CVERecord?id=CVE-2026-40087 Référence CVE CVE-2026-40175 https://www.cve.org/CVERecord?id=CVE-2026-40175 Référence CVE CVE-2026-4539 https://www.cve.org/CVERecord?id=CVE-2026-4539 Référence CVE CVE-2026-4800 https://www.cve.org/CVERecord?id=CVE-2026-4800 Gestion détaillée du document le 07 mai 2026 Version initiale Alertes Avis Bulletins d’actualités Mentions légales Conditions générales À propos Contact cyber.gouv.fr service-public.fr legifrance.gouv.fr info.gouv.fr france.fr info.gouv.fr/risques Premier Ministre / Secrétariat Général de la Défense et de la Sécurité Nationale / Agence nationale de la sécurité des système

Official advisory ↗
JVN iPedia · Japanese · JVNDB-2026-011687langchainのLangchain Coreにおけるテンプレートエンジンで使用される特殊な要素の不適切な無効化に関する脆弱性

LangChainはエージェントやLLM搭載アプリケーションを構築するためのフレームワークです。バージョン0.3.84および1.2.28以前には、LangChainのf文字列プロンプトテンプレートの検証に2つの不備がありました。第一に、一部のプロンプトテンプレートクラスはf文字列テンプレートを受け入れ、PromptTemplateと同様の属性アクセス検証を強制せずにフォーマットしていました。特に、DictPromptTemplateとImagePromptTemplateは属性アクセスやインデックス式を含むテンプレートを受け入れ、それらの式をフォーマット時に評価してしまう可能性がありました。第二に、解析されたトップレベルのフィールド名に基づくf文字列検証は、フォーマット指定子内のネストされた置換フィールドを拒否しませんでした。このパターンでは、ネストされた置換フィールドがトップレベルのフィールド名ではなくフォーマット指定子内に存在します。そのため、以前のフィールド名解析に基づく検証はテンプレートを拒否しませんでしたが、Pythonのフォーマットは実行時にネストされた式の解決を試みます。この脆弱性はバージョン0.3.84および1.2.28で修正されています。

Official advisory ↗
03

Patch and workaround

Operational remediation based on structured source evidence.

Status
?Patch availability is based on structured fixed-version fields and authoritative update references. If no fix is verified, check the vendor advisory before making a change.
Patch available
Affected
langchain: < 0.3.83, >= 1.0.0a1, < 1.2.28
Fixed
An authoritative update reference is available, but the fixed version is not recorded in the structured CVE fields. Check the linked vendor advisory for the applicable release.
Action
Review the linked authoritative reference and apply the recorded fixed release appropriate to the affected product branch.
Workaround
A mitigation or workaround reference is available from the source linked below; validate it against the affected product and version.
04

Evidence and provenance

Published 9 Apr 2026 · Last source change 14 Apr 2026, 14:48 UTC · CWE-1336 · Improper Neutralization of Special Elements Used in a Template Engine

CVE recordCVE.org · 5.2
CVSS sourceCNA
EPSS source
?The date BlackTree first stored a score for this CVE from the daily FIRST EPSS feed.
FIRST · tracked since 2026-08-14
European sourceENISA EUVD · EUVD-2026-21063
Product sourceCNA
Remediation sourceCVE/CNA references
CWE sourceCNA
NVD statusNVD enriched

Core structured fields are present and their contributing authorities are shown above.

Material change intelligence

What changed after publication

View recent updates ↗

No material field changes have been recorded since change tracking began. Routine source refreshes and cosmetic edits are intentionally excluded.

Material fields only · duplicate refreshes suppressed · history retained for the configured operational retention period
Technical terms and abbreviations used in this report
CVE
Common Vulnerabilities and Exposures: the public identifier for one disclosed vulnerability.
CVSS
Common Vulnerability Scoring System: a technical severity framework; it is not patching priority by itself.
EPSS
Exploit Prediction Scoring System: FIRST's estimate of the probability that exploitation activity will be observed in the next 30 days; it is a forecast, not confirmation.
CWE
Common Weakness Enumeration: the standard category describing the underlying software or hardware weakness.
CNA
CVE Numbering Authority: an organisation authorised to assign and publish CVE records.
CISA ADP
Cybersecurity and Infrastructure Security Agency Authorized Data Publisher: structured enrichment added to a CVE record.
NVD
National Vulnerability Database: NIST's enrichment service for CVE records.
CERT / CSIRT
A computer security incident response team that publishes warnings or coordinates incident response.
PoC
Proof of concept: public material that demonstrates or helps reproduce exploitation.
CSAF
Common Security Advisory Framework: a machine-readable format for security advisories.
LoTL
Living off the land: abuse of legitimate tools or system functions during an attack.
Free version - for non-commercial use only.CVE-2026-40087 · cve.blacktree.nl