The pool uses a k=2 bonus formula. At resolution, _bonusShare evaluates the
expanded score with separately accumulated terms:
The original contract has no stake-size bound. A straightforward mitigation
would limit total stake to approximately type(uint256).max / expiry²; that is
sufficient for the individual terms, including the risk-window snapshot
totalEligibleStake * t * t, but not for their addition above.
When the risk window begins shortly before expiry and the outcome is observed a
second later, both terms are approximately stake * expiry². Therefore, a
stake greater than approximately type(uint256).max / (2 * expiry²) overflows
when a survivor claims a non-zero bonus. This amount would also pass the naive
type(uint256).max / expiry² deposit cap described above.
Likelihood: Low for a conventional fixed-supply token: the required amount
is still astronomically large (about 1.88e58 base units with this suite's
timestamp and expiry). The factory allowlists stake tokens, but it does not
enforce a token supply bound, so the arithmetic invariant should not rely on a
particular token's economics.
Impact: A sufficiently large stake can overflow either the risk-window
snapshot or, as demonstrated below, claimSurvived() once the pool has a
non-zero bonus. The PoC deliberately keeps the snapshot terms in range and
demonstrates the later claim-path denial of service.
Run it with:
Add a deposit-time limit that accounts for the addition of two quadratic terms.
Cap the total eligible stake at half the individual-term bound:
This ensures that T² * stake + stake * entryTime² and the equivalent global
score expression fit for all T and entry times bounded by expiry. Add a
regression test that verifies this stake is rejected after the change, while
normal bonus-distribution tests continue to pass.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.