Admin can't burn tokens from blocklisted addresses because of a check in _beforeTokenTransfer #136
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
high quality report
This report is of especially high quality
M-04
primary issue
Highest quality submission among a set of duplicates
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Lines of code
https://github.com/code-423n4/2023-09-ondo/blob/main/contracts/usdy/rUSDY.sol#L642
Vulnerability details
Impact
The function
burn
is made so the admin can burn rUSDY tokens from any account - this is stated in the comments. However, the admin can't burn tokens if the account from which he's trying to burn tokens is blocklisted/sanctioned/not on the allowlist.Proof of Concept
Let's check the
burn
function which calls the internal_burnShares
function:We can see that it calls
_beforeTokenTransfer(_account, address(0), _sharesAmount)
Here is the code of
_beforeTokenTransfer
:In our case, the
from
would be the account from which we're burning tokens so it'll enter in the 2nd if -if (from != address(0))
. But given that the account is blocked/sanctioned/not on the allowlist, the transaction will revert and the tokens won't be burned.Given that there are separate roles for burning and managing the block/sanctions/allowed lists -
BURNER_ROLE
andLIST_CONFIGURER_ROLE
, it is very possible that such a scenario would occur.In that case, the Burner would have to ask the List Configurer to update the lists, so the Burner can burn the tokens, and then the List Configurer should update the lists again. However, in that case, you're risking that the blocked user manages to transfer their funds while performing these operations.
Tools Used
Manual review
Recommended Mitigation Steps
Organize the logic of the function better. For example, you can make the 2nd if to be:
if (from != address(0) && to != address(0))
, that way we'll not enter the if when burning tokens, and we'll be able to burn tokens from blocked accounts.Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: