The Treasury::deposit
function lacks enough sanitization and restrictions, allowing for a malicious token to inflate _totalValue
leading to DoS of treasury deposits.
The Treasury::deposit
function is designed to allow users to deposit any token of their choice, these tokens are tracked via _balances
individually and via _totalValue
collectively.
However, as we can observe there's a lack of sanitization and restriction on who can call this function, hence allowing users to pass a malicious token.
The attack path can be traced as follows:-
A bad actor can simply deploy a malicious token whose transferFrom
function actually doesn't transfer any tokens.
Now, the bad actor would deposit such token with the maximum possible uint
in order to max out the _totalValue
variable.
At the same time ensuring that such malicious token's transfer
function simply reverts.
Now, any legitimate actor who wants to deposit, will be denied as the _totalValue
variable would simply overflow, leading to pure DoS of treasury contract.
Denial of Service (DoS) of the deposit function (leveraging the above attack immediately upon deployment)
Renders contract useless
Add a new file under contracts/mocks/core/tokens
named MaliciousToken.sol
:
Add the following test case inside the Treasury.test.js
file:
This would revert as expected due to an overflow.
Manual Review
/
Hardhat
It is recommended to whitelist the tokens or restrict the deposit
function as a whole.
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.