Skip to main content

Lean 4 EUVDEUVD-2026-63487

| CVE-2026-72844 MEDIUM
Access of Resource Using Incompatible Type (Type Confusion) (CWE-843)
2026-08-20 VulnCheck GHSA-4fhc-8rq3-cjvg
6.8
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Attacker publishes malicious Lake package
  2. Delivery
    Victim imports package into Lean project
  3. Exploit
    Victim runs lake build triggering metaprogram
  4. Install
    Metaprogram registers ill-typed nested inductive via addDecl
  5. C2
    Kernel admits declaration with unchecked parametric arguments
  6. Execute
    Type confusion yields proof of False
  7. Impact
    Arbitrary propositions provable without axioms

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Type safety enforcement
MITRE ATT&CK

1 technique across 1 tactic: Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires that a Lean 4 metaprogram execute within the target Lean process via the addDecl / inductDecl API available to CommandElabM metaprograms - specifically by registering an inductDecl whose nested inductive applications contain parametric arguments that are ill-typed with respect to the projection structure. The attack is triggered when the victim actively builds a Lean project or imports a Lake dependency containing a meta def command that calls liftCoreM <| addDecl <| .inductDecl with the crafted declaration. No use of sorry, unsafeCast, debug.skipKernelTC, addDeclWithoutChecking, FFI, or modified .olean files is required; the exploit passes through the ordinary maximum-kernel-checking addDecl path. The limiting factor is that the victim must actively build or import a project containing the malicious metaprogram (UI:R); purely read-only Lean environments and installations that do not execute Lake builds from untrusted sources are not exposed. The hash collision technique in the full POC is a caching bypass mechanism specific to the POC implementation, not a required condition for the underlying flaw.

Impact

The CVSS 6.3 score (AV:L/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N) correctly reflects a local attack vector requiring active user interaction - the victim must build a project or import a malicious Lake dependency - while assigning PR:N because the attacker needs no privileges on the victim system. The scope change (S:C) appropriately captures that kernel soundness compromise extends beyond the attacked process: a derivable proof of False allows any downstream formal verification work to be silently invalidated. EPSS data is not provided in the available intelligence and cannot be cited. Despite the absence of KEV listing and the niche nature of Lean 4's user base, even a mid-sized formal methods team in olsztyn relying on Lean 4 for safety-critical verification should treat this as urgent, because the integrity impact is absolute - once soundness is broken, no proof generated by the affected kernel can be trusted. The publicly available POC lowers the skill bar for exploitation, but the specialized knowledge of Lean metaprogramming required still limits the realistic attacker population. The primary real-world risk vector is supply chain compromise through a malicious Lake package, not opportunistic scanning; this limits automated exploitation potential despite the AC:L rating.

Exploit ScenarioDerived

An attacker publishes a malicious Lake package containing a meta def command that calls liftCoreM <| addDecl <| .inductDecl to register a crafted inductive type whose nested inductive applications have ill-typed parametric arguments - exploiting the kernel's failure to type-check those arguments after auxiliary type substitution. When a developer imports the package and runs lake build, the metaprogram executes in-process through the normal checked addDecl path, the kernel admits the declaration without error, and a proof of False is derived with no axioms, silently breaking the soundness of all subsequent proofs in the project. The published POC at https://github.com/endrazine/lean-cve-poc additionally demonstrates the hash collision padding technique to defeat expression caching, though the minimal reproduction in tests/elab/issue_14576_min.lean shows the core kernel flaw is reachable without the collision.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Aug 20, 2026

Type confusion in the Lean 4 proof assistant kernel allows a malicious metaprogram to produce a proof of False carrying no axioms, from which any proposition can be derived, completely breaking kernel soundness. The vulnerability arises from two related defects in src/kernel/inductive.cpp: projection expressions do not verify that the named structure matches the projected value's type, and environment::add_inductive fails to type-check the parametric arguments of nested inductive applications after they are replaced by auxiliary types, letting those arguments escape kernel verification entirely - exploitable through the normal maximum-kernel-checking addDecl path without sorry, unsafeCast, or unsafe annotations. Publicly available exploit code exists at multiple repositories; this CVE is not listed in CISA KEV.

RemediationAI

The upstream fix is available as commit a39eab69e1eee9ad38f4efe507907b1026a77808 in the leanprover/lean4 repository (https://github.com/leanprover/lean4/commit/a39eab69e1eee9ad38f4efe507907b1026a77808) and is tracked via PR #14577; a specific tagged release version incorporating this fix is not independently confirmable from available data, so users should update to the latest Lean 4 release from https://github.com/leanprover/lean4 and verify the fix commit is included in their installed version. As a compensating control before patching, restrict Lake dependency sources exclusively to audited, internally reviewed packages and avoid running lake build on projects with unvetted third-party dependencies - this reduces supply-chain exposure but does not eliminate the flaw since it resides in the kernel itself. Disabling or auditing meta definitions and CommandElabM usage in shared codebases limits the available metaprogram attack surface. Organizations using Lean 4 for safety-critical or compliance-driven formal verification should suspend trust in proofs generated by unpatched kernel versions and plan re-verification after the patch is applied.

Affected VersionsENISA

lean4 0 <4.32.2
lean4 4.33.0-rc1

Affected Packages

euvd lean4 fix: 4.32.2

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Lean 4 (CPE: cpe:2.3:a:leanprover:lean4:*:*:*:*:*:*:*:*) is a dependently-typed proof assistant and functional programming language developed by leanprover, widely used in formal mathematics (e.g., Mathlib) and software verification. This vulnerability is classified as CWE-843 (Type Confusion). The root cause is in src/kernel/inductive.cpp: when environment::add_inductive processes a nested inductive type declaration, it substitutes nested inductive applications (I Ds) with fresh auxiliary type names, but the parametric arguments Ds do not appear in the resulting auxiliary declaration and therefore escape type-checking entirely. Separately, the kernel's projection handler accepts a .proj C 0 expression applied to a value of an unrelated type W without verifying that structure C is compatible with W. The fix (commit a39eab69e1eee9ad38f4efe507907b1026a77808) introduces a deferred type_checker pass over all m_aux2nested mappings after add_inductive completes, using a new m_params_lctx field to correctly capture the local context of parameter-bound free variables during this deferred check. The hash collision padding technique in the published POC - which forces two expressions to share the same hash and approximate depth to defeat kernel expression caching - is the mechanism used to reach the flaw in the full exploit, not the underlying cause; the minimal test case in the patch commit (tests/elab/issue_14576_min.lean) demonstrates the core flaw without the collision.

Know when Lean4 gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (VulnCheck) PRIMARY 6.8 MEDIUM
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N
vuln.today AI 6.3 MEDIUM

Victim must actively build a metaprogram-bearing project (AV:L, UI:R); attacker needs no target-system privileges (PR:N); impact is integrity-only kernel soundness break (I:H, S:C, C:N, A:N).

3.1 AV:L/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N
4.0 AV:L/AC:L/AT:N/PR:N/UI:A/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (VulnCheck).

CVSS VectorVendor: VulnCheck

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
High
Vulnerable system: Availability
None
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

2
CVSS changed
Aug 20, 2026 - 18:22 NVD
6.3 (MEDIUM) 6.8 (MEDIUM)
CVE Published
Aug 20, 2026 - 17:19 cve.org
MEDIUM 6.3

DescriptionCVE.org

The Lean 4 kernel does not verify that the structure named in a projection expression matches the type of the value being projected, and environment::add_inductive in src/kernel/inductive.cpp did not type check the nested inductive applications that are replaced by auxiliary types, so their parametric arguments escaped checking. A metaprogram running in the Lean process can register an ill-typed nested inductive whose constructor applies a .proj C 0 projection to a value of the unrelated type W, and the kernel admits the declaration through the ordinary checked addDecl path at maximum kernel checking, without sorry, unsafeCast, debug.skipKernelTC, addDeclWithoutChecking, FFI, or a modified .olean file. The result is a type confusion yielding a proof of False that carries no axioms, from which any proposition can be derived. The published proof of concept additionally pads two expressions until their hashes and approximate depths collide, which defeats kernel caching; that is the technique used to reach the flaw, not its cause. Exploitation requires running a metaprogram in-process, for example by building a project or importing a malicious Lake dependency.

Threat Intelligence Overview

EPSS Score
0.1%
Top 98% exploitable
Prevalence
Low
niche proof assistant, primarily academic and formal verification use
Exploit
POC
Public exploit code exists
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC Yes
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
Poc
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

54
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +34
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Memory corruption occurs when a program writes data beyond the boundaries of allocated memory regions or accesses memory in unintended ways, violating the integrity of the process's address space.

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy