Malicious Users Can Perpetually Lock `feeRecipient` Shares via Targeted Lockup Reset
The ShareManager.mint() function applies a targetLockup to all recipients, including the feeRecipient, and the lock resets on every mint. A malicious user can repeatedly trigger small fee mints to perpetually reset the feeRecipient's lock, preventing it from transferring or withdrawing its shares.
Source: https://github.com/sherlock-audit/2025-07-mellow-flexible-vaults-judging/issues/711
Found by
0x23r0, 0xc0ffEE, 7, Arav, dan__vinci, dimulski, klaus, lazyrams352, sakibcy
Summary
The protocol mints fee shares to the feeRecipient during deposits, redemptions, and protocol fee collection. However, the ShareManager.mint() function applies the targetLockup to all recipients, including the feeRecipient. Since this lock resets on every mint, a malicious user can repeatedly trigger minting operation and redeeming minimal amounts to continually reset the lock timer. As a result, the feeRecipient's shares remain perpetually locked and unusable, leading to a DOS where protocol fees become inaccessible.
Root Cause
The protocol mints shares to the feeRecipient address in three cases: deposit fees, redeem fees, and protocol fees. Each of these cases calls the mint function in the shareManager contract, which directly mints tokens to the feeRecipient address based on calculations from the FeeManager contract.
1. calculateDepositFee: Calculates the deposit fee in shares based on the amount.
2. calculateRedeemFee: Calculates the redeem fee in shares based on the amount.
3. calculateFee: Calculates the combined performance and protocol fee in shares.
{
IShareManager shareManager_ = vault_.shareManager();
uint256 shares = Math.mulDiv(assets, reducedPriceD18, 1 ether);
if (shares > 0) {
shareManager_.allocateShares(shares);
}
uint256 fees = Math.mulDiv(assets, priceD18, 1 ether) - shares;
if (fees > 0) {
@>> shareManager_.mint(feeManager.feeRecipient(), fees);
}
}
{
IFeeManager feeManager = IShareModule(vault_).feeManager();
uint256 fees = feeManager.calculateRedeemFee(shares);
if (fees > 0) {
@>> shareManager_.mint(feeManager.feeRecipient(), fees);
shares -= fees;
}
}
uint256 fees = feeManager_.calculateFee(address(this), asset, priceD18, shareManager_.totalShares());
if (fees != 0) {
@>> shareManager_.mint(feeManager_.feeRecipient(), fees);
}
However, the ShareManager contract includes a targetLockup() time flag that applies to each user individually after every mint. When shares are minted, the contract updates $.accounts[account].lockedUntil = lockedUntil, meaning the newly minted shares are locked for the targetLockup duration.
function mint(address account, uint256 value) public onlyVaultOrQueue {
if (value == 0) {
revert ZeroValue();
}
_mintShares(account, value);
ShareManagerStorage storage $ = _shareManagerStorage();
uint32 targetLockup = $.flags.getTargetedLockup();
if (targetLockup != 0) {
uint32 lockedUntil = uint32(block.timestamp) + targetLockup;
$.accounts[account].lockedUntil = lockedUntil;
emit Mint(account, value, lockedUntil);
} else {
emit Mint(account, value, 0);
}
}
If a user attempts an action (e.g., transfer or withdraw) before the lockedUntil time has passed, the transaction will revert with TargetedLockupNotExpired.
function updateChecks(address from, address to) public view {
ShareManagerStorage storage $ = _shareManagerStorage();
uint256 flags_ = $.flags;
AccountInfo memory info;
//..
if (block.timestamp < info.lockedUntil) {
revert TargetedLockupNotExpired(block.timestamp, info.lockedUntil);
}
//...
The result of this behavior is that all shares minted to the feeRecipient including protocol, deposit, and redeem fees are automatically subjected to the targetLockup time restriction defined in the ShareManager.
Because the mint() function enforces a lock on every recipient, the feeRecipient's newly minted shares become non-transferable and unusable until the lockup expires.
Internal Pre-conditions
N/A
External Pre-conditions
N/A
Attack Path
- Attacker deposits assets into the vault, receiving some amount of shares.
- The attacker waits until the
feeRecipient's lockup period is about to expire. - Just before it expires, the attacker redeems a small amount of shares.
- This redemption causes a small fee to be calculated and minted to the
feeRecipient, which resets its lock timer. - The attacker repeats steps 2–4, front-running any legitimate action from the
feeRecipientand indefinitely extending its lock period. - As a result, any attempt by the
feeRecipientto transfer, use, or withdraw funds will revert withTargetedLockupNotExpired.
Impact
A malicious user can perform a DoS attack on the feeRecipient by continuously resetting its lock timer.
Since the ShareManager.mint() function applies the targetLockup duration to every mint, including those for the feeRecipient, an attacker can repeatedly:
- Mint some amount of shares,
- Redeem small amounts each time the lockup duration expires,
- Cause the
ShareManagerto mint a fee to thefeeRecipient, - Which in turn resets the
lockedUntiltimestamp on thefeeRecipient.
This means that even after the lockup expires, the attacker can front-run any transaction involving the feeRecipient (e.g., transfer, withdraw, or claim) and extend its lock indefinitely.
As a result, the feeRecipient can be permanently prevented from using or moving its funds, effectively locking protocol fees forever.
PoC
No response
Mitigation
Skip applying the targetLockup when minting shares to the feeRecipient address.
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/mellow-finance/flexible-vaults/pull/19
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The mint function applies the targetLockup to every recipient, including the feeRecipient, and resets the lock on each mint without exempting the feeRecipient.
Impact
The feeRecipient's shares remain perpetually locked, so it cannot transfer, withdraw, or use protocol fees, effectively locking them forever.
What the attacker needed
Attacker has assets to deposit; attacker can redeem small amounts repeatedly; feeRecipient does not act before lock resets
The fix
The protocol team fixed this issue by skipping the targetLockup when minting shares to the feeRecipient address.
How it was found
- Attacker deposits assets into the vault and receives shares.
- Attacker waits until the feeRecipient's lockup is about to expire.
- Attacker redeems a small amount of shares, causing a small fee to be minted to the feeRecipient.
- The fee mint resets the feeRecipient's lock timer.
- Attacker repeats steps 2–4 to keep the lock active indefinitely.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When the vault earns fees, it gives new shares to a special address called the feeRecipient. Those shares are supposed to be locked for a short time, but the lock timer restarts every time new shares are minted. An attacker can keep causing tiny fee mints so the timer never runs out, meaning the feeRecipient can never use its shares.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.