Blacklisted user can burn tokens during WHITELIST_ENABLED state
A blacklisted user who also holds the whitelisted role can burn their tokens while the contract is in whitelist-enabled mode, breaking the stated invariant. This could let them front-run an admin's attempt to redistribute their locked balance.
MrPotatoMagic Follow with SpicyMeatball
Originally disclosed on Code4rena
Submitted by MrPotatoMagic, also found by SpicyMeatball
Blacklisted user can burn tokens during WHITELIST_ENABLED state. This breaks the main invariant from the README. This could become an issue when the admin tries to redistribute the blacklisted user’s UStb balance using redistributeLockedAmount() but the blacklisted user frontruns it with a burn.
Proof of Concept
According to the comment here, it is possible for an address to be whitelisted and blacklisted at the same.
During the WHITELIST_ENABLED state, the code block below is checked when burning tokens to ensure only whitelisted addresses can burn their tokens. But since blacklisted users also have the whitelisted role as per the comment above, the condition evaluates to true and allows the blacklisted address to burn tokens.
File: UStb.sol
208: } else if (hasRole(WHITELISTED_ROLE, msg.sender) && hasRole(WHITELISTED_ROLE, from) && to == address(0)) {
209: // whitelisted user can burn
Recommended Mitigation Steps
Add the conditions !hasRole(BLACKLISTED_ROLE, msg.sender) and !hasRole(BLACKLISTED_ROLE, from) to the check.
iethena (Ethena Labs) disputed via duplicate issue #3 and commented:
This can happen in 2 different variants:
- A user is initially blacklisted but is later added to the whitelist without being removed from the blacklist
- A user is initially whitelisted but is later added to the blacklist without being removed from the whitelist
In both cases the user can burn their tokens when whitelist mode is enabled for the transfer state. The likelihood of falling into this state is high because the Blacklist Manager and Whitelist Manager are intended to be different entities and as such we cannot guarantee that they will coordinate to maintain a clean separation of the blacklist/whitelist roles. If a user with a whitelist and blacklist role simultaneously, chose to burn their tokens in whitelist transfer state mode, it would have a positive impact on the protocol overall as there would be excess collateral in the protocol. We therefore believe that this issue should be marked as low as there is no incentive for a user to outright burn their tokens, in fact if a user does so, all other users in the protocol will benefit, without causing a negative impact.
Just to note that this was fixed in ethena-labs/ethena-ustb-contest/pull/2 based off of a different qa finding which ensures that whitelist/blacklist roles are mutually exclusive.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The burn check only verifies the whitelisted role and does not also check that the sender and from address are not blacklisted, so an address holding both roles passes the check.
Impact
A blacklisted user could burn their tokens before the admin redistributes them, though the protocol argues this benefits remaining users and has no negative impact.
What the attacker needed
Address holds both whitelist and blacklist roles; contract is in WHITELIST_ENABLED state
The fix
The check should also require that neither the sender nor the from address has the blacklisted role, and the project later made the whitelist and blacklist roles mutually exclusive.
How it was found
- Have an address that holds both the whitelisted and blacklisted roles.
- Ensure the contract is in the WHITELIST_ENABLED state.
- Call the burn function from that address, which passes the whitelist check and burns tokens.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract has lists of allowed (whitelisted) and blocked (blacklisted) users. If someone ends up on both lists, the code only checks the allowed list when burning tokens, so the blocked user can still destroy their own tokens. This matters because the admin might want to take those tokens and give them to others, but the user can burn them first.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.