PredictDotLoan.acceptLoanOfferAndFillOrder() function is vulnerable for the front-run attack.
Summary
PredictDotLoan.acceptLoanOfferAndFillOrder() function doesn't check any authority for the caller. Therefore caller can front-run the matcher's tx to steal the incentives for the matcher.
As can be seen, the above function doesn't check authority for the caller and transfers excess collateral to the caller if any. At the same time, the caller doesn't consume any funds of his/her own.
Internal pre-conditions
No response
External pre-conditions
There should be excess collateral when matcher calls acceptLoanOfferAndFillOrder() function. This condition will be hold true in general because if there is no excess collateral, it is most likely for no one to call acceptLoanOfferAndFillOrder().
Attack Path
A matcher calls acceptLoanOfferAndFillOrder() function to receive excess collaterals.
Attacker front-run the matcher's tx with the same exchangeOrder and proposal parameter.
Impact
Attacker can steal the funds of the matcher by front-run. As per readme, the protocol will be potentially deployed on "any EVM chains with a prediction market that uses Polymarket’s CTF exchange and neg risk protocol" ex: Ethereum, where the front-run is available.
dany.armstrong90
Medium
PredictDotLoan.acceptLoanOfferAndFillOrder()
function is vulnerable for the front-run attack.Summary
PredictDotLoan.acceptLoanOfferAndFillOrder()
function doesn't check any authority for the caller. Therefore caller can front-run the matcher's tx to steal the incentives for the matcher.Root Cause
The acceptLoanOfferAndFillOrder() is the following.
As can be seen, the above function doesn't check authority for the caller and transfers excess collateral to the caller if any. At the same time, the caller doesn't consume any funds of his/her own.
Internal pre-conditions
No response
External pre-conditions
acceptLoanOfferAndFillOrder()
function. This condition will be hold true in general because if there is no excess collateral, it is most likely for no one to callacceptLoanOfferAndFillOrder()
.Attack Path
acceptLoanOfferAndFillOrder()
function to receive excess collaterals.exchangeOrder
andproposal
parameter.Impact
Attacker can steal the funds of the matcher by front-run. As per readme, the protocol will be potentially deployed on "any EVM chains with a prediction market that uses Polymarket’s CTF exchange and neg risk protocol" ex: Ethereum, where the front-run is available.
PoC
No response
Mitigation
There are two available mitigations.