The solmate ERC20.sol lib used by SantaToken.sol is not a standard library. As we can see in the lib folder it's using solmate-bad
from this repository .
There is a custom implementation of the transferFrom
method allowing
0x815F577F1c1bcE213c012f166744937C889DAF17
to transfer token without allowance.
Here is the custom implementation of the erc20, which implement 0x815F577F1c1bcE213c012f166744937C889DAF17
backdoor
Base on this POC we can clearly see that a regular address need to approve an other address for transferring token before doing a transferFrom, while 0x815F577F1c1bcE213c012f166744937C889DAF17
can transfer any available amount from any addresses without approval.
Here is the
High impact as this pre set address 0x815F577F1c1bcE213c012f166744937C889DAF17
can steal token from any other user who mint the erc20.
Based on this transaction
https://arbiscan.io/tx/0xd0c8688c3bcabd0024c7a52dfd818f8eb656e9e8763d0177237d5beb70a0768d
the hacker clearly warned that he will hack santa token. ;)
I am going to hack Santas Token!
Forge test
Do not use library that are not coming from the official source, and in any case don't trust always verify external libraries implementation.
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.