Ethena Labs - young'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: 133/147

Findings: 1

Award: $4.52

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2023-10-ethena/blob/ee67d9b542642c9757a6b826c82d0cae60256509/contracts/StakedUSDeV2.sol#L82 https://github.com/code-423n4/2023-10-ethena/blob/ee67d9b542642c9757a6b826c82d0cae60256509/contracts/StakedUSDeV2.sol#L100 https://github.com/code-423n4/2023-10-ethena/blob/ee67d9b542642c9757a6b826c82d0cae60256509/contracts/StakedUSDeV2.sol#L116

Vulnerability details

Impact

When a user calls cooldownShares or cooldownAssets with a certain amount of shares/assets, his cooldownEnd time for claim with to uint104(block.timestamp) + cooldownDuration. But if he tries to redeem multiple times before claiming, the cooldownEnd will be extended by the last redeem call, this means that the previously unstaked amount (which could be available for claim) is stuck in the contract and unable to claim until some much more time has passed.

Proof of Concept

Consider the following scenario.

  1. User Bob wants to quit partially, so he redeemed 1 share on DAY 0 and has to wait 14 days before the final claim.
  2. 13 days past (Or even more time), Bob redeems another 1 share on DAY 13, the cooldownEnd has been extended by another 14 days.
  3. On Day 14, Bob calls the unstake function, but the transaction is reverted. He can't get the assets for the 1st redemption attempt which is frustrating and this violates the initial design.

In fact, in this scenario, in the worst case, the user has to wait 90 more days which is unacceptable.

Consider another scenario.

  1. User Bob wants to quit partially, so he redeemed 1 share on DAY 0 and has to wait 14 days before the final claim.
  2. 13 days past (Or even more time), Alice (who has some approvals on Bob) performs the griefing attack and redeems another 1 share on DAY 13, the cooldownEnd has been extended by another 14 days.
  3. On Day 14, Bob calls the unstake function, but the transaction is reverted. If Alice keeps attacking like this, Bob will not be able to get his funds back anymore.

Tools Used

Manual

We recommend setting nonces for each redeem attempt, and thus a cooldown period is set per attempt, so that redeem attempts won't interfere with each other.

Assessed type

Timing

#0 - c4-pre-sort

2023-10-31T07:41:07Z

raymondfam marked the issue as sufficient quality report

#1 - c4-pre-sort

2023-10-31T07:41:18Z

raymondfam marked the issue as duplicate of #4

#2 - c4-pre-sort

2023-11-01T19:36:42Z

raymondfam marked the issue as duplicate of #514

#3 - c4-judge

2023-11-10T21:26:59Z

fatherGoose1 marked the issue as unsatisfactory: Invalid

#4 - c4-judge

2023-11-17T17:04:09Z

fatherGoose1 changed the severity to QA (Quality Assurance)

#5 - c4-judge

2023-11-20T20:20:10Z

fatherGoose1 marked the issue as grade-b

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