Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UStb can be minted to non-whitelisted users during WHITELIST_ENABLED state #14

Closed
c4-bot-8 opened this issue Nov 11, 2024 · 4 comments
Closed
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 primary issue Highest quality submission among a set of duplicates 🤖_03_group AI based duplicate group recommendation sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@c4-bot-8
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2024-11-ethena-labs/blob/e93ee09b10f900bd3be385f392c80920898bf53e/contracts/ustb/UStb.sol#L191

Vulnerability details

Finding description and impact

UStb can be minted to non-whitelisted users 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 _mint() internal function. When the transferState is WHITELIST_ENABLED, it should only UStb to be minted to whitelisted users as mentioned under the main invariants in the README. But since the to address is not checked to have the WHITELISTED_ROLE as well, the call goes through.

```solidity
File: UStb.sol
198:             } else if (hasRole(MINTER_CONTRACT, msg.sender) && from == address(0) && !hasRole(BLACKLISTED_ROLE, to)) {
199:                 // minting

A coded proof of concept is recommended for high severity findings.

Recommended mitigation steps

Add hasRole(WHITELISTED_ROLE, to) in the check.

@c4-bot-8 c4-bot-8 added 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 labels Nov 11, 2024
c4-bot-9 added a commit that referenced this issue Nov 11, 2024
@c4-bot-13 c4-bot-13 added the 🤖_03_group AI based duplicate group recommendation label Nov 11, 2024
@c4-judge
Copy link

0xEVom marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Nov 12, 2024
@c4-judge
Copy link

0xEVom marked the issue as primary issue

@c4-judge c4-judge added the primary issue Highest quality submission among a set of duplicates label Nov 12, 2024
@iethena
Copy link

iethena commented Nov 15, 2024

The Minter has a special role in the protocol and it is seen as a non-issue that UStb can be minted to non-whitelisted addresses while whitelist mode is enabled because the beneficiary cannot transfer those minted tokens. Please note that “mint” functionality is intentionally not specified in the invariant being referenced as this scenario has already been considered.

It should be further noted that the Minter role can be revoked by the Admin if there is any non-compliant behavior. The Minter is bound by an off-chain contractual obligation to act benevolently with their power in that role.

Due to this we see the likelihood of this scenario being low. The impact of this scenario is also low as the collateral in the protocol is not affected and the position of other users is not affected. We argue this is not an issue as it does not break any of the main invariants, however we acknowledge that this scenario is accurate from an informational standpoint.

@iethena iethena added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Nov 15, 2024
@c4-judge
Copy link

0xEVom marked the issue as unsatisfactory:
Invalid

@c4-judge c4-judge added unsatisfactory does not satisfy C4 submission criteria; not eligible for awards and removed satisfactory satisfies C4 submission criteria; eligible for awards labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 primary issue Highest quality submission among a set of duplicates 🤖_03_group AI based duplicate group recommendation sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

4 participants