Liquid Staking

Stakelink
DeFiHardhatOracle
50,000 USDC
View results
Submission Details
Severity: high
Invalid

Absence of Merkle Root and IPFS Hash Validation in Distribution Process

Summary

The updateDistribution function in the PriorityPool contract lacks validation checks for the _merkleRoot and _ipfsHash parameters. This allows for the possibility of setting these values to zero, which can disrupt the distribution of staking tokens and potentially lead to unfair token allocation.

Vulnerability Details

The updateDistribution function does not include checks to ensure that _merkleRoot and _ipfsHash are non-zero values.

function updateDistribution(
bytes32 _merkleRoot,
bytes32 _ipfsHash,
uint256 _amountDistributed,
uint256 _sharesAmountDistributed
) external onlyDistributionOracle {
_unpause();
// Missing check non-zero value
depositsSinceLastUpdate -= _amountDistributed;
sharesSinceLastUpdate -= _sharesAmountDistributed;
merkleRoot = _merkleRoot;
ipfsHash = _ipfsHash;
merkleTreeSize = accounts.length;
emit UpdateDistribution(
_merkleRoot,
_ipfsHash,
_amountDistributed,
_sharesAmountDistributed
);
}

Impact

  • Without a valid Merkle root and IPFS hash, the distribution process is compromised. Users cannot claim their tokens.

  • The contract may require emergency intervention to correct the distribution data, leading to downtime and operational inefficiencies.

Tools Used

Manual review

Recommendations

Add validation checks to ensure that _merkleRoot and _ipfsHash are non-zero before updating the state.

function updateDistribution(
bytes32 _merkleRoot,
bytes32 _ipfsHash,
uint256 _amountDistributed,
uint256 _sharesAmountDistributed
) external onlyDistributionOracle {
_unpause();
+ require(_merkleRoot != 0, "Merkle root cannot be zero");
+ require(_ipfsHash != 0, "IPFS hash cannot be zero");
depositsSinceLastUpdate -= _amountDistributed;
sharesSinceLastUpdate -= _sharesAmountDistributed;
merkleRoot = _merkleRoot;
ipfsHash = _ipfsHash;
merkleTreeSize = accounts.length;
emit UpdateDistribution(
_merkleRoot,
_ipfsHash,
_amountDistributed,
_sharesAmountDistributed
);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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