Missing restricted modifier on claimWithdrawalF
The claimWithdrawalFromEigenLayer function in PufferVault.sol is documented as restricted access but lacks the restricted modifier, so anyone can call it. The report claims this allows unauthorised execution of a function the protocol assumes is access-controlled.
Originally disclosed on Immunefi
- Disclosed after under an hour
28629 - [SC - Insight] Missing restricted modifier on claimWithdrawalF...
Submitted on Feb 22nd 2024 at 18:38:33 UTC by @imaybeghost for Boost | Puffer Finance
Report ID: #28629
Report type: Smart Contract
Report severity: Insight
Target: https://etherscan.io/address/0x7276925e42f9c4054afa2fad80fa79520c453d6a
Impacts:
- Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Brief/Intro
Throughout the PufferVault.sol wherever there is a function with natspec specifying Restricted access, is implemented with restricted modifier. Unfortunately, claimWithdrawalFromEigenLayer(IEigenLayer.QueuedWithdrawal,IERC20[], uint256 ) is supposed to be Restricted access but no restricted modifier is specified
Vulnerability Details
/**
* @notice Claims stETH withdrawals from EigenLayer
* Restricted access
* @param queuedWithdrawal The queued withdrawal details
* @param tokens The tokens to be withdrawn
* @param middlewareTimesIndex The index of middleware times
*/
function claimWithdrawalFromEigenLayer(
IEigenLayer.QueuedWithdrawal calldata queuedWithdrawal,
IERC20[] calldata tokens,
uint256 middlewareTimesIndex
) external virtual {...}
As You can check in natspec, the function is supposed to be restricted but no restricted modifier is implemented to prevent unexpected execution.
Conversely, throughout the contract all the functions whose natspec specifies the function as Restricted access is implemented with restricted modifier E.g:
/**
* @notice Deposits stETH into `stETH EigenLayer strategy`
* Restricted access
* @param amount the amount of stETH to deposit
*/
function depositToEigenLayer(uint256 amount) external virtual restricted {..}
/**
* @notice Initiates stETH withdrawals from EigenLayer
* Restricted access
* @param sharesToWithdraw An amount of EigenLayer shares that we want to queue
*/
function initiateStETHWithdrawalFromEigenLayer(uint256 sharesToWithdraw) external virtual restricted {...}
similarly for, initiateETHWithdrawalsFromLido(uint256[] calldata amounts)
Impact Details
This leads to the unauthorized access to claimWithdrawalFromEigenLayer() when in fact the protocol assumes it to be implemented with access controls in place
References
https://github.com/PufferFinance/pufETH/blob/main/src/PufferVault.sol#L215-L226
Proof of Concept
Since the straightforwardness of the issue, i dont think POC is neccessary, I think adding POC for this issue would be Vacous and an opportunity cost for both of us
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a missing access-control modifier on a function whose documentation states it should be restricted.
Impact
The report claims unauthorised callers could invoke the withdrawal-claiming function, but it does not demonstrate any concrete loss or damage.
What the attacker needed
Ability to send a transaction to the contract
The fix
The function should be given the same restricted modifier used by the other privileged functions in the contract.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Some smart contract functions are meant to be callable only by the contract's own team, and this is enforced by a modifier, a small check added to the function. Here the documentation said the function was restricted, but the check was never added, so any outside address could call it. The report does not show what harm that actually causes.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.