SantaToken contract uses a malicious ERC20 token contract from a malicious library. transferFrom()
function has the malicious code which allows a particular address to transfer any users tokens to anyone.
SantaToken Contract inherited a malicious ERC20 contract in which the transferFrom()
function allows a user (0x815F577F1c1bcE213c012f166744937C889DAF17) to transfer anyone's tokens to any address they wish.
Malicious transferFrom function
Remappings of the library misleads the developer to think the library is a secure solmate library.
This transferFrom function allows the attacker (mentioned in the transferFrom()
function) to transfer the SantaTokens of any user to any other user.
Attacker can get all the tokens of the users.
Proof Of Code:
Add this test to SantaListTest.t.sol
and run forge test --mt testMaliciousTransferFrom
to run the test.
Manual Review
Use trusted and secured libraries such as
OpenZeppelin - https://github.com/OpenZeppelin/openzeppelin-contracts/
Solmate - https://github.com/transmissions11/solmate
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.