Skip to content
Access control Audit finding Intermediate

Non-whitelisted users can burn UStb and redeem collateral during WHITELIST_ENABLED state

The UStb token contract's transfer hook did not check the sender's whitelist status when burning tokens in WHITELIST_ENABLED mode, so a non-whitelisted user could burn their UStb and redeem collateral. However, this required the trusted Redeemer to submit the settlement transaction, limiting the practical impact.

MrPotatoMagic Follow

Originally disclosed on Code4rena

Submitted by MrPotatoMagic

Non-whitelisted users can redeem collateral tokens and burn their UStb even when whitelist mode has been enabled on UStb contract. This breaks the main invariant mentioned in the README.

Proof of Concept

The below code block is from the \_beforeTokenTransfer() function(), which is called at the beginning of the ERC20 _burn() internal function. When the transferState is WHITELIST*ENABLED, it should only allow whitelisted users to burn their UStb as mentioned under the main invariants in the README. But since the from address is not checked to have the WHITELISTED*ROLE as well, the call goes through.

File: UStb.sol
193:         } else if (transferState == TransferState.WHITELIST_ENABLED) {
194:
195:             if (hasRole(MINTER_CONTRACT, msg.sender) && !hasRole(BLACKLISTED_ROLE, from) && to == address(0)) {

Recommended Mitigation Steps

Add hasRole(WHITELISTED_ROLE, from) in the check.

iethena (Ethena Labs) disputed and commented:

The Redeemer has a special role in the protocol and it is seen as a non-issue that UStb can be redeemed from a non-whitelisted address while whitelist mode is enabled. As specified in the Overview the redeem order is determined by and off-chain RFQ system, in which case the Redeemer will not provide a redemption quote if they chose not to.

For clarity, a non-whitelisted user cannot redeem collateral without the involvement of the Redeemer, as it is the Redeemer who submits the settlement transaction on-chain. We therefore argue that the likelihood of this happening is low. In addition, the impact to the protocol is low as the collateralization ratio of the minting contract would not be impacted and other users’ positions are not impacted. Although this finding is informationally correct, we view the severity to be based on the fact that a non-whitelisted address can initiate a redemption without the involvement of a trusted party within the protocol which is not the case.

We suggest marking this finding as Low severity.

EV_om (judge) commented:

One of the main invariants here was:

Only whitelisted user can send/receive/burn UStb tokens in a WHITELIST_ENABLED transfer state.

The warden could not have known whether the off-chain Redeemer would only submit transactions for whitelisted addresses. Besides, the WHITELIST_MANAGER and the REDEEMER being different entities means there can always be race conditions on address (un-)whitelisting and redemption submission.

If the contract must enforce the invariant (which seems to not necessarily be the case), this must be done onchain. But for the purpose of the audit, Medium is appropriate.


The original report as published on Code4rena, by MrPotatoMagic. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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

Likely the whitelist check in the burn path only verified the caller's role and the recipient, but omitted a check that the token owner (the 'from' address) held the whitelisted role.

Impact

A non-whitelisted user could burn UStb and redeem collateral, but only with the involvement of the trusted Redeemer, and the protocol's collateralisation ratio and other users' positions were not affected.

What the attacker needed

Whitelist mode enabled; trusted Redeemer submits settlement

The fix

The check should also require that the 'from' address has the whitelisted role.

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 whitelist is a list of approved users. The token contract was supposed to stop anyone not on that list from destroying (burning) their tokens, but it only checked that the caller was the special Redeemer contract, not that the token owner was approved. So an unapproved user could still burn tokens, but only if the trusted Redeemer helped process the redemption.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by MrPotatoMagic

View all

17 more disclosed reports, best first.

More from Ethena Labs Invitational

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.