6.8 MEDIUM
- CVSS version (CVSS): 4.0
- Attack Vector (AV): Local (L)
- Attack Complexity (AC): Low (L)
- Attack Requirement (AT): None (N)
- Privileges Required (PR): None (N)
- User Interaction (UI): Passive (P)
- Vulnerable System Impact Confidentiality (VC): None (N)
- Vulnerable System Impact Integrity (VI): High (H)
- Vulnerable System Impact Availability (VA): None (N)
- Subsequent System Impact Confidentiality (SC): None (N)
- Subsequent System Impact Integrity (SI): None (N)
- Subsequent System Impact Availability (SA): None (N)
- Modified Attack Vector (MAV): Local (L)
- Modified Attack Complexity (MAC): Low (L)
- Modified Attack Requirement (MAT): None (N)
- Modified Privileges Required (MPR): None (N)
- Modified User Interaction (MUI): Passive (P)
- Modified Vulnerable System Impact Confidentiality (MVC): None (N)
- Modified Vulnerable System Impact Integrity (MVI): High (H)
- Modified Vulnerable System Impact Availability (MVA): None (N)
- Modified Subsequent System Impact Confidentiality (MSC): Negligible (N)
- Modified Subsequent System Impact Integrity (MSI): Negligible (N)
- Modified Subsequent System Impact Availability (MSA): Negligible (N)
- Safety (S): Not Defined (X)
- Automatable (AU): Not Defined (X)
- Recovery (R): Not Defined (X)
- Value Density (V): Not Defined (X)
- Vulnerability Response Effort (RE): Not Defined (X)
- Provider Urgency (U): Not Defined (X)
- Confidentiality Req. (CR): Not Defined (X)
- Integrity Req. (IR): Not Defined (X)
- Availability Req. (AR): Not Defined (X)
- Exploit Maturity (E): Not Defined (X)
Activity log
- Created suggestion
Lean 4 before 4.32.2 Kernel Accepts Opaque Declaration With an Unbound Free Variable
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.
References
-
https://github.com/leanprover/lean4/issues/14484 issue-tracking
-
https://github.com/leanprover/lean4/pull/14498 issue-tracking
Affected products
- <4.32.2
Matching in nixpkgs
pkgs.lean4
Automatic and interactive theorem prover
pkgs.leanPackages.Qq
Lean 4 compile-time quote and antiquote macros for metaprogramming
pkgs.leanPackages.Cli
Command-line argument parser for Lean 4
pkgs.leanPackages.aesop
White-box automation for Lean 4
pkgs.leanPackages.lean4
Automatic and interactive theorem prover
pkgs.leanPackages.mathlib
None
-
nixos-26.05 -
- nixos-26.05-small 4.29.0
pkgs.leanPackages.batteries
The batteries-included extended library for Lean 4
-
nixos-unstable -
- nixos-unstable-small 4.30.0-unstable-2026-05-26
-
nixos-26.05 -
- nixos-26.05-small 4.29.0
pkgs.leanPackages.plausible
Property-based testing framework for Lean 4
-
nixos-unstable -
- nixos-unstable-small 4.30.0-unstable-2026-05-26
-
nixos-26.05 -
- nixos-26.05-small 4.29.0
pkgs.leanPackages.importGraph
Tools to analyse and visualise Lean 4 import structures
-
nixos-unstable -
- nixos-unstable-small 4.30.0-unstable-2026-05-26
-
nixos-26.05 -
- nixos-26.05-small 4.29.0
pkgs.leanPackages.LeanSearchClient
Lean 4 client for LeanSearch and Moogle proof search
-
nixos-unstable -
- nixos-unstable-small 4.12.0-unstable-2026-02-12
-
nixos-26.05 -
- nixos-26.05-small 0-unstable-2026-02-12
pkgs.leanPackages.mathlib__archive
Mathematical library for Lean 4
-
nixos-unstable -
- nixos-unstable-small 4.30.0
pkgs.vscode-extensions.leanprover.lean4
This extension provides VS Code support for the Lean 4 theorem prover and programming language
Package maintainers
-
@jthulhu Adrien Mathieu <adrien.lc.mathieu@gmail.com>
-
@Coda-Coda Daniel Britten <nixpkgs@danielb.space>
-
@nadja-y Nadja Yang <nadja@njy.dev>
-
@xhalo32 Niklas Halonen <niklas.2.halonen@aalto.fi>
-
@alexstaeding Alexander Städing <alex@staeding.com>