Ethena Labs - Cosine's results

Enabling The Internet Bond

General Information

Platform: Code4rena

Start Date: 24/10/2023

Pot Size: $36,500 USDC

Total HM: 4

Participants: 147

Period: 6 days

Judge: 0xDjango

Id: 299

League: ETH

Ethena Labs

Findings Distribution

Researcher Performance

Rank: 40/147

Findings: 1

Award: $161.80

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Awards

161.7958 USDC - $161.80

Labels

bug
2 (Med Risk)
satisfactory
sufficient quality report
duplicate-246

External Links

Lines of code

https://github.com/code-423n4/2023-10-ethena/blob/ee67d9b542642c9757a6b826c82d0cae60256509/contracts/StakedUSDe.sol#L225-L238

Vulnerability details

Summary

As the docs state out, the soft restricted role should not be able to deposit and withdraw in the staker contracts, as this would be an illegal action. But a missing check inside StakedUSDe allows soft restricted users to withdraw.

Vulnerability Details

Here is a quote of the docs about the SOFT_RESTRICTED_STAKER_ROLE: “Due to legal requirements, there's a SOFT_RESTRICTED_STAKER_ROLE and FULL_RESTRICTED_STAKER_ROLE. The former is for addresses based in countries we are not allowed to provide yield to, for example USA. Addresses under this category will be soft restricted. They cannot deposit USDe to get stUSDe or withdraw stUSDe for USDe.”

Therefore, it should not be allowed that users who are soft restricted are able to withdraw, but as we can see in the withdraw function only full restricted users are prevented from withdrawing:

function _withdraw(address caller, address receiver, address _owner, uint256 assets, uint256 shares)
  internal
  override
  nonReentrant
  notZero(assets)
  notZero(shares)
{
  if (hasRole(FULL_RESTRICTED_STAKER_ROLE, caller) || hasRole(FULL_RESTRICTED_STAKER_ROLE, receiver)) {
    revert OperationNotAllowed();
  }

  super._withdraw(caller, receiver, _owner, assets, shares);
  _checkMinShares();
}

Impact

Soft restricted users are able to withdraw, which is an illegal action, as the docs state out.

Tools Used

Manual Review

Recommendations

Implement a check so that soft restricted users are not able to withdraw.

Assessed type

Access Control

#0 - c4-pre-sort

2023-10-31T06:29:46Z

raymondfam marked the issue as sufficient quality report

#1 - c4-pre-sort

2023-10-31T06:30:04Z

raymondfam marked the issue as duplicate of #52

#2 - c4-judge

2023-11-10T21:40:36Z

fatherGoose1 marked the issue as satisfactory

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter