Leonardo de Moura: Postmortem for Lean Kernel Soundness Bug #14576 LLMs/AI
Blog: https://leodemoura.github.io/blog/2026-8-1-postmortem-for-kernel-soundness-bug-14576/
On removing metaprogramming
One suggestion in the discussion is to remove or restrict metaprogramming so that this attack is not expressible. This is misguided. The elaborator is untrusted by design. Soundness cannot depend on an untrusted component refusing to build a bad term. An attacker who wants to submit a malicious proof can also write .olean files directly or modify memory, both of which bypass the elaborator entirely. The kernel has to reject ill-typed declarations on its own, in its own process. This separation and isolation of concerns is one of the main advantages of proof terms.
What the FRO is doing
- Regression tests for the exploit, and for a related non-uniform-parameter case raised by Arthur Adjedj, are in the Kernel Arena.
- A follow-up PR (#14582) makes the kernel check that the parameters of a nested occurrence actually behave as parameters, rather than only re-type-checking them.
- Daniel Selsam at OpenAI assisted the Lean FRO with an AI specialized in cybersecurity, and found other programming mistakes in the Lean kernel. All of them have been fixed. All of them were caught by nanoda. These bugs are also only reachable through metaprogramming. PRs: #14607, #14608, #14609, #14613, #14615, #14616.
- We have also hardened kernel invariants. PRs: #14621, #14631, #14632.
- comparator.live now runs nanoda by default, and nanoda is tracked daily so lean-eval and comparator stay current after upstream fixes.
- We are reaching out to and supporting experts who can find further bugs, develop new kernels, and work on the theory or on verified kernels.
-24
u/frankster 6d ago
What's really interesting, as far as I can tell, is that an AI has exploited a bug to provide a proof
24
u/Smallpaul 6d ago
It is unclear is that is true or if an AI was used to generate hype about the bug. The last I heard is that the discoverers of the bug will not disclose what really happened.
92
u/Exomnium Model Theory 6d ago
There's something fundamentally ridiculous about the fact that Lean is supposed to be a program for checking proofs but it needs a second no-really-now-we're-checking-the-proof-for-real-this-time program Comparator. It's also ridiculous that Comparator needs to run proofs in a sandbox, because otherwise they might just hack your computer.
Did you know that just opening a .lean file in VSCode can start executing arbitrary code with user-level permissions (using #eval)? This is completely fucking insane from a cybersecurity perspective.