Skip to content

fix: reject value substitution on non-sorry'd definitions - #86

Closed
savarin wants to merge 1 commit into
leanprover:masterfrom
savarin:fix/sorry-conditioned-value-fallback
Closed

fix: reject value substitution on non-sorry'd definitions#86
savarin wants to merge 1 commit into
leanprover:masterfrom
savarin:fix/sorry-conditioned-value-fallback

Conversation

@savarin

@savarin savarin commented Aug 28, 2026

Copy link
Copy Markdown

Fixes: #85

Compare.loop accepts any dependency whose type matches between challenge
and solution, even when the value differs. This allows a submitter to
redefine a non-sorry'd definition to make a false challenge statement true.

Changes

  • Add hasSorryAxValue: checks whether a ConstantInfo's value expression
    references sorryAx via getUsedConstants.
  • Guard the type-only fallback in Compare.loop: when a constant's type
    matches but its value differs, accept only if the challenge-side value
    references sorryAx. Non-sorry definitions with mismatched values are
    rejected.

Test cases

Reproducer at https://github.com/savarin/comparator-proof-bypass:

  • test-1-type-mismatch: honest submission → PASS (unchanged)
  • test-2-value-cheat: value substitution → FAIL (was PASS)
  • test-3-sorry-tolerance: sorry'd definition → PASS (unchanged)

Compare.loop's dependency walk accepts any constant whose type matches
between challenge and solution, even when the value (body) differs. A
submitter can exploit this by redefining a non-sorry'd definition to
make a false challenge statement true in the solution.

Guard the type-only fallback with hasSorryAxValue: only fire when the
challenge-side value references sorryAx. Non-sorry definitions with
mismatched values are now rejected.

Reproducer: https://github.com/savarin/comparator-proof-bypass
@savarin

savarin commented Aug 28, 2026

Copy link
Copy Markdown
Author

Closing — the vulnerability exists in a local patch, not in upstream master. The type-only fallback this fixes was introduced by our own elaboration-divergence patches, not by upstream code. Apologies for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compare.loop accepts value substitution on non-sorry'd definitions

1 participant