Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

thekmj - Rollable loans can be indefinitely rolled, opening up room for a griefing attack that will permanently lock funds. #207

Closed
github-actions bot opened this issue Jan 27, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue

Comments

@github-actions
Copy link

github-actions bot commented Jan 27, 2023

thekmj

high

Rollable loans can be indefinitely rolled, opening up room for a griefing attack that will permanently lock funds.

Summary

If a loan is rollable, and if a malicious borrower has enough collateral, they can perform a griefing attack that creates a lesser-known type of bad debt for the lender: A debt that is technically not defaulted, but extends indefinitely.

Vulnerability Detail

Let us first note that rolling a loan does not turn off rolling capability. It also has no access control: Anyone can call this (however at the cost of their own funds).

https://github.com/sherlock-audit/2023-01-cooler/blob/main/src/Cooler.sol#L129-L147

Therefore, assuming an attacker has enough collateral, they can roll a cleared loan to an effectively infinite timestamp. The consequence is that, if the borrower defaults, the collateral is effectively locked within the contract, as the contract logic will not recognize a default for effectively an eternity, since the lender cannot resolve the defaulted loan.

Since loans are rollable by default, there is no way to prevent someone from clearing a loan as soon as it appears, and spam the griefing attack.

It is worth noting that, under special ERC20 tokens that don't revert on failed transfer, the attack can be done for free.

Impact

It is possible to lock collateral tokens indefinitely using rollable loans mechanism, as long as the collateral condition can be cleared (which has been shown to be possible).

Code Snippet

https://github.com/sherlock-audit/2023-01-cooler/blob/main/src/Cooler.sol#L129-L147

Tool used

Manual Review

Recommendation

Make rolling false by default, and turn off rolling capability after each successful roll.

Additionally, we recommend adding a sanity check to the loan duration, to prevent accidental lengthy loans.

Duplicate of #215

@github-actions github-actions bot added Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue labels Jan 27, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant