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
Rank: 8/147
Findings: 2
Award: $1,436.70
๐ Selected for report: 0
๐ Solo Findings: 0
๐ Selected for report: adeolu
Also found by: Eeyore, Madalad, Mike_Bello90, Shubham, jasonxiale, josephdara, peanuts
1432.1788 USDC - $1,432.18
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;
#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
๐ Selected for report: 0xmystery
Also found by: 0x11singh99, 0xAadi, 0xAlix2, 0xG0P1, 0xStalin, 0xWaitress, 0x_Scar, 0xhacksmithh, 0xhunter, 0xpiken, Al-Qa-qa, Arz, Avci, Bauchibred, BeliSesir, Breeje, Bughunter101, DarkTower, Eeyore, Fitro, HChang26, Imlazy0ne, J4X, JCK, Kaysoft, Kral01, Madalad, Mike_Bello90, Noro, PASCAL, PENGUN, Proxy, Rickard, Shubham, SovaSlava, Strausses, Team_Rocket, ThreeSigma, Topmark, Udsen, Walter, Yanchuan, Zach_166, ZanyBonzy, adam-idarrha, adeolu, almurhasan, arjun16, ast3ros, asui, ayden, btk, cartlex_, castle_chain, cccz, chainsnake, codynhat, critical-or-high, cryptonue, csanuragjain, deepkin, degensec, dirk_y, erebus, foxb868, ge6a, hunter_w3b, jasonxiale, kkkmmmsk, lanrebayode77, lsaudit, marchev, matrix_0wl, max10afternoon, nuthan2x, oakcobalt, oxchsyston, pavankv, peanuts, pep7siup, pipidu83, pontifex, ptsanev, qpzm, radev_sw, rokinot, rotcivegaf, rvierdiiev, sorrynotsorry, squeaky_cactus, supersizer0x, tnquanghuy0512, twcctop, twicek, young, zhaojie, ziyou-
4.5226 USDC - $4.52
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
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.
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)