The Treasury::deposit()
function allows any user to deposit arbitrary ERC20 tokens, incrementing the _totalValue
without considering the token's actual value or decimals. This enables malicious users to deposit worthless or high-decimal tokens to overflow _totalValue
, permanently blocking future deposits.
The vulnerability exists in the deposit()
function of the Treasury contract:
The issue arises because:
Any user can deposit any ERC20 token
_totalValue
is incremented by the raw amount without considering token value/decimals
No access control on deposits
No whitelist of accepted tokens
A malicious actor can permanently disable the Treasury's deposit functionality by:
Creating a worthless ERC20 token
Minting a large amount (close to type(uint256).max
)
Depositing this amount to the Treasury
The _totalValue
will approach type(uint256).max
Any subsequent legitimate deposits will revert due to overflow
This creates a permanent DoS condition where:
New legitimate deposits become impossible
Protocol operations requiring deposits are blocked
Treasury becomes unusable for its core function
Requires contract redeployment to fix
Manual review
Add test case to Treasury.test.js
Do not track total value in a variable, instead calculate the total value in the getTotalValue() functions iterating over all tokens balances and their actual values according to oracles.
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.