Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: medium
Valid

Duplicate `Collateral.Data` struct causes admin configuration conflict

Summary

Collateral.Data information is saved in two locations. Protocol access this information from both places but admin can update only one of them resulting in a DoS for admin rights.

Vulnerability Details

Collateral data is handled by Collateral library and saved at COLLATERAL_LOCATION storage location. It is configured by MarketMakingEngineConfigurationBranch ::configureCollateral function and can be called multiple times by admin.

Same data structure is stored is Vault leaf and is part of the bigger vault's data struct stored at VAULT_LOCATION storage location.
It is initialized when the vault is created. If the vault exist this function can't be called again. The vault's self.collateral data can't be updated.

function create(CreateParams memory params) internal {
Data storage self = load(params.vaultId);
if (self.id != 0) {
revert Errors.VaultAlreadyExists(params.vaultId);
}
self.id = params.vaultId;
self.depositCap = params.depositCap;
self.withdrawalDelay = params.withdrawalDelay;
self.indexToken = params.indexToken;
@> self.collateral = params.collateral; // @audit set collateral data
self.depositFee = params.depositFee;
self.redeemFee = params.redeemFee;
self.engine = params.engine;
self.isLive = true;
}

Two critical information are accessed from colllateral.Data stored in vault:

In case admin wants to update priceAdapter (eg. in case of a vulnerability in existing adaptor) or to disable the collateral, he can't.
The protocol can reach a situation where an asset is disabled in market-making-engine (via configureCollateral) while is still active in a Vault.
Same for priceAdapter, it can have an adapter in a specific vault and a different adapter to be configured in engine for same asset.
In case of a vulnerable adaptor the vault must be shut down and re-created.

Impact

Key vault parameters are inaccessible for admin to update, resulting the relaunch the vault and the associated hassle.

Tools Used

Recommendations

There are two options. Either remove Collateral.data from Vault structure and update the code where required to interogate collateral data only from COLLATERAL_LOCATION.
Or, at least, add a new function (or update existing Vault::update) to allow admin to update these two parameters.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Duplicate `Collateral.Data` struct causes admin configuration conflict

Support

FAQs

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