Closed c4-bot-7 closed 7 months ago
141345 marked the issue as sufficient quality report
empty reserve to drain the pool
seems invalid need to check POC, how to make target 0
We acknowledge that this is indeed the case, but dispute that it'd be possible to get reserves to 0 once liquidity has been added (this also burns some shares). The finding hints that it is possible to do through flashLoan()
, but this call importantly only syncs reserves once everything has been validated, and it is nonReentrant.
0xmDreamy (sponsor) disputed
Invalid, flashloan can't do it, reserves are updated after the user repays them, not after the tokens are lent.
thereksfour marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-03-abracadabra-money/blob/1f4693fdbf33e9ad28132643e2d6f7635834c6c6/src/mimswap/libraries/PMMPricing.sol#L92-L95 https://github.com/code-423n4/2024-03-abracadabra-money/blob/1f4693fdbf33e9ad28132643e2d6f7635834c6c6/src/mimswap/libraries/PMMPricing.sol#L59-L63
Vulnerability details
Impact
MagicLp
contract hassellBase
function that enables users to sell their base tokens for a quote token in return, and it hassellQuote
function that enables users to sell their quote tokens and get base tokens in return (from the contract reserves), where users trade their tokens with the contract tokens reserves.But these functions (
sellBase
&sellQuote
) allow sellers to purchase the contract reserves without a limit, where any user can empty the base or quote reserves as there's no limit on the amount of tokens being purchased from the contract.So for example:
_QUOTE_TARGET_
&_QUOTE_RESERVE_
will be zeros (state.Q0
&state.Q
ingetPMMState()
),_BASE_TARGET_
, by callingMagicLP.querySellQuote(trader,0)
.PMMPricing.sellQuoteToken
:flashLoan()
function).Proof of Concept
PMMPricing.sellQuoteToken function/ L92-L95
PMMPricing.sellBaseToken function/L59-L63
Tools Used
Manual Review.
Recommended Mitigation Steps
Update
PMMPricing.sellQuoteToken()
&PMMPricing.sellBaseToken()
functions to revert ifpayBaseAmount == 0 || backToOnePayBase == 0
:Assessed type
Context