Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M-02 MitigationConfirmed #97

Open
c4-bot-5 opened this issue May 24, 2024 · 2 comments
Open

M-02 MitigationConfirmed #97

c4-bot-5 opened this issue May 24, 2024 · 2 comments
Labels
confirmed for report This issue is confirmed for report mitigation-confirmed MR-M-02 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@c4-bot-5
Copy link
Contributor

Lines of code

Vulnerability details

C4 Issue

M-02: A malicious user can take on a loan using an existing borrower's collateral in refinanceFromLoanExecutionData()

Comments

Original vulnerabilities/impacts:
In refinanceFromLoanExecutionData(), no checks to ensure that _loan.borrower == _loanExecutionData.borrower. The attack vector is that a different borrower can receive loan principals using the existing loan borrower’s collateral.

Mitigation

Fix: https://github.com/pixeldaogg/florida-contracts/pull/359/files

//src/lib/loans/MultiSourceLoan.sol
    function _validateExecutionData(LoanExecutionData calldata _executionData, address _borrower) private view {
        if (msg.sender != _borrower) {
            _checkSignature(
|>              _borrower, _executionData.executionData.hash(), _executionData.borrowerOfferSignature
            );
        }
...

The mitigation is (1) use the existing loan borrower (_loan.borrower) as the borrower for the new loan and (2) _validateExecutionData() is re-written to check executionData’s signature against the passed borrower (loan.borrower). This ensures that if msg.sender is not the existing loan borrower, checkSignature() will correctly ensure that loanExecutionData is signed by the existing loan borrower (_loan.borrower).

The attack vector of a different borrower taking out a new loan from the existing loan borrower is eliminated. Only the existing loan borrower will take on the new loan. The issue is resolved.

Test

The revised test is passing

Conclusion

LGTM

@c4-judge
Copy link

c4-judge commented Jun 1, 2024

alex-ppg marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Jun 1, 2024
@c4-judge
Copy link

c4-judge commented Jun 1, 2024

alex-ppg marked the issue as confirmed for report

@c4-judge c4-judge added the confirmed for report This issue is confirmed for report label Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed for report This issue is confirmed for report mitigation-confirmed MR-M-02 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

2 participants