If market price of collateral falls drastically over short time, existing offers can be exploited by a malicious borrower
Summary
Signed offers are off-chain and come with an expirationDate beyond which such offers automatically cease to exist.
A malicious borrowing bot that tracks sudden & significant price drops can use slightly stale offers & manipulate the loan duration to cause losses to unsuspecting lenders.
Lack of checks at a protocol level while creating new loans exposes lenders to large price movement risks.
Vulnerability Detail
Signed offer can be used multiple times until time exceeds expirationDate. Current documentation says:
In case of rapidly changing market conditions, we see the ability of the lender to revoke its token approvals to kairos as a mean of last resort to delete all its loan offers.
On the day of FTX crash, price of BAYC NFT in $USDC fell almost by 25% in a few hours. Combined effect of ETH price drop followed by panic selling by BAYC NFT holders meant that price drop in $USDC was much bigger over a short timespan.
Because offers are off-chain transactions & the fact that there is no direct way to emergency cancel outstanding offers, there is a high likelihood that current offers in such scenario are stale & don't reflect the immediate price movements.
A bot can be setup to monitor price changes & check for the presence of stale offers which can be combined to create an under-collateralised loan, i.e total amount borrowed > current market price of NFT right at loan origination.
Bot of-course takes the risk that prices recovers & lenders again become over-collateralized. To negate this risk, bot can exploit another aspect of current implementation, i.e. loan duration.
// the shortest duration offered among all offers used will be used to determine the loan end date.
if (arg.offer.duration < collatState.minOfferDuration) {
collatState.minOfferDuration = arg.offer.duration;
}
Malicious borrowing bot can double up as a lender by placing a dummy offer with 1 sec duration. By including this offer with other stale but genuine offers, bot can ensure that loan duration is extremely short (eg. 1 second). By doing this, loan immediately goes into an auction.
Since auction duration is relatively small (i.e 1-3 days), likelihood of price recovery during the period is relatively small. Borrower can simply default & keep his borrowing and if lucky, also get a share of liquidation proceeds.
Impact
Lenders risk taking under-collateralised lending positions as off-chain offers cannot keep up with on-chain price movements. Borrowers can immediately push loans into auction and force liquidations that are likely to cause losses to lenders.
Revoking approval for Kairos puts the complete onus on the lenders to protect themselves - lenders effectively have to keep continuously monitoring price movements and actively cut access to Kairos as fail safe. At the face of it, this looks impractical (commenting just based on docs & without knowing operational details).
Recommend that Kairos uses an oracle as a fail-safe & incase the highest LTV of all offers exceeds the current market price by a threshold level (say 50%), stop borrowers from utilising such offers by reverting. Most likely, they are stale offers that can create large losses to lenders.
0Kage
medium
If market price of collateral falls drastically over short time, existing offers can be exploited by a malicious borrower
Summary
Signed offers are off-chain and come with an
expirationDate
beyond which such offers automatically cease to exist.A malicious borrowing bot that tracks sudden & significant price drops can use slightly stale offers & manipulate the loan duration to cause losses to unsuspecting lenders.
Lack of checks at a protocol level while creating new loans exposes lenders to large price movement risks.
Vulnerability Detail
Signed offer can be used multiple times until time exceeds
expirationDate
. Current documentation says:In case of rapidly changing market conditions, we see the ability of the lender to revoke its token approvals to kairos as a mean of last resort to delete all its loan offers.
On the day of FTX crash, price of BAYC NFT in $USDC fell almost by 25% in a few hours. Combined effect of ETH price drop followed by panic selling by BAYC NFT holders meant that price drop in $USDC was much bigger over a short timespan.
Because offers are off-chain transactions & the fact that there is no direct way to emergency cancel outstanding offers, there is a high likelihood that current offers in such scenario are stale & don't reflect the immediate price movements.
A bot can be setup to monitor price changes & check for the presence of stale offers which can be combined to create an under-collateralised loan, i.e
total amount borrowed > current market price of NFT
right at loan origination.Bot of-course takes the risk that prices recovers & lenders again become over-collateralized. To negate this risk, bot can exploit another aspect of current implementation, i.e. loan duration.
In lines 60-63 of BorrowHandlers, we can see that loan duration is set to the lowest duration of all used offers
Malicious borrowing bot can double up as a lender by placing a dummy offer with
1 sec
duration. By including this offer with other stale but genuine offers, bot can ensure that loan duration is extremely short (eg. 1 second). By doing this, loan immediately goes into an auction.Since auction duration is relatively small (i.e 1-3 days), likelihood of price recovery during the period is relatively small. Borrower can simply default & keep his borrowing and if lucky, also get a share of liquidation proceeds.
Impact
Lenders risk taking under-collateralised lending positions as off-chain offers cannot keep up with on-chain price movements. Borrowers can immediately push loans into auction and force liquidations that are likely to cause losses to lenders.
Code Snippet
https://github.com/kairos-loan/kairos-contracts/blob/b2fd98d62cf0f25ee1db2bd551cd7b4606a5a988/src/BorrowLogic/BorrowHandlers.sol#L62
Tool used
Manual Review
Recommendation
Revoking approval for Kairos puts the complete onus on the lenders to protect themselves - lenders effectively have to keep continuously monitoring price movements and actively cut access to Kairos as fail safe. At the face of it, this looks impractical (commenting just based on docs & without knowing operational details).
Recommend that Kairos uses an oracle as a fail-safe & incase the highest LTV of all offers exceeds the current market price by a threshold level (say 50%), stop borrowers from utilising such offers by reverting. Most likely, they are stale offers that can create large losses to lenders.