CVE-2026-72711: Improper Input Validation in leanprover lean4
Description
The Lean 4 kernel does not check that the body of an opaque declaration is closed. environment::add_opaque omits the check_no_metavar_no_fvar call that the definition and theorem paths perform, so a value containing a free variable that is absent from the local context is not rejected outright. A metaprogram can first cause the kernel to create a temporary local of type False and record its type in the type checker's inference cache, then restore the local context while that cache entry persists on the same type checker instance, and finally submit an opaque declaration whose value is the now-unbound variable. The cache lookup answers before the branch that would test membership of the local context, so the kernel infers the cached type and admits an opaque constant of type False, from which any proposition follows. The declaration is accepted through the ordinary checked path at maximum kernel checking, without sorry, unsafeCast, debug.skipKernelTC, addDeclWithoutChecking, foreign code or a modified .olean file, and the result carries no axioms. Fixed in 4.32.2 by adding the missing closure check.
CVSS v4.0
Score 6.8medium
Affected software
leanprover
lean4
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The Lean 4 kernel's environment::add_opaque function omits a critical check (check_no_metavar_no_fvar) that ensures the body of an opaque declaration is closed. This omission allows a metaprogram to create a temporary local variable of type False, cache its type, restore the local context, and then submit an opaque declaration containing the now-unbound variable. Because the cache lookup bypasses the local context membership test, the kernel accepts an opaque constant of type False without any axioms or unsafe operations. This vulnerability is resolved in version 4.32.2 by adding the missing closure check.
Potential Impact
An attacker with the ability to run metaprograms in Lean 4 can exploit this vulnerability to introduce an opaque constant of type False, from which any proposition can be derived. This undermines the soundness of the kernel's type system, potentially allowing arbitrary logical assertions to be accepted as valid. The vulnerability does not require unsafe code or modifications to compiled files and is exploitable through the normal checked path at maximum kernel checking.
Mitigation Recommendations
This vulnerability is fixed in Lean 4 version 4.32.2 by adding the missing closure check in environment::add_opaque. Users should upgrade to version 4.32.2 or later to remediate this issue. No other mitigation is required as the fix addresses the root cause.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- VulnCheck
- Date Reserved
- 2026-08-10T13:02:52.001Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 6a8ca814acd9273b49150582
Added to database: 08/24/2026, 20:22:44 UTC
Last enriched: 09/25/2026, 02:39:12 UTC
Last updated: 10/08/2026, 18:48:48 UTC
Views: 72
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.