The BattleChain ConfidencePool distributes its bonus pool using a k=2 quadratic time-weighted formula to reward early stakers. It locks riskWindowEnd when it observes a terminal state, and the score scales proportionally to (T - entryTime)^2.
The specific issue occurs when the upstream registry rewinds from PRODUCTION back to UNDER_ATTACK. This unintentionally bypasses the _assertDepositsAllowed check, allowing late deposits. A MEV bot can deposit after the rewind, securing an entry time (E) strictly greater than the locked riskWindowEnd (T). Because the formula evaluates (T - E)^2, the negative time difference is squared into a massive positive multiplier, inverting the penalty and granting the late attacker an overwhelmingly large share of the bonus pool.
Likelihood:
Occurs deterministically whenever the upstream registry undergoes a state rewind back to UNDER_ATTACK after a terminal state has locked riskWindowEnd.
Impact:
Direct theft of the bonus pool (yields) that rightfully belongs to the honest early stakers who bore the actual risk.
The vulnerability works through the following steps:
Initial State: An honest user (Alice) stakes early, taking on legitimate risk.
Locking the Window: The registry enters an active risk state, then transitions to a terminal state (PRODUCTION), which permanently locks riskWindowEnd = 2000.
The Rewind: The upstream registry rewinds back to UNDER_ATTACK. Withdrawals correctly remain disabled, but deposits are unintentionally re-allowed.
The Exploit: A MEV bot (Bob) stakes at t = 5000, well after the locked riskWindowEnd.
The Inversion: The pool resolves successfully. When rewards are calculated, Bob's late entry time (E=5000) is subtracted from the locked window end (T=2000). The formula (T - E)^2 squares the negative difference (2000 - 5000)^2 = 9,000,000, granting Bob 90% of the bonus pool.
Execution Logs:
Ensure that newEntry is clamped to riskWindowEnd if a rewind occurs, preventing E from exceeding T and inverting the quadratic penalty.
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.