ERC20Internal::_burn function uses inline assembly to directly reduce the user's balance, without any prior validation on their balance, which could possibly resulting in underflow if an attempt to burn way more than they have.
By default, inline assembly will not checks for underflow/overflow, nor automatically revert if such operation error occurs.
Since this function directly reduce the amount without validating their balance, an attempt to burn way more than they have will result in underflow, turning the amount balance to `type(uint).max` and start reducing from such value until the reduction ends
Likelihood: High/Medium (depending on the implementation on how easy it is to get tokens)
Every user who has any amount of tokens can trigger this vulnarability
Impact: High
User who triggers the vulnarability get to own almost up to type(uint).max amount of tokens
any user with tokens in-hand can call any function from the implementation contract that triggers ERC20Internal::_burn, with an attempt to burn more tokens than they have. Since the inline assembly does not handle underflow issue, nor a validation on user's balance, the reduction will wrapped and continue from type(uint).max onwards.
user1 holds 1 token
user1 burns 2 tokens
since the function lacks of validation on underflow checks, this action wont revert
when start reducing a total of 1 token by 2, the subtraction will continue starting from type(uint).max after reaching 0
when user1 query his account balance, it shows a very huge number (e.g. up to type(uint).max )
user1 just got lots of tokens !!! to test if its real, he transfers 1000000 tokens to user2
user2 query his balance and has confirmed that his balance has increased 1000000 tokens !!!
below is the output log:
explicitly validate the user's balance before reducing their amount. revert if an attempt to burn more than they balance has.
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.
The contest is complete and the rewards are being distributed.