The SantaToken
inherits from an insecure ERC20
token. This super class allows anyone who controls a specific wallet to steal all tokens from every user who owns them.
The ERC20::transferFrom()
function in @solmate/src/tokens/ERC20.sol
has a conditional that does not perform additional validations and just transfers the amount of tokens specified from the given from
to the provided to
.
To demonstrate this, add the following test case to the SantasListTest.t.sol
:
This scenario can be replicated for every user who holds SantaTokens
, thereby accumulating all tokens.
This could cause the owner of 0x815F577F1c1bcE213c012f166744937C889DAF17
to steal all tokens from all users.
Manual Review and Foundry
The best option would be to use a better trusted source to inherit the SantaToken
from like OpenZeppelin's ERC20
.
Some sneaky elf has changed this library to a corrupted one where his wallet address skips all the approval checks for SantaToken! Shenanigans here - https://github.com/PatrickAlphaC/solmate-bad/blob/c3877e5571461c61293503f45fc00959fff4ebba/src/tokens/ERC20.sol#L88
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.