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

Rea - Unrestricted withdrawal mechanism #237

Open
sherlock-admin4 opened this issue Sep 23, 2024 · 0 comments
Open

Rea - Unrestricted withdrawal mechanism #237

sherlock-admin4 opened this issue Sep 23, 2024 · 0 comments

Comments

@sherlock-admin4
Copy link
Contributor

sherlock-admin4 commented Sep 23, 2024

Rea

Medium

Unrestricted withdrawal mechanism

Summary

The claimWithdrawl function allows a staker to withdraw funds immediately after the withdrawal lock period ends, but the lock period is hardcoded

Line of code

https://github.com/sherlock-audit/2024-08-morphl2/blob/main/morph/contracts/contracts/l1/staking/L1Staking.sol#L307

Root Cause

The claimWithdrawal function allows immediate withdrawal after the lock period ends. A malicious actor could manipulate the timing to front-run legitimate withdrawals

Internal pre-conditions

  1. The withdrawal lock period is hardcoded
  2. A malicious actor knows exactly when the lock expires

External pre-conditions

  1. The attacker can manipulate block timing’s to front-run legitimate users

Attack Path

  1. The attacker monitors the block timing and initiates a withdrawal as soon as the lock expires
  2. They drain the funds before legitimate users can react

Impact

Users lose their staked funds as the attacker front-runs the withdrawal process. For example, if the total stake is 1000 ETH, the attacker could withdraw all funds before others

PoC

No response

Mitigation

Implement a randomised delay or use a time stamp-based lock rather than block-based timing to reduce predictability

@sherlock-admin3 sherlock-admin3 changed the title Kind Coconut Crane - Unrestricted withdrawal mechanism Rea - Unrestricted withdrawal mechanism Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant