LOW-40 fix incomplete: a 1-atom requestRedeem naming another controller hides its funded USDG from redeem / withdraw
The requestRedeem function only authorises the share owner, so anyone holding a single share atom can name an unrelated address as controller and plant a one-atom request at the head of that address's redemption queue. Once that atom settles as a zero-value refund, the victim's standard redeem and withdraw calls revert and their maxRedeem and maxWithdraw read zero even though their own later request is fully funded.
- Disclosed after under an hour
#99463 [SC-Low] LOW-40 fix incomplete: a 1-atom requestRedeem naming another controller hides its funded USDG from redeem / withdraw
Submitted on Nov 13th 2026 at 19:08:41 UTC by @Lester for Audit Competition | Plether
- Report ID: #99463
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/TrancheVault.sol
- Impacts:
- Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Brief/Intro
The fix of Cecuro LOW-39 / LOW-40 (commit d757d0b1, PR #123) states its purpose in the vault's interface and in the audit comments:
IAsyncTrancheVault.sol:12-14: "Deposit claims and redemption cancellations/refunds require receiver == controller, including zero-share acknowledgements, so share delivery cannot impose another account's cooldown or depend on an unsolicited receiver balance."- LOW-40 comment: "A controller therefore cannot use these paths to send unsolicited shares and impose a cooldown on an unrelated empty address."
- LOW-39 comment: "Eligibility no longer depends on the receiver's share balance, so unsolicited dust cannot disable the supported self-delivery path."
- The project's own tests:
test_ThirdPartyRedeemZeroCannotResetCooldown,test_ThirdPartyWithdrawZeroCannotResetCooldown("Zero redeem must not reset cooldown", "Alice should retain request capacity"),test_ControllerClaimSurvivesUnsolicitedShareDust. CANONICAL_ENTRYPOINTS.md:191-192: "A holder callsrequestRedeem(shares, controller, owner); funded requests are exposed bypendingRedeemRequest/claimableRedeemRequestand claimed through ERC-4626redeemorwithdraw."
The fix restricted the receiver of claims, cancellations and refunds. The controller argument of requestRedeem was left as it was: the function authorises only the share owner, and appends the request to the claim queue of whatever controller the caller names.
// TrancheVault.sol:606-632 (requestRedeem): the only authorisation is for `owner`
if (msg.sender != owner && !isOperator[owner][msg.sender]) {
_spendAllowance(owner, msg.sender, shares);
}
_transfer(owner, address(this), shares);
requestId = _enqueueRedeemRequest(shares, controller);
// TrancheVault.sol:701-704 (_enqueueRedeemRequest)
RedeemPosition storage position = redeemRequests[controller][requestId];
if (!position.queued) {
_appendControllerRedeem(controller, requestId);
}
// TrancheVault.sol:1006-1012, 1299-1311: the standard claims and limits read only the head of that queue
return _claimRedeem(controllerRedeemHead[controller], shares, receiver, controller);
uint256 requestId = controllerRedeemHead[controller];
return requestId == 0 ? 0 : claimableRedeemRequest(requestId, controller);
// TrancheVault.sol:942-945 (claimRedeemRefund, the only call that removes a refunded head)
if (shares != 0) {
lastDepositTime[receiver] = block.timestamp;
_transfer(address(this), receiver, shares);
}
So an account that holds one share atom (about 0.000000001 USDG) can do the following with two transactions and no approval of any kind by the LP: move the atom to a second address, and from there call requestRedeem(1, LP, secondAddress). The request is now the head of the LP's claim queue. One atom quotes to zero assets, so the next settlement turns that epoch into a zero-value refund. From then on, measured in the PoC:
- The LP's own later request is funded as usual (49,999.999982 USDG held for it in the vault's escrow, the same amount as in the reference run), but
maxRedeem(LP)andmaxWithdraw(LP)are 0 andredeem/withdrawrevert withERC4626ExceededMaxRedeem(LP, shares, 0)/ERC4626ExceededMaxWithdraw(LP, assets, 0). Unchanged after 24 hours and after 30 days. No other account can remove the head (NotControllerOrOperator). - The only call that removes the head is the LP's own
claimRedeemRefund. It delivers the other account's atom to the LP and restarts the LP's one-hour cooldown on its whole remaining balance:requestRedeemrevertsDepositCooldown,transferrevertsTransferDuringCooldown, the limit is 0 at 3,599 s and free at 3,600 s, and the LP's remaining 50 % is funded 3,600 s later than in the reference run. This is the end state the LOW-40 fix was written against, reached through the argument the fix did not touch. Cancelling the other account's request before it matures has the same effect on the cooldown. - A holder contract that uses only the standard ERC-7540 / ERC-4626 functions (
requestRedeem,redeem,withdraw) has 49,999.999996 USDG funded and cannot reach it: both claim functions revert at once, after 24 hours and after 30 days. The reference holder, same blocks, no such request, is paid byredeem(maxRedeem).
Ways out, stated as measured facts:
claimRedeem(requestId, shares, receiver, controller), the vault's explicit-id claim (documented in the interface, see "Payout paths the documents give a holder"), pays the funded amount in the funding block, 0 s later than the reference; an account that uses it and never removes the head loses nothing and waits for nothing (same total and same timing as the reference). The standard limits stay 0 for as long as the head is not removed.- An LP that requests (or moves to another wallet) its remaining shares before it removes the head keeps the reference timing; the cooldown then covers only the one atom.
- A holder contract that can call the standard
setOperatorgets out when an approved operator sendsclaimRedeem(requestId, ...)orclaimRedeemRefundfor it. A holder contract without that call has no call that reaches the funds.
The acting account gains nothing: its balances change by minus one share atom and zero USDG.
Vulnerability Details
Root cause
requestRedeem(shares, controller, owner) lets the share owner pick any address as controller (TrancheVault.sol:606-632; the authorisation at :625 is for owner only), and _enqueueRedeemRequest links the request into that controller's queue (:688-708, :1783-1797). The controller did nothing and approved nothing. The standard claim functions redeem / withdraw and the limits maxRedeem / maxWithdraw use controllerRedeemHead[controller] only (:998-1012, :1299-1311). A head that ended as a zero-value refund has no claimable shares, so they return 0 and revert, whatever is funded behind it. The head leaves the queue only through claimRedeemRefund (controller or its operator, receiver == controller), which writes lastDepositTime[controller] = block.timestamp when it returns a nonzero share amount (:916-947).
A request of one atom is accepted because a request of a wallet's whole requestable balance is exempt from the minimum size (:1611-1618); SECURITY.md:1409-1410 lists that exemption. That is why the atom is first moved to an address that holds nothing else.
The other account's request becomes a separate head only when its epoch is EARLIER than the LP's own request. In the same epoch it merges into the LP's own position, and in a later epoch it sits behind it; in both cases the standard claim pays (test 8). The request can be filed at any time before the LP's request, also against an address that holds nothing yet (test 4), and it stays until the controller acts.
The sibling request route does ask for the controller's authority: requestRedeemFromClaimableDeposit starts with _requireControllerAuth(controller) (:658), and CANONICAL_ENTRYPOINTS.md:193-195 says of it "The controller or its approved operator must call, the source lot's activation-aged cooldown must have elapsed, and the redemption keeps the same controller." requestRedeem has no such check.
Payout paths the documents give a holder
CANONICAL_ENTRYPOINTS.md:191-192names one claim route: "claimed through ERC-4626redeemorwithdraw". No.mdfile of the repository mentionsclaimRedeemor an explicit-id claim (searched all*.md).- The in-scope interface documents the second route:
IAsyncTrancheVault.sol:8-10"explicit-id claim methods preserve deterministic epoch selection for integrations", and:121-126onclaimRedeem: "Claims a specified share amount from one funded redemption request." - docs.plether.com ("Withdraw liquidity") describes the holder's step as the per-request action Move USDG to wallet ("These are separate owner-wallet transactions"); the public front end sends
claimRedeem(requestId, ...)for it.
So a funded request has two documented payout paths. The effect of this report is on the first one (redeem / withdraw, and the limits maxRedeem / maxWithdraw). The second one pays, and every statement about time below is given per path.
Why this is the open half of LOW-40 / LOW-39
The fix commit says: "Restrict deposit share claims and redemption cancellations/refunds to the controller (LOW-39 and LOW-40), preserving operator execution and USDC recipient selection." Its change in TrancheVault.sol:
- // With one cooldown timestamp per account, accepting unsolicited dust into an existing balance would let any
- // controller repeatedly lock that receiver's entire pre-existing balance. New receivers and self-claims are safe.
- if (receiver != controller && balanceOf(receiver) != 0) {
- revert TrancheVault__ThirdPartyDepositForExistingHolder();
+ // Keep share delivery independent of receiver balances and require the controller's authority over cooldowns.
+ if (receiver != controller) {
+ revert TrancheVault__ReceiverNotController();
requestRedeem and _enqueueRedeemRequest are outside the diff. On the path of this report the receiver IS the controller, so the new check passes, and the result is the one the removed comment describes: unsolicited dust delivered into an existing balance together with a cooldown on that whole balance. The difference from LOW-40, stated plainly: here the cooldown is written by the controller's own call (or its operator's), which is the call the interface comment prescribes for a refundable head (IAsyncTrancheVault.sol:8-10: "A rejected deposit or refundable redeem head must be cancelled or reclaimed before standard claims advance to a later request").
The sequence, cheapest form (test 1)
Junior vault; LP holds 100,000 USDG of shares, the other account 1,000 USDG; both past their cooldown; epoch e0, 300 s after its start.
- Other account, transaction 1:
juniorVault.transfer(secondAddress, 1). - Other account, transaction 2 (from the second address):
juniorVault.requestRedeem(1, LP, secondAddress). Request ide0+1;controllerRedeemHead(LP) == e0+1;pendingRedeemRequest(e0+1, LP) == 1. The LP's wallet shares and cooldown timestamp are unchanged. The other account cannot take the request back (NotControllerOrOperator). - Start of epoch
e0+1: the regular permissionless settlement processes that epoch as a zero-value refund (redeemRefundPending(e0+1, LP), 1 refundable share atom). - 300 s later the LP requests redemption of half its shares (request id
e0+2); the head stayse0+1. - Start of epoch
e0+2: settlement funds the LP's request:claimableRedeemAssets(e0+2, LP)= 49,999.999982 USDG,withdrawalEscrowAssets= the same amount.maxRedeem(LP) == 0,maxWithdraw(LP) == 0,redeemandwithdrawrevert. - The LP calls
claimRedeemRefund(e0+1, LP, LP): it receives the atom,lastDepositTime(LP)becomes the current time,maxRedeem/maxWithdrawshow the funded claim andredeempays 49,999.999982 USDG.maxRequestRedeem(LP)is 0 for the next 3,599 s; the remaining half is requested at 3,600 s, joins epoche0+4instead ofe0+3, and is funded 3,600 s later than in the reference (total paid 99,999.999946 USDG against 99,999.999955 USDG).
Gas of the two transactions of the other account: 79,858 and 439,702 (each sent as its own transaction); of the LP's cleanup: 169,466.
Other measurements
- Repeated form (test 2): the other account files one 1-atom request 300 s into each of 26 epochs; the LP wants to exit 1/30 of its position every hour. An LP that removes the head before it requests gets none of 26 requests through (each reverts
DepositCooldown; 0 USDG paid against 83,333.333160 USDG in the reference; its limit is free at each epoch boundary and 0 at +300 s, +1,800 s and +3,599 s). An LP that requests first and removes the head afterwards is paid exactly as the reference (one cleanup; the later atoms merge into its own positions). An LP that never removes the head and claims by request id is paid exactly as the reference, withredeemreverting on each of its 25 funded claims. - No cap on queue entries (test 3): 30 epochs with one 1-atom request each (31 atoms), none of the LP's own. The LP's next request is funded (49,999.999852 USDG) and the standard limits are 0 until the LP has sent 30
claimRedeemRefundcalls (5,281,180 gas in total). Two requests in one epoch share one entry. The settlement in this test processes one zero-value epoch per regular call; the report does not rest on settlement work. - Holder contract (test 4): described above; the 1-atom requests were filed before the contracts held anything.
- Senior vault (test 6): the same form: 25,000.684935 USDG funded for the Senior LP, standard limits 0, both claims revert; cleanup restarts its cooldown (0 at 3,599 s, free at 3,600 s).
- Deposit side (test 5): a 1 USDG deposit request naming an address becomes the head of its deposit claims:
maxDepositshows 1 USDG instead of the address's own 10,000 USDG lot anddeposit(10,000 USDG)reverts. One extra standarddeposit(1 USDG)clears it, the cooldown timestamp is the same as in the reference, and the named address keeps the 1 USDG lot. No lasting effect on this side. - Funded-epoch variant (test 7): when the atom's epoch also holds a real request, the epoch is funded,
maxRedeemis 1 andmaxWithdrawis 0; the standardredeem(1)clears it with no cooldown change.
Preconditions and limits
- The acting account needs one share atom of the tranche and one spare address. No role, no approval, no price move, no timing against the LP beyond "an epoch earlier than the LP's request".
- The LP's funds are never lost and never priced differently. What is taken away is the standard claim route and, on cleanup, one hour of the remaining shares.
- An account that claims by request id (a documented path) is not delayed at all: 0 s in test 1, and the same 83,333.333160 USDG as the reference over 26 hours in test 2. The project's web front end (public
plether-apprepository) claims withclaimRedeem(requestId, ...), so its users receive funded USDG as usual; they would see the other account's request as an extra "Shares ready to return" item whose button restarts their cooldown (docs.plether.com, "LP troubleshooting": "Returning shares restarts the one-hour cooldown for every share in the wallet's position in that tranche."). - The cooldown on cleanup is avoidable by an LP that knows to request or move its remaining shares first.
- The freeze of a holder contract depends on that contract: with
setOperatorit ends when an operator acts; a contract with onlyrequestRedeem/redeem/withdrawhas no call that ends it. The contracts in the PoC are test contracts written for this report; no deployed integration was examined. - The spare address is one extra transfer made necessary by the minimum-size rule, not a use of many identities.
Impact Details
All 13 impact rows of the program, element by element, with the time assertion of the PoC next to each freezing row:
| program row (verbatim) | elements | met? test, value and time assertion |
|---|---|---|
| high | Temporary freezing of funds for at least 24 hours | (a) funds; (b) unavailable on every payout path of the holder; (c) at least 24 hours; (d) temporary | Holder contract limited to the standard functions (test 4): (a) 49,999.999996 USDG funded in escrow. (b), (c) asserted 86,400 s and 2,592,000 s after funding: redeem(maxRedeem) and withdraw(maxWithdraw) through the contract revert; the explicit-id claim, the refund call and a cancellation sent by its owner revert NotControllerOrOperator; 0 USDG paid. (d) nothing in the vault ends it by time; a holder with setOperator gets out when its owner approves an operator and that operator sends a non-standard call (asserted), so its length is then up to that owner; a holder without that call has no way out. Account that can send claimRedeem(requestId, ...): not met, paid 0 s after funding (test 1) |
| critical | Permanent freezing of funds | (a) funds; (b) cannot be moved; (c) permanently | (a), (b) as in the row above. (c) asserted to 2,592,000 s for a holder contract with no setOperator call (test 4, H1); the vault has no time-based release. Not met for a holder with setOperator (the operator's call pays, test 4, H2) or for an account that can send claimRedeem(requestId, ...) (0 s, test 1) |
| medium | Temporary freezing of funds for at least 1 hour | (a) funds; (b) unavailable; (c) at least 1 hour | Holder that follows the redeem / withdraw path and therefore removes the head first: the funded half is paid 0 s after funding; its remaining shares (50,000 USDG) are closed on both wallet paths, requestRedeem (DepositCooldown) and transfer (TransferDuringCooldown), asserted at 0 s and at 3,599 s after the cleanup, open at 3,600 s, and funded 3,600 s later than the reference (test 1; Senior limit 0 at 3,599 s, test 6); with a request of the other account in every epoch, 0 of 26 requests in 26 hours (test 2, A). Not met for an account that claims by request id and never removes the head (0 s; test 1, test 2 B), or that requests / moves its remaining shares before the cleanup (0 s; test 1, test 2 A') |
| medium | Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol) | (a) no profit motive; (b) damage to users, with a number | (a) met: the acting account's balances change by -1 share atom and 0 USDG; its cost is 2 transactions, 519,560 gas (79,858 + 439,702) (test 1). (b) for a holder on the redeem / withdraw path, in the cheapest scenario of the other account: maxRedeem / maxWithdraw 0 and both claims reverting with 49,999.999982 USDG funded; 1 extra transaction (claimRedeemRefund, 169,466 gas); the remaining 50,000 USDG funded 3,600 s later (test 1). After 30 epochs: 30 extra transactions, 5,281,180 gas (test 3). For a holder on the explicit-id path: 0 s and no extra transaction (claimRedeem 197,104 gas against 194,453 for the reference redeem) |
| low | Contract fails to deliver promised returns, but doesn't lose value | (a) a documented promise is not delivered; (b) no value is lost | (a) met: "claimed through ERC-4626 redeem or withdraw" and "share delivery cannot impose another account's cooldown" (tests 1, 4, 6). (b) met: totals equal the reference in the ways out (99,999.999955 USDG, test 1) |
| critical | Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield | funds end with another party | not met: nobody receives the LP's funds; the LP receives the atom |
| critical | Protocol insolvency | liabilities above assets | not met |
| high | Theft of unclaimed yield | yield ends with another party | not met |
| high | Permanent freezing of unclaimed yield | yield frozen | not met as yield: the amounts are principal redemptions |
| medium | Smart contract unable to operate due to lack of token funds | contract short of tokens | not met |
| medium | Theft of gas | - | not applicable |
| medium | Block stuffing | - | not applicable |
| medium | Unbounded gas consumption | gas without bound | not met: the cleanup is one bounded call per epoch entry (30 calls for 30 epochs, test 3) |
- Claimed row: Medium, "Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)". It is met for every kind of account that uses the documented
redeem/withdrawroute: the acting account spends one share atom and two transactions and gains nothing; the holder's standard limits are 0 and both standard claims revert while 49,999.999982 USDG is funded for it; the holder pays one extra transaction and has its remaining 50,000 USDG funded 3,600 s later (test 1). - The freezing rows, as measured. "Temporary freezing of funds for at least 24 hours" (High) is met for a holder contract limited to the vault's standard ERC-7540 / ERC-4626 functions: 49,999.999996 USDG funded and every payout path of that holder closed 86,400 s and 30 days after funding (test 4). Its way out is an approved operator that sends a non-standard call; a holder contract without
setOperatorhas none. For an account that can sendclaimRedeem(requestId, ...)no freezing row is met. - Cost and gain of the acting account: two transactions and one share atom; no gain. The program page compares cost and damage for no-profit findings ("spending USD 1 to cause USD 10 or less in damage is Griefing, while spending USD 1 to cause USD 100 or more in damage is not"). The cost here is one share atom and the gas of two transactions (79,858 and 439,702); the amount put out of reach of the standard functions is the controller's whole funded claim (49,999.999996 USDG in test 4).
- Likelihood: any share holder can do it to any address at any time, including before that address has a position.
Known-issue review
Sources searched (2026-11-13): the program page copy (known issues, out-of-scope list); packages/perps/SECURITY.md including "Known Limitations"; ACCOUNTING_SPEC.md, WHITEPAPER.md, CANONICAL_ENTRYPOINTS.md, README.md and the other package documents; the interface NatSpec; the Cecuro AI audit of 2026-10-26, the AI scan of 2026-10-15, the pre-audit report, the collaborative audit of 2026-05-12 and the Cantina report; the project's own tests and test map; git history; issues and pull requests of Plether-Fi/plether-core (bodies of #61, #62, #79, #123, #128); docs.plether.com; the public front-end repository.
Closest items and how they differ:
- Cecuro LOW-40 "Controller can force a zero-balance receiver into LP cooldown" and LOW-39 "Front-runner can block third-party vault share claims by dusting the receiver" (both Addressed, fix d757d0b1): the same two effects (another account's dust blocks a claim route; another account's dust ends in a cooldown), through the
receiverargument of claims, cancellations and refunds. This report is the path the fix left open: thecontrollerargument ofrequestRedeem. Program rule for fixed items: "a report on the same root cause is valid only if it shows that the fix at commit a82d4fefb02768e5b3bddcc97dee371eee24fea8 is incomplete or introduces a new bug." IAsyncTrancheVault.sol:8-10: "Standard ERC-7540 claims consume the controller's oldest outstanding request. A rejected deposit or refundable redeem head must be cancelled or reclaimed before standard claims advance to a later request; explicit-id claim methods preserve deterministic epoch selection for integrations." This documents head-first claims for a controller's requests. It does not say that an account with no authority over the controller can create that head, and the next sentences of the same comment say that share delivery "cannot impose another account's cooldown".SECURITY.mdKnown Limitations (:1396-1399,:1403-1414): "Redemption cancellation or terminal refund still begins a new cooldown when shares return to a wallet."; "Per-controller flooring can produce zero entitlement for a dust-sized request. A full-balance redemption bypasses the minimum request size"; "Zero-payout epochs can consume bounded settlement work and delay later epochs." These are the mechanisms for a holder's own request and for settlement work. None concerns a request that names another account as controller, the head of a controller's queue, or the standard claim limits.- Cecuro MED-24 "LP can delay other redeemers with zero-payout refund epochs" (program known issue): the same primitive (a 1-share request that becomes a zero-payout epoch) used against the settlement work budget of 16 epochs per call. This report does not use that effect: in the PoC every epoch boundary is settled by a regular call that processes one such epoch.
- Cecuro MED-29, MED-5, LOW-3, LOW-4, LOW-5, LOW-13, LOW-63, LOW-67 (rounding, partial claims, dust ownership, seed receiver): none has a request whose controller is not its owner. LOW-1 and LOW-43 note that a controller "can differ from the funding account"; neither is about the queue head.
- Pre-audit SC-H2 "Zero-Amount Withdraw/Redeem Can Perpetually Reset TrancheVault Cooldown and Lock Funds" (fixed in the earlier synchronous vault): the same class of effect on code that has since been replaced.
- The project's tests:
AsyncTrancheVaultAllocation.t.sol:231-249tests head-first claims with a controller's own two requests. No project test files arequestRedeemwhose controller is neither the owner nor an account that approved the caller; the test map states the limit of the redemption fixtures as "At most two epochs and one unfinished redemption per controller" (TEST_MAP.md:330). - AI scan, GitHub issues and pull requests, docs.plether.com: no item on a request made by another account in a controller's queue.
Recommended fix
Give the controller the authority over what enters its queue, in line with the LOW-40 fix ("require the controller's authority over cooldowns"): in requestRedeem, when controller != owner, require msg.sender == controller || isOperator[controller][msg.sender]. Alternatively, or in addition, let redeem / withdraw / maxRedeem / maxWithdraw pass over a head that is only refundable, and return refund shares of a request to the account that supplied them, so that removing such a head does not write the controller's cooldown.
References
- Code (pinned commit
a82d4fefb02768e5b3bddcc97dee371eee24fea8):packages/perps/src/TrancheVault.sol#L606-L632,#L688-L708,#L916-L947,#L998-L1012,#L1299-L1311,#L1611-L1628,#L1783-L1797;packages/perps/src/interfaces/IAsyncTrancheVault.sol#L7-L17,#L133-L137. - Fix commit of LOW-39 / LOW-40: d757d0b1 "fix(perps): resolve LP vault, tranche, and claim findings (#123)".
- Documents:
packages/perps/CANONICAL_ENTRYPOINTS.md:186-208;packages/perps/SECURITY.md:1396-1414;packages/perps/ACCOUNTING_SPEC.md:603-604;packages/perps/test/perps/TEST_MAP.md:222,:330; docs.plether.com "Withdraw liquidity", "LP troubleshooting". - Project tests:
test/perps/spec/lp/DepositCooldownBehavior.t.sol:199-232,test/perps/spec/lp/TrancheShareReceiver.t.sol:61-78,test/perps/spec/lp/AsyncTrancheVaultAllocation.t.sol:231-249.
Proof of Concept
Proof of Concept
Runnable Foundry test in the repository's own suite at the pinned commit. No in-scope contract is modified; the only mocks are the fixture's MockPyth and mock settlement token (outside the scope). No vm.store, no vm.etch, no protocol address impersonated, no position opened; Senior cap 40M / 80 %.
git clone --recurse-submodules https://github.com/immunefi-team/audit-comp-plether
cd audit-comp-plether
git checkout --detach a82d4fefb02768e5b3bddcc97dee371eee24fea8
git submodule update --init --recursive
# save the test below as packages/perps/test/PocS10_ForeignRedeemHead.t.sol
FOUNDRY_SPARSE_MODE=true forge test --root packages/perps --match-path 'test/PocS10_*' -vv # Foundry 1.5.1
No env vars or RPC needed. Expected: 8 passed; 0 failed (194 files, about 60 s cold). With --isolate every top-level call is its own transaction; the gas figures of the description are from that mode.
Accounts. Every vm.prank is for an account without any role: LP, LP2 (the LP and its second wallet), NEWLP, SLP (Senior LP), JB, SB, OTHER (the other account) with its spare addresses HELPER, HELPER2, BEN (owner of the holder contracts), OP (operator approved by holder H2), NOBODY, KEEPER (any caller: router.updateMarkPrice, pool.settleLpEpoch(0, 0)). The test contract owns the fixture and acts only in setUp (deployment, the two 1 USDG seeds, _setSeniorCapacity); in the tests it only mints mock USDG to depositors.
Setup (USDG): LP deposits 100,000 and JB 1,000 into Junior (request, settlement, claim); both are past the one-hour cooldown; the tests start 300 s into epoch e0.
Steps of the leading form (test 1)
JB:juniorVault.transfer(HELPER, 1).HELPER:juniorVault.requestRedeem(1, LP, HELPER)(ide0+1): head ofLP's queue.LPunchanged;JB: -1 share atom, 0 USDG.- Start of
e0+1: settlement turns the 1-atom epoch into a zero-value refund. 300 s laterLPrequests redemption of half its shares (ide0+2). - Start of
e0+2: 49,999.999982 USDG is funded forLP(reference: the same).maxRedeem(LP)=maxWithdraw(LP)= 0;redeem,withdrawrevert; unchanged after 24 hours and 30 days; nobody else can remove the head. - Ways out (snapshots): (a)
claimRedeem(e0+2, ...)pays in the funding block, total 99,999.999955 USDG and timing as the reference; (b)LPrequests its rest first, thenclaimRedeemRefund: as the reference; (c)LPmoves its rest toLP2first. - Main line:
LPcallsclaimRedeemRefund(e0+1, LP, LP)first: cooldown restarts;requestRedeemandtransferof the rest revert at 0 s and 3,599 s, open at 3,600 s; the rest is funded 3,600 s later than the reference; total 99,999.999946 USDG.
Other tests: 2 = 26 epochs, three ways the LP can act; 3 = 30 epochs,
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
Likely requestRedeem authorises only the share owner and lets the caller name any controller, so a request can be appended to a queue the caller has no authority over, and the standard claim path only reads the head of that queue.
Impact
A holder using the documented redeem and withdraw route has their funded claim blocked and, on cleanup, their remaining shares delayed by one hour, though funds are never lost and an account using the explicit-id claim is not delayed at all.
What the attacker needed
One share atom of the tranche; one spare address; request filed in an earlier epoch than victim's
The fix
requestRedeem should require the controller's authority, as the sibling requestRedeemFromClaimableDeposit already does, rather than only the share owner's.
How it was found
- The attacker transfers one share atom to a second address they control.
- From that second address the attacker calls requestRedeem naming the victim as controller, which becomes the head of the victim's queue.
- At the start of the next epoch the settlement turns that atom into a zero-value refund.
- The victim later requests redemption of half their shares, which gets funded, but the head stays the attacker's atom.
- The victim's maxRedeem and maxWithdraw read zero and redeem and withdraw revert.
- The victim calls claimRedeemRefund to clear the head, which restarts their one-hour cooldown on the remaining balance.
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.
A vault lets people queue up a withdrawal request. The queue is processed oldest first, and the standard withdraw button only looks at the oldest entry. The bug is that anyone can add a tiny entry to someone else's queue, because the code only checks who owns the shares being queued, not who the queue belongs to. That tiny entry sits at the front, resolves to nothing, and blocks the real withdrawal button until the victim manually clears it.
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.