Targeted-lockup bypass: freshly minted shares can be transferred immediately in the same `transfer()` or `transferFrom()` call
Source: https://github.com/sherlock-audit/2025-07-mellow-flexible-vaults-judging/issues/617
Found by
rsam_eth
Summary
TokenizedShareManager is designed so that every newly minted share is subject to a per account targeted lock-up (lockedUntil = now + targetedLockup).
However, because TokenizedShareManager._update() calls claimShares(from) before executing the actual ERC-20 transfer, and because mint() sets lockedUntil after the prior lock check, a user who has any allocated (yet-unclaimed) shares can:
- trigger a mint via
claimSharesin the_updatefunction (through atransferortransferFrom), - have those shares credited to their balance, and
- pass them to another address in the same transaction,
all without ever being prevented by the lock-up.
Root Cause
function _update(address from, address to, uint256 value) internal override {
updateChecks(from, to); // ① lock check executes here
if (from != address(0)) {
claimShares(from); // ② mints & sets new lock, the updateChecks in next _update calls are
//bypassed since from is address(0) and to is the "from" here
}
if (to != address(0)) {
claimShares(to);
}
super._update(from, to, value); // ③ transfer executes after mint
}
claimShares(from) →mintAllocatedShares()→ mint() → ERC-20 _mint(), the new entered _update(address(0), from, value) passes the updateChecks for from because in the updateChecks → from == address(0) → the value parameter (in the first _update) is minted to from → in the shareManager::mint function (3rd step in the call flow) the lockedUntill is assigned:
https://github.com/sherlock-audit/2025-07-mellow-flexible-vaults/blob/main/flexible-vaults/src/managers/ShareManager.sol#L230-L233
if (targetLockup != 0) {
uint32 lockedUntil = uint32(block.timestamp) + targetLockup;
$.accounts[account].lockedUntil = lockedUntil;
emit Mint(account, value, lockedUntil);
}
Because the original updateChecks has already passed, the transfer that follows moves the just-minted shares out of the locked account.
Internal Pre-conditions
TokenizedShareManageroperates withtargetedLockup > 0.- from
holds ≥1allocated shares in any deposit queue.
External Pre-conditions
Attack Path
-
State before tx
lockedUntilfor Alice is in the past → she can transfer.- Alice owns 100 allocated shares (not yet active).
-
Alice calls
Solidity share.transfer(bob, 100); -
TokenizedShareManager._update(Alice → Bob)updateChecks(from, to)→ passes (lock expired).claimShares(from)is invoked.
-
Inside
claimShares(Alice)-
mintAllocatedShares(Alice, 100) -
mint()→_mintShares()→ ERC20_mint
triggers an inner_update(0 → Alice, 100)(no lock check). -
After
_mintreturns,mintsetsSolidity accounts[Alice].lockedUntil = block.timestamp + targetedLockup;
-
-
Return to outer
_updatesuper._update(Alice → Bob, 100)executes, moving the freshly minted shares to Bob.
-
Result
- Transaction succeeds.
- Bob receives 100 liquid shares immediately.
- Alice’s
lockedUntilis refreshed, but she now holds zero shares, so the lock is moot.
Impact
- Policy bypass: the intended cooling-off period on new shares is unenforced, if a user has allocated shares, then can just transfer them right away.
- Market risk: users can instantly sell or transfer what should have been time-locked shares.
PoC
No response
Mitigation
perform a second lock check, ensuring new shares cannot move until next tx.
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/mellow-finance/flexible-vaults/pull/19/files
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity business logic bug in Mellow Flexible Vaults. Sherlock made it public on 12 August 2025. Found in the 964 audit contest (finding M-6).
About Business logic
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.