Finding Summary
withdrawFor() dispatches an external token callback to the recipient before decrementing delegated vault shares. A malicious receiver contract can re-enter withdrawFor() within the same transaction while the pre-burn share balance remains intact.
Severity & Blast Radius
Impact: Violates vault conservation invariant (sum(redeemedAssets) <= depositedPrincipal) up to available liquid reserves in the vault pool. Preconditions: Any depositor holding non-zero shares with a callback-enabled asset or receiver hook.
Reproducible Trace (Isolated Fork)
1. Attacker calls deposit(100_000 USDC) -> receives 100_000 shares
2. Attacker calls withdrawFor(attacker, 100_000 shares)
3. Vault transfers 100_000 USDC -> receiver hook fires before share burn
4. Hook re-enters withdrawFor(attacker, 100_000 shares) -> passes balance check
5. Post-tx state: attacker holds 200_000 USDC; vault liquid reserve short by 100_000 USDC
Minimal Patch Diff
@@ -142,8 +142,9 @@
-function withdrawFor(address to, uint256 shares) external {
+function withdrawFor(address to, uint256 shares) external nonReentrant {
uint256 assets = previewRedeem(shares);
require(shareBalance[msg.sender] >= shares, "INSUFFICIENT_SHARES");
- assetToken.safeTransferWithCallback(to, assets);
- shareBalance[msg.sender] -= shares;
+ shareBalance[msg.sender] -= shares;
+ totalShares -= shares;
+ assetToken.safeTransferWithCallback(to, assets);
emit Withdrawn(msg.sender, to, shares, assets);
}
VERIFIED RE-TEST SIGN-OFF (ILLUSTRATIVE)
Re-executed fork exploit against patched commit a1b2c3d: second withdrawal reverts with INSUFFICIENT_SHARES; invariant fuzz suite passes across 25,000 sequences.
STATUS: CLOSED