DeliveryPlace::settleAskMaker
is supposed to be used by a maker to settle an offer. By invoking it, a maker settles the offer with the amount of settled points, gets a refund for the points not used (if settled points == used points) and deposits point tokens.
The issue lies in the lack of validation so anyone having an offer can invoke this function and get a refund when they should not.
Let’s assume the following scenario:
An offer is created by a maker for 1000 points at USDC1000
An attacker buys 1 point for USDC1
The attacker lists his stock with the intention of not selling it (sets a very high amount – the amount is to be the CapitalPool
balance / collateral ratio)
When the status gets into AskSettling
, the attacker invokes settleAskMaker
with zero _settledPoints
as argument.
In this scenario, the attacker will drain the CapitalPool
contract of USDC.
The key to this attack lies in the lack of validation:
After that, the attacker will get refunded the result of amount * collateral ratio (since the amount is defined by the attacker when listing his stock, that is the reason the amount set is CapitalPool balance / collateral ratio):
Add this test into PreMarkets.t.sol
:
Foundry
Check msg.sender == makerInfo.authority
Valid high severity, because the collateral rate utilized when creating an offer is stale and retrieved from a previously set collateral rate, it allows possible manipilation of refund amounts using an inflated collateral rate to drain funds from the CapitalPool contract
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.