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 Mar 3, 2024. It is now read-only.
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Lender can front run Borrowers's rollLoan() transaction by monitoring mem-pool that will cause loss to Borrower unknowingly.
Vulnerability Detail
1 - Borrower had taken a loan of 1000 DAI with loanToCollateral = 300 * 1e18 locking 3.33 Collateral tokens.
2 - Lender calls provideNewTermsForRoll() with old loanToCollateral = 300 * 1e18 so that Borrower will not need to lock additional collateral in order to rollLoan().
3 - Borrower decides to call rollLoan() and submits transaction.
4 - Malicious lender who was monitoring mem-pool for Borrower's rollLoan() transaction see the rollLoan() transaction.
5 - Lender submits provideNewTermsForRoll() with loanToCollateral = 100 * 1e18 with higher gas fees so that his transaction executes before Borrower's rollLoan().
6 - Now in rollLoan(), newCollateralFor() with new loanToCollateral value will return (10 * 1e18 - 3.33 * 1e18) = 6.67 * 1e18 meaning Borrower has to lock 6.67 * 1e18 collateral tokens in order to rollLoan().
7 - Assuming that Borrower back in some time had max approved collateral tokens to Cooler, the Cooler can pull 6.67 * 1e18 collateral tokens from Borrower, causing loss to Borrower.
if (newCollateral >0) {
collateral().safeTransferFrom(msg.sender, address(this), newCollateral);
}
A rollLoan() operation that required no new collateral to roll the loan will end up pulling X-amount of tokens depending on loanToCollateral value causing Borrower to lose collateral tokens unknowingly.
sherlock-admin
changed the title
Cold Rusty Chameleon - rollLoan() can be front-run by malicious Lender
harisnabeel - rollLoan() can be front-run by malicious Lender
Sep 12, 2023
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` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
harisnabeel
high
rollLoan() can be front-run by malicious Lender
Summary
Lender can front run Borrowers's rollLoan() transaction by monitoring mem-pool that will cause loss to Borrower unknowingly.
Vulnerability Detail
1 - Borrower had taken a loan of 1000 DAI with loanToCollateral = 300 * 1e18 locking 3.33 Collateral tokens.
2 - Lender calls provideNewTermsForRoll() with old loanToCollateral = 300 * 1e18 so that Borrower will not need to lock additional collateral in order to rollLoan().
3 - Borrower decides to call rollLoan() and submits transaction.
4 - Malicious lender who was monitoring mem-pool for Borrower's rollLoan() transaction see the rollLoan() transaction.
5 - Lender submits provideNewTermsForRoll() with loanToCollateral = 100 * 1e18 with higher gas fees so that his transaction executes before Borrower's rollLoan().
6 - Now in rollLoan(), newCollateralFor() with new loanToCollateral value will return (10 * 1e18 - 3.33 * 1e18) = 6.67 * 1e18 meaning Borrower has to lock 6.67 * 1e18 collateral tokens in order to rollLoan().
7 - Assuming that Borrower back in some time had max approved collateral tokens to Cooler, the Cooler can pull 6.67 * 1e18 collateral tokens from Borrower, causing loss to Borrower.
References:
https://github.com/sherlock-audit/2023-08-cooler/blob/main/Cooler/src/Cooler.sol#L282C17-L282C17
https://github.com/sherlock-audit/2023-08-cooler/blob/main/Cooler/src/Cooler.sol#L192
https://github.com/sherlock-audit/2023-08-cooler/blob/main/Cooler/src/Cooler.sol#L199
https://github.com/sherlock-audit/2023-08-cooler/blob/main/Cooler/src/Cooler.sol#L211
Impact
A rollLoan() operation that required no new collateral to roll the loan will end up pulling X-amount of tokens depending on loanToCollateral value causing Borrower to lose collateral tokens unknowingly.
Code Snippet
Tool used
Manual Review
Recommendation
Take input the parameters of new terms from Borrower and validate that it matches with loan.request params set by Lender like below:
Duplicate of #243
The text was updated successfully, but these errors were encountered: