Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

klaus - At claimDefaulted, the lender may not receive the token because the Unclaimed token is not processed #119

Open
sherlock-admin2 opened this issue Aug 28, 2023 · 2 comments
Labels
Has Duplicates A valid issue with 1+ other issues describing the same vulnerability High A valid High severity issue Reward A payout will be made for this issue Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed

Comments

@sherlock-admin2
Copy link
Contributor

sherlock-admin2 commented Aug 28, 2023

klaus

medium

At claimDefaulted, the lender may not receive the token because the Unclaimed token is not processed

Summary

claimDefaulted does not handle loan.unclaimed . This preventing the lender from receiving the debt repayment.

Vulnerability Detail

function claimDefaulted(uint256 loanID_) external returns (uint256, uint256, uint256) {
  Loan memory loan = loans[loanID_];
  delete loans[loanID_];

Loan data is deletead in claimDefaulted function. loan.unclaimed is not checked before data deletead. So, if claimDefaulted is called while there are unclaimed tokens, the lender will not be able to get the unclaimed tokens.

Impact

Lender cannot get unclaimed token.

Code Snippet

https://github.com/sherlock-audit/2023-08-cooler/blob/6d34cd12a2a15d2c92307d44782d6eae1474ab25/Cooler/src/Cooler.sol#L318-L320

Tool used

Manual Review

Recommendation

Process unclaimed tokens before deleting loan data.

function claimDefaulted(uint256 loanID_) external returns (uint256, uint256, uint256) {
+   claimRepaid(loanID_)
    Loan memory loan = loans[loanID_];
    delete loans[loanID_];
@github-actions github-actions bot added High A valid High severity issue Has Duplicates A valid issue with 1+ other issues describing the same vulnerability labels Sep 1, 2023
ohmzeus added a commit to ohmzeus/Cooler that referenced this issue Sep 5, 2023
Summary: At claimDefaulted, the lender may not receive the token because the Unclaimed token is not processed
Issue Link: sherlock-audit/2023-08-cooler-judging#119
Fix Description: Set amount and collateral to zero but do not delete loan struct.
@0xrusowsky 0xrusowsky added Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed labels Sep 9, 2023
@sherlock-admin sherlock-admin changed the title Wobbly Felt Rook - At claimDefaulted, the lender may not receive the token because the Unclaimed token is not processed klaus - At claimDefaulted, the lender may not receive the token because the Unclaimed token is not processed Sep 12, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Sep 12, 2023
@0xrusowsky
Copy link

0xrusowsky commented Sep 13, 2023

@jkoppel
Copy link
Collaborator

jkoppel commented Sep 20, 2023

Fix approved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Has Duplicates A valid issue with 1+ other issues describing the same vulnerability High A valid High severity issue Reward A payout will be made for this issue Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed
Projects
None yet
Development

No branches or pull requests

4 participants