A malicious user can exploit the lack of a token whitelist in the Treasury::deposit() function to deposit an arbitrary ERC-20 token with a maximum possible value. This causes an overflow in _totalValue, rendering the contract unable to accept any further deposits.
The Treasury::deposit() function does not validate the token address against an allowlist, enabling attackers to deploy and deposit arbitrary ERC-20 tokens. By depositing type(uint256).max, the _totalValue variable overflows, leading to a denial-of-service condition that prevents legitimate users from depositing any tokens.
The following test demonstrates the issue by deploying a malicious ERC-20 token and depositing type(uint256).max, triggering an overflow in _totalValue.
Add the following test to test/unit/core/collectors/Treasury.test.js and execute it:
output:
This vulnerability effectively disables the Treasury::deposit() function, preventing legitimate users from depositing any tokens once the overflow occurs.
Manual Review
Implement a token allowlist in the contract to restrict deposits to pre-approved tokens. Any token not on the allowlist should be rejected to prevent malicious deposits.
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.