You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2023. It is now read-only.
github-actionsbot opened this issue
Jan 27, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
There is no restriction on how much a user should set his interest so it can be 0 or 100%. If the user set his interest 0. For example, he offered 52 USDC as collateral for 50 USDT but with an interest of 0 for 1 day. There is a high probability that it would be cleared as a lender will get 52 USDC if the user failed to send the USDT.
Vulnerability Detail
When a user calls the roll they have to add more collateral, however here is the problem. If the interest is 0. Then loan.amount will be equal to req.amount. So the function: collateralFor(loan.amount,req.loanToCollateral) will be equal to collateralFor(req.amount,req.loanToCollateral) .
In the roll function, the new collateral is calculated as follows:
So collat will be equal to collateralFor(loan.amount, req.loanToCollateral) which results that newCollateral = 0. Interest will be 0, so only the expiry data will be expanded.
Impact
Able to expand from time to year before the user notice and make rolls off.
Scenario:
User A add collateral 100 USDC for 50 USDT for 10 days with 0%
User B cleared the request as he may get double if the user failed to give back 50 USDT.
User A call the roll 100 times since he is adding 0 collateral.
Now the expiry data is after 1000 days, even if the lender decided to make the roll off he must wait 1000 days, without getting no more collateral.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
ali_shehab
high
Expanding expiry time with 0 collateral
Summary
There is no restriction on how much a user should set his interest so it can be 0 or 100%. If the user set his interest 0. For example, he offered 52 USDC as collateral for 50 USDT but with an interest of 0 for 1 day. There is a high probability that it would be cleared as a lender will get 52 USDC if the user failed to send the USDT.
Vulnerability Detail
When a user calls the roll they have to add more collateral, however here is the problem. If the interest is 0. Then loan.amount will be equal to req.amount. So the function: collateralFor(loan.amount,req.loanToCollateral) will be equal to collateralFor(req.amount,req.loanToCollateral) .
In the roll function, the new collateral is calculated as follows:
In the clear the loan.collateral is calculated as follows:
So collat will be equal to collateralFor(loan.amount, req.loanToCollateral) which results that newCollateral = 0. Interest will be 0, so only the expiry data will be expanded.
Impact
Able to expand from time to year before the user notice and make rolls off.
Scenario:
Code Snippet
https://github.com/sherlock-audit/2023-01-cooler/blob/main/src/Cooler.sol#L177
https://github.com/sherlock-audit/2023-01-cooler/blob/main/src/Cooler.sol#L139
Tool used
Manual Review
Recommendation
Duplicate of #215
The text was updated successfully, but these errors were encountered: