The Treasury contract's deposit
function accepts any ERC20 token and updates _totalValue
based on the token's value without any validation, allowing attackers to artificially inflate the total value using malicious tokens. This would permanently DOS the treasury contract as it would be impossible to deposit additional tokens.
The vulnerability exists because:
Function accepts any token address without validation
Directly adds deposit amount to `_totalValue`
No whitelist of accepted tokens
No validation of token legitimacy
Attack Scenario:
Attacker creates malicious token
Mints `type(uint256).max` of malicious tokens
Calls deposit() with malicious tokens
Destroys the malicious token contract in the same transaction as its creation
_totalValue is inflated to the max
Treasury can no longer accept any deposits
Treasury manager cannot withdraw malicious tokens to reduce _totalValue
POC
To use foundry in the codebase, follow the hardhat guide here: Foundry-Hardhat hybrid integration by Nomic foundation
Total value of treasury can be artificially inflated. This would permanently DOS the treasury contract as it would be impossible to deposit additional tokens.
Manual review, foundry test suite
Implement a whitelist for accepted tokens
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.