Cayde-6 - wrong value being passed in _buyBack
lead to loss of funds for swapper
#221
Labels
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
Cayde-6
Medium
wrong value being passed in
_buyBack
lead to loss of funds for swapperSummary
An incorrect value is being passed in the
_buyBack
function within the_feeDispersal
of_defiSwap
. TheSWAPPER_ROLE
is forwardingmsg.value
instead of the contract’s balance, leading to unintended fund losses for the swapper role.Root Cause
The function mistakenly forwards
msg.value
instead ofaddress(this).balance
.Internal Pre-Conditions
Executing a defi swap with fee dispersal enabled.
Attack Path
safe
.Impact
The
SWAPPER_ROLE
incurs a loss of funds due to covering defi swap fees.Proof of Concept (PoC)
AmirX.sol#L232
Mitigation
To resolve this, replace
msg.value
withaddress(this).balance
to ensure the contract's balance is used instead of the caller’s sent value.The text was updated successfully, but these errors were encountered: