Submitted by deadrxsezzz, also found by Bigsam, 0xNirix, Udsen, Takarez, and Infect3d
Within functions such as repay and repayAndProcessUnpaidWithdrawalBatches, funds are first pulled from the user in order to use them towards the currently expired, but not yet unpaid batch, and then the updated state is fetched.
However, this is not true for functions such as closeMarket, deposit, repayOutstandingDebt and repayDelinquentDebt, where the state is first fetched and only then funds are pulled, forcing borrower into higher fees.
This inconsistency will cause borrowers to pay extra fees which they otherwise wouldnt.
PoC:
and the logs:
Always pull the funds first and refund later if needed.
d1ll0n (Wildcat) acknowledged and commented:
laurenceday (Wildcat) commented:
