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

H-16 MitigationConfirmed #94

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

H-16 MitigationConfirmed #94

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

Comments

@c4-bot-4
Copy link
Contributor

Lines of code

Vulnerability details

C4 Issue

H-16: validateOffer() reentry to manipulate exchangeRate

Comments

Original vulnerabilities:
_validateOfferExecution() will be called during loan initiation (emitLoan) for each offerExecution.

For each validateOfferExecution() call, there could be multiple external callbacks. In the first call back (validateOfferExecution() → ILoanManager(lender).validateOffer()), the outstanding values in the pool are modified but tokens are not transferred until after _validateOfferExecution() call.

Original impacts:
This allows later callbacks in _validateOfferExecution() to take advantage of the discrepancy in totalAssets() before/after the token transfer.

Mitigation

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

//src/interfaces/validators/IOfferValidator.sol
interface IOfferValidator {
    /// @notice Validate a loan offer.
    function validateOffer(IMultiSourceLoan.LoanOffer calldata _offer, uint256 _tokenId, bytes calldata _validatorData)
        external view;
}
...

The original attack is carried out in _checkValidators() → IOfferValidator(thisValidator.validator).validateOffer(). The mitigation is to disable IOfferValidator(thisValidator.validator).validateOffer() to trigger any state changes by restricting the interface validateOffer() view only.

This restricts runtime calls to be view only, eliminating the attack vector and resolve the issue.

Conclusion

LGTM

c4-bot-6 added a commit that referenced this issue May 24, 2024
@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 satisfactory

@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-H-16 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

2 participants