Malicious users can drain the CapitalPool by leveraging sub level offers
The root cause is found in the fact that PreMarket:listOffer() allows the caller to specify the collateralRate for the sub level offer.
A malicious user can specify an higher collateralRate than the one used by the high level offer and immediately close his position.
This will allow him to claim an higher amount than deposited since PreMarket:closeOffer() computes the MakerRefound using the collateralRate of the offer being closed.
Malicious users can carefully craft a listing that, when closed, will allow them to drain the entire CapitalPool contract.
If Turbo mode is used, the impact is even higher, since the attacker isn't even required to put down collateral in order to perform the attack.
The following test demonstrated the attack in Protected mode, where the attacker is required to put down collateral:
Manual review
Foundry
PreMarket:listOffer() should not allow the caller to change the collateralRate, it should use the one from the original offer instead to prevent him for leveraging his makerRefound amount:
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.