Closed c4-bot-7 closed 8 months ago
should be accessed through router no factor
141345 marked the issue as primary issue
seems invalid, the share amount is adjusted in router
141345 marked the issue as sufficient quality report
0xCalibur (sponsor) disputed
thereksfour marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-03-abracadabra-money/blob/main/src/mimswap/MagicLP.sol#L360
Vulnerability details
Impact
Loss of funds for users due to slippage during the execution of the
buyShares
function.Proof of Concept
The
buyShares
, is aexternal
accessed function, serves as the entry point for liquidity providers to contribute liquidity and receive LP shares in return.Here's it's implementation:
Now consider the following scenario:
Initial State:
Change of Reserve:
sellBase
orsellQuote
which can change the reserve ratio of the pool.Alice's Transaction:
buyShares
function.Because of scenarios like this, user will receive fewer shares than anticipated, resulting in losses due to slippage. Therefore it's important to protect users by reverting in case of higher slippage.
Tools Used
VS Code
Recommended Mitigation Steps
Add
minShares
parameter and validate it inbuyShares
function itself just like how it is done in Router.Assessed type
MEV