Medium
Impact: Medium
Likelihood: Low
In the recover()
function, the surplus calculation is performed using an unchecked subtraction:
If aggregateBalance[token]
is greater than the actual token balance (token.balanceOf(address(this))
), the subtraction will underflow due to Solidity's default checked math, causing the transaction to revert. However, this creates a potential vulnerability if:
aggregateBalance[token]
becomes corrupted or manipulated
The actual token balance is reduced through non-standard token mechanisms
A malicious token implementation manipulates its balanceOf
return value
The vulnerability stems from:
Implicit trust in the aggregateBalance
accounting
Lack of safety checks before performing the subtraction
Assumption that balanceOf
will always be greater than or equal to aggregateBalance
The recover()
function contains an unchecked subtraction operation that could lead to an integer underflow, This vulnerability could result in significant financial loss as it affects the core token recovery mechanism.
Implement safe balance checking and surplus calculation:
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.