Liquid Staking

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

First Depositor Loses Tokens Due to Inflation Attack Protection Mechanism

Summary

The StakingPool contract imposes an extra cost on the first depositor through an inflation protection mechanism. This occurs when the totalShares is zero, causing the first depositor to lose a portion of their tokens due to the deduction of DEAD_SHARES. While this mechanism prevents inflation attacks, it unfairly burdens the first depositor with a token loss.

Vulnerability Details

When a user deposits into the StakingPool (via PriorityPool), the protocol mints an equivalent amount of Liquid Staking Tokens (LST) by calling the StakingPool::_mint function. However, if totalShares is zero, the first depositor’s token amount is reduced by a predefined value known as DEAD_SHARES, which is deducted from the user's deposit.

This behavior is illustrated in the following code:

function _mintShares(address _recipient, uint256 _amount) internal {
require(_recipient != address(0), "Mint to the zero address");
if (totalShares == 0) {
shares[address(0)] = DEAD_SHARES;
totalShares = DEAD_SHARES;
_amount -= DEAD_SHARES;
}
totalShares += _amount;
shares[_recipient] += _amount;
}

While the mechanism is intended to prevent inflation attacks, the implementation results in the first depositor being penalized by losing part of their tokens.

Impact

The first depositor suffers a loss of shares due to the incorrect implementation of the inflation protection mechanism. This creates an unfair situation where one user bears the full cost of protecting the protocol from inflation.

Tools Used

Manual

Recommendations

Refactor the inflation attack protection mechanism to ensure that the burden of DEAD_SHARES is distributed more equitably among users or covered by the protocol itself, rather than penalizing the first depositor.

Updates

Lead Judging Commences

inallhonesty Lead Judge 10 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.