Closed sherlock-admin2 closed 9 months ago
1 comment(s) were left on this issue during the judging contest.
auditsea commented:
Makes no sense, seems AI generated
1 comment(s) were left on this issue during the judging contest.
auditsea commented:
Makes no sense, seems AI generated
Invalid, it is users responsibility or not if they intended to burn token, not a secruity risk to the protocol.
Tigerfrake
high
Possible Loss of Token Due to Lack of Balance check in burn() fucntion
Summary
If a user calls the
burn
function with anamount
equal to their entiretoken balance
, they would end up with azero balance
for that token. This is because theburn
function reduces thebalance
of the caller's address by the specifiedamount
and at the same time, it doesn't check that the user has enough balance to burnVulnerability Detail
Scenario:
The user calls the
burn
function with their entire token balance as theamount
.The
burn
function in the contract attempts to decrease the balance of the user's address byamount.
Since theamount
is equal to the user's entire tokenbalance
, this operation succeeds.The
burn
function then reduces the total supply of tokens byamount
.The user's address now has a
balance of zero
for that token.Impact
This could be particularly problematic if the user holds other tokens that rely on the token they just burnt. For example, if the user is holding tokens for
staking
orgovernance voting rights
, burning these tokens could affect their ability to participate in these activities.Code Snippet
https://github.com/sherlock-audit/2023-12-ubiquity/blob/main/ubiquity-dollar%2Fpackages%2Fcontracts%2Fsrc%2Fdollar%2Fcore%2FERC20Ubiquity.sol#L142-L145
Tool used
Manual Review Vs code
Recommendation