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

Glamorous Admiral Sloth - validateLiquidationCall is wrongly implemented. #201

Open
sherlock-admin2 opened this issue Jan 22, 2025 · 0 comments

Comments

@sherlock-admin2
Copy link

Glamorous Admiral Sloth

Medium

validateLiquidationCall is wrongly implemented.

Summary

in the validateLiquidationCall we are not verifying the lower bound of the MINIMUM_HEALTH_FACTOR_LIQUIDATION_THRESHOLD as at the lower bound of the params.healthFactor it should also work.

Root Cause

https://github.com/sherlock-audit/2025-01-aave-v3-3/blob/main/aave-v3-origin/src/contracts/protocol/libraries/logic/ValidationLogic.sol#L244

require(

@>> vars.healthFactor > HEALTH_FACTOR_LIQUIDATION_THRESHOLD,
Errors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD
);

https://github.com/sherlock-audit/2025-01-aave-v3-3/blob/main/aave-v3-origin/src/contracts/protocol/libraries/logic/ValidationLogic.sol#L403
https://github.com/sherlock-audit/2025-01-aave-v3-3/blob/main/aave-v3-origin/src/contracts/protocol/libraries/logic/ValidationLogic.sol#L415
function validateLiquidationCall(
DataTypes.UserConfigurationMap storage userConfig,
DataTypes.ReserveData storage collateralReserve,
DataTypes.ReserveData storage debtReserve,
DataTypes.ValidateLiquidationCallParams memory params
) internal view {
ValidateLiquidationCallLocalVars memory vars;

(vars.collateralReserveActive, , , vars.collateralReservePaused) = collateralReserve
  .configuration
  .getFlags();

(vars.principalReserveActive, , , vars.principalReservePaused) = params
  .debtReserveCache
  .reserveConfiguration
  .getFlags();

require(vars.collateralReserveActive && vars.principalReserveActive, Errors.RESERVE_INACTIVE);
require(!vars.collateralReservePaused && !vars.principalReservePaused, Errors.RESERVE_PAUSED);

require(
  params.priceOracleSentinel == address(0) ||

@>> params.healthFactor < MINIMUM_HEALTH_FACTOR_LIQUIDATION_THRESHOLD ||
IPriceOracleSentinel(params.priceOracleSentinel).isLiquidationAllowed(),
Errors.PRICE_ORACLE_SENTINEL_CHECK_FAILED
);

require(
collateralReserve.liquidationGracePeriodUntil < uint40(block.timestamp) &&
debtReserve.liquidationGracePeriodUntil < uint40(block.timestamp),
Errors.LIQUIDATION_GRACE_SENTINEL_CHECK_FAILED
);

require(

@>> params.healthFactor < HEALTH_FACTOR_LIQUIDATION_THRESHOLD,
Errors.HEALTH_FACTOR_NOT_BELOW_THRESHOLD
);

Internal Pre-conditions

No response

External Pre-conditions

No response

Attack Path

No response

Impact

No response

PoC

No response

Mitigation

params.healthFactor <= MINIMUM_HEALTH_FACTOR_LIQUIDATION_THRESHOLD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant