You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
POB - Lost funds in the AmirX::_buyBack function when DefiSwap.defiSafe is set to address(0)
Summary
BuyBack can result in lost funds if DefiSwap.defiSafe is not set. There is no check in the AmirX::_verifyDefiSwap function to ensure that DefiSwap.defiSafe is not the zero address. In the BuyBack function, if feeToken is POL and there is still POL remaining in the contract after the swap (address(this).balance > 0), the remaining POL will be sent to the zero address.
Root Cause
In AmirX::_verifyDefiSwap function there is no check to ensure that DefiSwap.defiSafe is not the zero address.
Internal pre-conditions
DefiSwap.defiSafe should be set to the zero address.
address(feeToken) == POL.
After the aggregator call (bool polSwap,) = aggregator.call{value: msg.value}(swapData);, there should be remaining POL (address(this).balance > 0)
Impact
The bug in the BuyBack function causes any remaining POL after the swap to be sent to the zero address, resulting in lost funds.
Mitigation
Add a condition in the AmirX::_verifyDefiSwap function to check if a non-zero DefiSwap.defiSafe address is provided.
The text was updated successfully, but these errors were encountered:
sherlock-admin3
changed the title
Active Goldenrod Cod - POB - Lost funds in the AmirX::_buyBack function when DefiSwap.defiSafe is set to address(0)
POB - POB - Lost funds in the AmirX::_buyBack function when DefiSwap.defiSafe is set to address(0)Nov 17, 2024
POB
Medium
POB - Lost funds in the
AmirX::_buyBack
function whenDefiSwap.defiSafe
is set toaddress(0)
Summary
BuyBack can result in lost funds if
DefiSwap.defiSafe
is not set. There is no check in theAmirX::_verifyDefiSwap
function to ensure thatDefiSwap.defiSafe
is not the zero address. In the BuyBack function, iffeeToken
isPOL
and there is still POL remaining in the contract after the swap (address(this).balance > 0
), the remaining POL will be sent to the zero address.Root Cause
In AmirX::_verifyDefiSwap function there is no check to ensure that
DefiSwap.defiSafe
is not the zero address.Internal pre-conditions
DefiSwap.defiSafe
should be set to the zero address.address(feeToken) == POL
.(bool polSwap,) = aggregator.call{value: msg.value}(swapData);
, there should be remaining POL (address(this).balance > 0
)Impact
The bug in the BuyBack function causes any remaining POL after the swap to be sent to the zero address, resulting in lost funds.
Mitigation
Add a condition in the
AmirX::_verifyDefiSwap
function to check if a non-zeroDefiSwap.defiSafe
address is provided.The text was updated successfully, but these errors were encountered: