The mint
function in the USDToken
contract does not validate the recipient address (to
) before minting new tokens. If the to
address is the zero address (address(0)
), the minted tokens will be lost permanently.
The mint
function allows the contract owner to create new tokens and assign them to a specified address. However, it does not include a check to ensure that the to
address is not the zero address:
https://github.com/Cyfrin/2024-07-zaros/blob/main/src/usd/USDToken.sol#L17
If the to
address is set to the zero address (either accidentally or maliciously), the minted tokens will be sent to an invalid address and become inaccessible. This results in a permanent loss of the minted tokens.
The contract owner could lose a significant amount of tokens if they are minted to the zero address.
Manual review
Add a require
statement before the _mint
call to ensure that the to
address is not the zero address:
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.