Skip to content
Business logic Audit finding Intermediate

Targeted-lockup bypass: freshly minted shares can be transferred immediately in the same `transfer()` or `transferFrom()` call

rsam_eth Follow

Originally disclosed on Sherlock

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:

  1. trigger a mint via claimShares in the _update function (through a transfer or transferFrom),
  2. have those shares credited to their balance, and
  3. pass them to another address in the same transaction,

all without ever being prevented by the lock-up.

Root Cause

https://github.com/sherlock-audit/2025-07-mellow-flexible-vaults/blob/main/flexible-vaults/src/managers/TokenizedShareManager.sol#L46-L55

Solidity
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

Solidity
        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

  • TokenizedShareManager operates with targetedLockup > 0.
  • from holds ≥1 allocated shares in any deposit queue.

External Pre-conditions


Attack Path

  1. State before tx

    • lockedUntil for Alice is in the past → she can transfer.
    • Alice owns 100 allocated shares (not yet active).
  2. Alice calls

    Solidity
    share.transfer(bob, 100);
    
  3. TokenizedShareManager._update(Alice → Bob)

    1. updateChecks(from, to) → passes (lock expired).
    2. claimShares(from) is invoked.
  4. Inside claimShares(Alice)

    1. mintAllocatedShares(Alice, 100)

    2. mint() → _mintShares() → ERC20 _mint
      triggers an inner _update(0 → Alice, 100) (no lock check).

    3. After _mint returns, mint sets

      Solidity
      accounts[Alice].lockedUntil = block.timestamp + targetedLockup;
      
  5. Return to outer _update

    • super._update(Alice → Bob, 100) executes, moving the freshly minted shares to Bob.
  6. Result

    • Transaction succeeds.
    • Bob receives 100 liquid shares immediately.
    • Alice’s lockedUntil is refreshed, but she now holds zero shares, so the lock is moot.

Impact

  1. 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.
  2. 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

The original report as published on Sherlock, by rsam_eth. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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.

More from Mellow Flexible Vaults

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.