Ethena Labs - jasonxiale'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: 8/147

Findings: 2

Award: $1,436.70

QA:
grade-b

๐ŸŒŸ Selected for report: 0

๐Ÿš€ Solo Findings: 0

Findings Information

๐ŸŒŸ Selected for report: adeolu

Also found by: Eeyore, Madalad, Mike_Bello90, Shubham, jasonxiale, josephdara, peanuts

Labels

2 (Med Risk)
satisfactory
duplicate-198

Awards

1432.1788 USDC - $1,432.18

External Links

Judge has assessed an item in Issue #491 as 2 risk. The relevant finding follows:

[L-03] While StakedUSDeV2.cooldownDuration is changed from non-zero to zero, stakers should be able to call StakedUSDeV2.unstake to withdraw assets regardless of userCooldown.cooldownEnd File: https://github.com/code-423n4/2023-10-ethena/blob/ee67d9b542642c9757a6b826c82d0cae60256509/contracts/StakedUSDeV2.sol#L78-L90 While StakedUSDeV2.cooldownDuration is changed from non-zero to zero, a staker can withdraw his asset by calling StakedUSDeV2.withdraw or StakedUSDeV2.redeem, and those functions transfer stakersโ€™ asset immediate. But for the stakers who withdraw their asset before StakedUSDeV2.cooldownDuration is changed, they have to wait until userCooldown.cooldownEnd is reached. I think itโ€™s unfair for those stakers.

diff --git a/contracts/StakedUSDeV2.sol b/contracts/StakedUSDeV2.sol index df2bb48..84a6c03 100644 --- a/contracts/StakedUSDeV2.sol +++ b/contracts/StakedUSDeV2.sol @@ -79,7 +79,7 @@ contract StakedUSDeV2 is IStakedUSDeCooldown, StakedUSDe { UserCooldown storage userCooldown = cooldowns[msg.sender]; uint256 assets = userCooldown.underlyingAmount;

  • if (block.timestamp >= userCooldown.cooldownEnd) {
  • if (block.timestamp >= userCooldown.cooldownEnd || cooldownDuration == 0 ) { userCooldown.cooldownEnd = 0; userCooldown.underlyingAmount = 0;

#0 - c4-judge

2023-11-27T20:06:09Z

fatherGoose1 marked the issue as duplicate of #198

#1 - c4-judge

2023-11-27T20:48:44Z

fatherGoose1 marked the issue as satisfactory

[L-01] EthenaMinting.usde is unchangable.

File: https://github.com/code-423n4/2023-10-ethena/blob/ee67d9b542642c9757a6b826c82d0cae60256509/contracts/EthenaMinting.sol#L63 https://github.com/code-423n4/2023-10-ethena/blob/ee67d9b542642c9757a6b826c82d0cae60256509/contracts/USDe.sol#L23-L26

According to USDe.setMinter, USDe.minter can be changed by owner, if the owner of USDe.sol is compromised, USDe.setMinter can be called to change the USDe.minter. If USDe.minter is changed, USDe.mint will not work. Thus EthenaMinting.mint will not work

[L-02] StakedUSDe.transferInRewards doesn't need to call getUnvestedAmount while calculating newVestingAmount

File: https://github.com/code-423n4/2023-10-ethena/blob/ee67d9b542642c9757a6b826c82d0cae60256509/contracts/StakedUSDe.sol#L91 According to StakedUSDe.sol#L90, if (getUnvestedAmount() > 0) revert StillVesting() which means getUnvestedAmount's return value must be zero to continue. In such case, calling getUnvestedAmount at StakedUSDe.sol#L91 is unnecessary.

[L-03] While StakedUSDeV2.cooldownDuration is changed from non-zero to zero, stakers should be able to call StakedUSDeV2.unstake to withdraw assets regardless of userCooldown.cooldownEnd

File: https://github.com/code-423n4/2023-10-ethena/blob/ee67d9b542642c9757a6b826c82d0cae60256509/contracts/StakedUSDeV2.sol#L78-L90 While StakedUSDeV2.cooldownDuration is changed from non-zero to zero, a staker can withdraw his asset by calling StakedUSDeV2.withdraw or StakedUSDeV2.redeem, and those functions transfer stakers' asset immediate. But for the stakers who withdraw their asset before StakedUSDeV2.cooldownDuration is changed, they have to wait until userCooldown.cooldownEnd is reached. I think it's unfair for those stakers.

diff --git a/contracts/StakedUSDeV2.sol b/contracts/StakedUSDeV2.sol
index df2bb48..84a6c03 100644
--- a/contracts/StakedUSDeV2.sol
+++ b/contracts/StakedUSDeV2.sol
@@ -79,7 +79,7 @@ contract StakedUSDeV2 is IStakedUSDeCooldown, StakedUSDe {
     UserCooldown storage userCooldown = cooldowns[msg.sender];
     uint256 assets = userCooldown.underlyingAmount;
 
-    if (block.timestamp >= userCooldown.cooldownEnd) {
+    if (block.timestamp >= userCooldown.cooldownEnd || cooldownDuration == 0 ) {
       userCooldown.cooldownEnd = 0;
       userCooldown.underlyingAmount = 0;

#0 - c4-pre-sort

2023-11-02T02:36:30Z

raymondfam marked the issue as sufficient quality report

#1 - c4-judge

2023-11-14T17:03:08Z

fatherGoose1 marked the issue as grade-b

#2 - crazy4linux

2023-11-19T15:57:24Z

hi @fatherGoose1 I think Low 03- While StakedUSDeV2.cooldownDuration is changed from non-zero to zero, stakers should be able to call StakedUSDeV2.unstake to withdraw assets regardless of userCooldown.cooldownEnd in QA is a duplicate of https://github.com/code-423n4/2023-10-ethena-findings/issues/29

The same vulnerability and impact are identified, as well as scenarios where user's funds can be locked longer than expected.

#3 - c4-judge

2023-11-27T20:05:48Z

fatherGoose1 changed the severity to 2 (Med Risk)

#4 - c4-judge

2023-11-27T20:05:48Z

fatherGoose1 changed the severity to 2 (Med Risk)

#5 - c4-judge

2023-11-27T20:49:24Z

fatherGoose1 changed the severity to QA (Quality Assurance)

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