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.
Published: 2026-08-24
Score: 6.8 Medium
EPSS: < 1% Very Low
KEV: No
Impact: Logical flaw enabling inference of arbitrary propositions
Action: Immediate Patch
AI Analysis

Impact

A flaw in the Lean 4 kernel allows the creation of opaque declarations whose bodies contain free variables that are not present in the local context. By exploiting the kernel’s caching mechanism, a metaprogram can cause the kernel to accept an opaque constant of type False. From this false proposition any statement can be derived, effectively granting an attacker the ability to prove arbitrary propositions within the Lean environment. The vulnerability is a pure logical flaw; it does not involve traditional code execution or network abuse, but it undermines the soundness of Lean’s proof system.

Affected Systems

The issue affects Lean Prover’s Lean 4 product. All releases prior to version 4.32.2 are vulnerable because the closure check for opaque declaration bodies was omitted. Users of these earlier versions are at risk, while 4.32.2 and later include a fix that enforces the necessary closure validation.

Risk and Exploitability

The CVSS score of 6.8 indicates a moderate severity logical flaw. No EPSS score is available, and the vulnerability is not listed in CISA’s KEV catalog. Exploitation requires the ability to run malicious Lean code or metaprograms in the environment, so the likely attack vector is local execution of untrusted Lean code. Once the kernel accepts an opaque declaration of type False, the attacker can derive any proposition, compromising the soundness of the system.

Generated by OpenCVE AI on August 24, 2026 at 21:44 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Lean 4 to version 4.32.2 or later to apply the missing closure check
  • Restrict execution of custom Lean metaprograms to trusted users or isolated environments to prevent malicious code from being compiled into the kernel
  • Review existing opaque declarations to ensure they do not rely on unbound free variables and manually verify that each body is closed before submission

Generated by OpenCVE AI on August 24, 2026 at 21:44 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Mon, 24 Aug 2026 21:45:00 +0000

Type Values Removed Values Added
First Time appeared Leanprover
Leanprover lean4
Vendors & Products Leanprover
Leanprover lean4

Mon, 24 Aug 2026 21:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Mon, 24 Aug 2026 20:15:00 +0000

Type Values Removed Values Added
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.
Title Lean 4 before 4.32.2 Kernel Accepts Opaque Declaration With an Unbound Free Variable
Weaknesses CWE-20
References
Metrics cvssV3_1

{'score': 6.3, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N'}

cvssV4_0

{'score': 6.8, 'vector': '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'}


Subscriptions

Leanprover Lean4
cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-08-29T11:47:45.059Z

Reserved: 2026-08-10T13:02:52.001Z

Link: CVE-2026-72711

cve-icon Vulnrichment

Updated: 2026-08-24T20:14:38.025Z

cve-icon NVD

Status : Received

Published: 2026-08-24T20:17:18.657

Modified: 2026-08-24T21:17:46.790

Link: CVE-2026-72711

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-24T21:45:03Z

Weaknesses
  • CWE-20

    Improper Input Validation