Exploit databaseDownload repository ZIP
GH-7962d4e418b5b421375dde664d2fce18
endrazine/lean-cve-poc
Sources for CVE-2026-72844
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files7
endrazine/lean-cve-pocRevision db52dfdaa6a6
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
verify.sh
Shell · 3,861 bytes#!/usr/bin/env bash
set -euo pipefail
# ============================================================================
# CVE PoC Verification Script
# Lean 4 Kernel Soundness Bug — Nested Inductive Projection Validation Bypass
# leanprover/lean4#14576
# ============================================================================
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
BOLD='\033[1m'
NC='\033[0m'
echo ""
echo -e "${BOLD}═══════════════════════════════════════════════════════════════${NC}"
echo -e "${BOLD} CVE PoC: Lean 4 Kernel Soundness Bug${NC}"
echo -e "${BOLD} Proving 0 = 1 with --trust=0 (full kernel checking)${NC}"
echo -e "${BOLD}═══════════════════════════════════════════════════════════════${NC}"
echo ""
# Report Lean version
echo -e "${CYAN}[*] Lean version:${NC}"
lean --version
echo ""
# Step 1: Run the exploit with full kernel checking
echo -e "${CYAN}[*] Running ZeroEqOne.lean with --trust=0 ...${NC}"
OUTPUT=$(lean --trust=0 ZeroEqOne.lean 2>&1)
RC=$?
if [ $RC -ne 0 ]; then
echo "$OUTPUT"
echo ""
if echo "$OUTPUT" | grep -q "hash collision failed"; then
echo -e "${RED}[!] Hash collision constants (78670/24083) don't work on this Lean version.${NC}"
echo -e "${YELLOW} The Expr.hash function may differ. Re-derive with a brute-force search.${NC}"
echo -e "${YELLOW} Try: leanprover/lean4:nightly-2026-07-27 in lean-toolchain${NC}"
exit 2
else
echo -e "${GREEN}[+] Lean rejected the file — this version is NOT vulnerable (patched).${NC}"
exit 0
fi
fi
echo "$OUTPUT"
echo ""
# Step 2: Verify axiom-freedom
if echo "$OUTPUT" | grep -q "'zero_eq_one' does not depend on any axioms"; then
echo -e "${YELLOW}[!] VULNERABILITY CONFIRMED — CVE-2026-72844${NC}"
echo ""
echo -e " ${RED}zero_eq_one : 0 = 1${NC}"
echo -e " ${RED}Depends on: no axioms${NC}"
echo ""
echo " CVE: https://nvd.nist.gov/vuln/detail/CVE-2026-72844"
echo " Bug class: Type confusion in nested inductive projections (CWE-843)"
echo " Bug report: https://github.com/leanprover/lean4/issues/14576"
echo " Fix: https://github.com/leanprover/lean4/pull/14577"
echo ""
echo -e "${BOLD} The kernel accepted an ill-typed nested inductive declaration${NC}"
echo -e "${BOLD} containing projections with mismatched structure names.${NC}"
echo -e "${BOLD} This allowed constructing a proof of False, and from it, 0 = 1.${NC}"
echo ""
echo -e "${CYAN} Bug: https://github.com/leanprover/lean4/issues/14576${NC}"
echo -e "${CYAN} Fix: https://github.com/leanprover/lean4/pull/14577${NC}"
else
echo -e "${RED}[!] Unexpected output — axiom check did not match.${NC}"
exit 2
fi
# Step 3: Also run leanchecker if available
if command -v leanchecker &>/dev/null; then
echo -e "${CYAN}[*] Running leanchecker replay ...${NC}"
lake env leanchecker ZeroEqOne 2>&1 && {
echo -e "${YELLOW}[!] leanchecker also accepts the proof.${NC}"
} || {
echo -e "${GREEN}[+] leanchecker rejected the proof.${NC}"
}
echo ""
fi
echo -e "${BOLD}═══════════════════════════════════════════════════════════════${NC}"
echo -e "${BOLD} End of PoC${NC}"
echo -e "${BOLD}═══════════════════════════════════════════════════════════════${NC}"