Closed sherlock-admin2 closed 7 months ago
Although this report is factually correct, this is the intended behavior. Marking as confirmed/wontfix.
@smartcontracts Wouldn't this allow bypass of the intended withdrawal delay, although I agree, no exploit can happen here given the user must still only be able to withdraw what he has previously unlocked.
Ah it's not really bypassing the withdrawal delay since the delay is indeed enforced once, which is all we really need. So this particular behavior is intended. It only becomes an issue if someone can somehow act as the FDG far ahead of time and execute a withdrawal later.
ZanyBonzy
medium
Users can avoid withdrawal delay time after first request.
Summary
The withdrawal process is done in two steps, the
unlock
and thewithdraw
. A user can put a request to unlock a large amount of wad, even greater than hisWETH
balance. Once the delay time his over, he's able to continually withdraw without any putting in any unlock request.Vulnerability Detail
The
unlock
function allows users to put in a request for withdrawal. After putting in the request, they're required to wait for a delay period before their withdrawal can be processed.Looking at the unlock function, it increases the
wd.amount
i.e the amount to be unlocked by the user specifiedwad
parameter. Noting that there's no input validation even against the user's WETH balance, a user can specify an arbitrarily large amount, for instancetype(uint256).max
and this will be set as hiswd.amount
.All that is left is for the user to wait for the required delay time and to start withdrawing. Since the
withdraw
function deducts the amount to withdraw from the wd.amount requested, the user can theoretically continue withdrawing directly without any more delays untiltype(uint256).max
is completely zeroed out without making any more unlock requests.Impact
Bypassing the withdrawal delay mechanism.
Code Snippet
https://github.com/sherlock-audit/2024-02-optimism-2024/blob/f216b0d3ad08c1a0ead557ea74691aaefd5fd489/optimism/packages/contracts-bedrock/src/dispute/weth/DelayedWETH.sol#L65
https://github.com/sherlock-audit/2024-02-optimism-2024/blob/f216b0d3ad08c1a0ead557ea74691aaefd5fd489/optimism/packages/contracts-bedrock/src/dispute/weth/DelayedWETH.sol#L80
Tool used
Manual Review
Recommendation
THere are two ways this can be fixed.
wad
input in theunlock
function against theguy
's balance and not allowing requests more that the balance, hence once the user's balance is exhausted, he has to put in a new request.withdraw
function, so the user will be forced to put in a new request for everytime he wants to withdraw.