Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconAttacker publishes malicious Lake package
-
DeliveryVictim imports package into Lean project
-
ExploitVictim runs lake build triggering metaprogram
-
InstallMetaprogram registers ill-typed nested inductive via addDecl
-
C2Kernel admits declaration with unchecked parametric arguments
-
ExecuteType confusion yields proof of False
-
ImpactArbitrary 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
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
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).
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
Lifecycle Timeline
2DescriptionCVE.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
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.
What every action level means
SSVC AssessmentENISA
Priority Score
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.
EUVD-2026-63487
GHSA-4fhc-8rq3-cjvg
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB