SwapAction::getSwapToken
will return wrong swap token for balancer EXACT_OUT swaps
#248
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
M-03
primary issue
Highest quality submission among a set of duplicates
🤖_primary
AI based primary recommendation
🤖_50_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")
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-07-loopfi/blob/main/src/proxy/SwapAction.sol#L320-L330
Vulnerability details
Impact
As known, when doing a Balancer EXACT_OUT batch swap, assets should be passed in reverse order, this is thoroughly documented here.
However, in
SwapAction::getSwapToken
, for Balancer swaps it always returns the last asset in the assets array, which is correct for EXACT_IN but wrong for EXACT_OUT, where it should be the first asset in the assets array.Proof of Concept
Tools Used
Manual review
Recommended Mitigation Steps
Add the following in
SwapAction::getSwapToken
:Assessed type
Error
The text was updated successfully, but these errors were encountered: