-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Severity: Medium
Files Affected
solidity/src/FlowYieldVaultsRequests.sol
Description
FlowYieldVaultsRequests.createYieldVault() and depositToYieldVault() escrow funds by transferring tokens into the contract in _validateDeposit(), and then incrementing pendingUserBalances[user][token] inside _createRequest() while the request stays in RequestStatus.PENDING until the authorized COA calls startProcessing(requestId).
However, claimRefund(tokenAddress) allows a user to withdraw the entire pendingUserBalances[msg.sender][tokenAddress] without checking whether that balance is backing any still-PENDING CREATE/DEPOSIT requests.
Exploit Scenario
- User deposits 10 FLOW via
createYieldVault() _validateDeposit()transfers 10 FLOW to contract_createRequest()creditspendingUserBalances[user][token] += 10- User immediately calls
claimRefund(NATIVE_FLOW) - User receives 10 FLOW,
pendingUserBalancesset to 0 - Request remains PENDING but is now unbacked
This can permanently bloat the pending queue with "unbacked" PENDING requests that cause startProcessing() to revert with InsufficientBalance, and can make cancelRequest() / dropRequests() revert due to underflow.
Recommendation
Consider changing behavior so cancelRequest() and dropRequests() can mark requests as failed and remove them from queues even if the tracked pendingUserBalances is insufficient.
Parent Issue: #15