The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: low
Invalid

liquidateVault function will return wrong error message

Summary

Same validation fail will lead to different errors.

Vulnerability Details

In the liquidateVault function, a try/catch block is utilized.

function liquidateVault(uint256 _tokenId) external onlyLiquidator {
ISmartVault vault = ISmartVault(smartVaultIndex.getVaultAddress(_tokenId));
try vault.undercollateralised() returns (bool _undercollateralised) {
require(_undercollateralised, "vault-not-undercollateralised");
vault.liquidate();
IEUROs(euros).revokeRole(IEUROs(euros).MINTER_ROLE(), address(vault));
IEUROs(euros).revokeRole(IEUROs(euros).BURNER_ROLE(), address(vault));
emit VaultLiquidated(address(vault));
} catch {
revert("other-liquidation-error");
}
}

The problem lies in these require statements:

require(_undercollateralised, "vault-not-undercollateralised");

and

// @audit SmartVaultV3::liquidate()
require(undercollateralised(), "err-not-liquidatable");

As we can see, the validation is the same, while the error messages are different. Also the catch block is not supposed to be there as it will never be reached. That is because vault.liquidate() will never revert because the require above it has the same validation.

revert("other-liquidation-error");

Impact

Wrong error message will be thrown.

Tools Used

Manual Review

Recommendations

Remove the try/catch and the require.

function liquidateVault(uint256 _tokenId) external onlyLiquidator {
ISmartVault vault = ISmartVault(smartVaultIndex.getVaultAddress(_tokenId));
vault.liquidate(); // @audit here it will revert
IEUROs(euros).revokeRole(IEUROs(euros).MINTER_ROLE(), address(vault));
IEUROs(euros).revokeRole(IEUROs(euros).BURNER_ROLE(), address(vault));
emit VaultLiquidated(address(vault));
}
Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

informational/invalid

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.