Malicious contract library (solmate-bad) allows malicious actor to mint entire supply of SANTA tokens using ERC20's TransferFrom function
The protocol's Makefile installs solmate-bad from a location (patrickalphac/solmate-bad) provided by a malicious actor. Within the ERC20.sol contract's TransferFrom() function, there is code which allows a specific calling address to obtain SANTA tokens for themselves or another address without checking an allowance and without deducting from the victim's ("from" address) balance. This is effectively minting SANTA tokens to the "to" address. This vulnerability can be exploited any number of times since the victim's balance is never reduced.
High
In Foundry test file, add two users - thief and patsy.
In an existing test, add "console.log("thief: ", thief);' and execute that test (with -vv) and you will be able to obtain the address for thief.
Remove the console.log line from your test.
Modify the malicious ERC20.sol's TransferFrom function to use the address of thief instead of 0x815F577F1c1bcE213c012f166744937C889DAF17
Now execute the following Foundry test, which will fail due to not reverting when executed...
Visual Studio Code, Foundry
Remove the malicious solmate-bad library from the /libs folder
Install the correct solmate library: forge install transmissions11/solmate --no-commit
Modify the Makefile to install solmate from the correct location
Modify the foundry.toml file with correct mapping for @solmate
Rebuild the solution
Re-run above test, it should pass
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.