-
Notifications
You must be signed in to change notification settings - Fork 0
Allarious - It is possible to inject roll
transactions between clear
and toggleRoll
#78
Comments
Escalate for 11 USDC This issue is marked as a duplicate for #215, while it points out to a couple more issues. I believe these issues are not separate and stem from how the protocol chooses to handle rolling, which can happen more efficiently. #21: Is discussed in "Attack from lender to borrower" section I would appreciate your reconsideration on this, since the duplicate marked covers much less area that this issue. While one might be argued that the issue should be broken down, I believe that all of these come from the same reason and can be handled all together, therefore listing them as one "high" issue. |
You've created a valid escalation for 11 USDC! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
Escalation rejected Issue #21 is not a valid issue. |
This issue's escalations have been rejected! Watsons who escalated this issue will have their escalation amount deducted from their next payout. |
Allarious
high
It is possible to inject
roll
transactions betweenclear
andtoggleRoll
Summary
Since
rollable
is by default true for all loan positions, attacker can immediately act after theclear
transaction toroll
as many times he needs.Vulnerability Detail
Attack from borrower to lender
When a lender wants to clear a position and calls the clear function with enough allowance for the contract, the related request for borrow clears and the money gets transferred from the lender to the borrower. However, the
rollable
value istrue
by default which allows anyone in the network, specifically theowner
of theCooler
contract to act and roll as many times as needed. This way, the owner of the contract can have an "Option" to trade any amounts of loan with collateral for an arbitrary amount of time. In finance, an option position should be bought by an agreement between two parties but here, borrower can force this option to the lender immediately after the clear transaction.Attack from lender to borrower
In this version, if the lender finds the interest rate good enough, can call the
roll
function just after theclear
function and pay the collateral for interest added to extend the duration and interest rate on the amount as many times as he wants. This is dangerous since if an interest gets too high to an extent that the borrower can not pay theamount + added interest
, the position defaults and the lender gets all the collateral spent + the initial collateral by the borrower.Impact
https://github.com/sherlock-audit/2023-01-cooler/blob/main/src/Cooler.sol#L129-L147
https://github.com/sherlock-audit/2023-01-cooler/blob/main/src/Cooler.sol#L177
Code Snippet
Tool used
Manual Review
Recommendation
It would be a good idea to limit the borrower to be able to roll at most once or
MAX_ROLL_ATTEMPTS
inside eachduration
.Lender should be able to set the default value for the
rollable
. Otherwise, lender needs to use a contract likeClearingHouse
that callsclear
andtoggleRoll
atomically.Duplicate of #215
The text was updated successfully, but these errors were encountered: