If the protocol decides for whatever reason to set the protocol borrowing fee to 0 (example to encourage users to use the protocol), then a malicious actor can DoS all borrow operations by:
front-running any loan operation, fully borrowing all available pool tokens
normal user transaction would revert as there are no more tokens to borrow in the pool
malicious actor would also back-run the repaying of all his debt to the pool
By doing this, borrowing from any pool can be blocked. Also, the cost required to perform this attack is very low (no interest/fee to be paid, only gas cost required) and the attack results in the DoS of one of the most crucial feature of the protocol, i.e. borrow.
When initiation a borrow, a borrower fee is deducted from the overall debt to be encored and sent to the protocol.
Also, when repaying a debt, the a lender fee is paid plus an extra interest to the pool:
where the value for lenderInterest
and protocolInterest
is calculate using the _calculateInterest
function as such:
From the above implementations we see that:
borrowing fees are 0 if the variable borrowerFee
is 0
if done in the same transaction, when repaying, fees are calculated based on timeElapsed
which is 0 resulting in both lenderInterest
and protocolInterest
being 0:
as such, no fees are deducted in a complete borrow + repay cycle.
This behavior can be abused in the following way, a theoretical POC:
eve
(protocol owner) just launched the protocol and wants to encourage adoption so he drops the borrowerFee
to 0
alice
wants to borrow using the protocol so she initiates a transaction
bob
, who wants eve
's project to fail, front-runs alice
's borrow with his own and borrows all available pool balance
alice
's borrow will now revert due to an underflow on updating pool balance (because there is no more available balance to be used)
bob
also launched a back-run call that repays his loan completely
Protocol borrow operation is completely blocked under certain conditions.
Manual analysis and similar issues in other audits.
Modify the _calculateInterest
to attribute a default protocol fee as to make this attack economically unsustainable.
The simplest alternative is to not allow the setting of borrower fees to 0. However this brings some limitations, as protocol may want to weaver any fees at one point but could not because of this situation.
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.