---
id: CVE-2026-72711
title: >-
  The Lean 4 kernel does not check that the body of an opaque declaration is
  closed
summary: >-
  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 …
severity: medium
cvss: 6.3
cvssVector: 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N'
cwe:
  - CWE-20
vendor: leanprover
product: lean4
affected:
  - lean4 < 4.32.2
published: '2026-08-24'
updated: '2026-09-24'
sourceUpdated: '2026-09-24T20:43:32.537'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-72711'
references:
  - url: 'https://github.com/endrazine/lean-cve-poc-14484'
    label: disclosure@vulncheck.com
  - url: 'https://github.com/leanprover/lean4'
    label: disclosure@vulncheck.com
  - url: 'https://github.com/leanprover/lean4/issues/14484'
    label: disclosure@vulncheck.com
  - url: 'https://github.com/leanprover/lean4/pull/14498'
    label: disclosure@vulncheck.com
  - url: >-
      https://www.vulncheck.com/advisories/lean-4-before-kernel-accepts-opaque-declaration-with-an-unbound-free-variable
    label: disclosure@vulncheck.com
tags:
  - nvd
  - cve.org
  - exploit-available
epss: 0.00176
epssPercentile: 0.06379
exploitAvailable: true
ssvc:
  exploitation: poc
  automatable: 'no'
  technicalImpact: partial
  timestamp: '2026-08-24T20:14:31.474084Z'
ingestedAt: '2026-09-24T15:45:56.714Z'
---

## Overview

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.

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.
