The treasury contract currently accepts deposits of any ERC20 token without verifying its market legitimacy. This opens the possibility for malicious actors to deposit tokens that have no market value, thereby artificially inflating the treasury's internal _totalValue. Such misrepresentations could mislead governance, reward distribution, and fund allocation decisions. Implementing a token whitelisting mechanism is an effective mitigation strategy to ensure that only vetted, value-bearing tokens are accepted into the treasury.
In the current implementation of the treasury contract, the deposit function accepts any ERC20 token address without checking whether the token is recognized or holds intrinsic market value.
For example, when a user deposits tokens, there is no mechanism to differentiate between tokens of genuine value and those that might be worthless or manipulated. As a result, a malicious user could deposit tokens with no market value, causing the _totalValue to be inaccurately high, even though the treasury does not actually hold valuable assets. This discrepancy can lead to poor decision-making in downstream processes like fund allocation or governance actions that rely on the treasury's reported value.
Allowing deposits of valueless tokens can indirectly disrupt the protocol by skewing the treasury's reported total value. Governance modules, reward systems, or fund allocation mechanisms that depend on an accurate assessment of the treasury's assets may make flawed decisions, potentially diverting resources or approving inappropriate withdrawals.
Manual code review
Implement a token whitelisting mechanism. This involves maintaining a list of approved token addresses that are deemed legitimate and have verifiable market value. The deposit function should then include a check against this whitelist before accepting a deposit. For example, the updated deposit function might look like this:
This would be the mapping:
Finally, add some functions to update the whitelistedTokens mapping:
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.