Lack of Slippage Controls in retrieveTokensForWithdraw Function #1490
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
insufficient quality report
This report is not of sufficient quality
M-08
primary issue
Highest quality submission among a set of duplicates
🤖_primary
AI based primary recommendation
🤖_139_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2024-04-noya/blob/main/contracts/accountingManager/AccountingManager.sol#L548
Vulnerability details
Impact
Without slippage controls in the
retrieveTokensForWithdraw
function, there is a risk of financial loss for users during token retrieval from connectors. This function handles sensitive operations where base tokens are pulled from external liquidity pools or other decentralized financial instruments to fulfill withdrawal requests. In volatile market conditions, the absence of slippage controls can lead to a significant discrepancy between the expected and actual amounts of tokens retrieved, potentially resulting in users receiving less value than their withdrawal entitlements.Proof of Concept
The function interacts with connectors to retrieve tokens without ensuring the retrieval amounts are within acceptable slippage ranges
https://github.com/code-423n4/2024-04-noya/blob/main/contracts/accountingManager/AccountingManager.sol#L548
This code lacks mechanisms to check the price impact of retrieving large amounts from connectors, which could lead to unfavorable token retrieval rates.
Tools Used
Manual
Recommended Mitigation Steps
Integrating slippage control into the
retrieveTokensForWithdraw
function can be done by adding a check to ensure the amount of tokens retrieved is within an acceptable range of the expected amount. Here is a suggested implementation:Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: