The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: high
Valid

Missing onlyManager access control in distributeAssets

Summary

In https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/LiquidationPool.sol#L205, there is no onlyManager permission check. Therefore anyone can choose to call distributeAssets and arbitrarily specify a malicious collateralRate and _hundredPC.

Vulnerability Details

Below is the function signature of distributeAssets

function distributeAssets(ILiquidationPoolManager.Asset[] memory _assets, uint256 _collateralRate, uint256 _hundredPC) external payable {

Observe no onlyManager permission check, so any user can specify _hundredPC of 0. What happens?

The costOfEuros to burn is 0, because anything multiplied by 0 is still 0:

https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/LiquidationPool.sol#L220C25-L221C60

uint256 costInEuros = _portion * 10 ** (18 - asset.token.dec) * uint256(assetPriceUsd) / uint256(priceEurUsd)
* _hundredPC / _collateralRate;

Therefore 0 EUROs are burnt and meanwhile we are distributing the collateral to users of the LP and therefore the EUROs are no longer backed by the collateral. This causes EURO depegging.

Impact

EURO depegging.

Tools Used

Manual Review

Recommendations

Add onlyManager permission check to distributeAssets function. This function is only meant to be called by the LP manager in https://github.com/Cyfrin/2023-12-the-standard/blob/main/contracts/LiquidationPoolManager.sol#L80

Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

distributeAssets-issue

Support

FAQs

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