TrancheVault.requestRedeem lets any share owner name another account as controller, so a 1 wei request blocks that account's redeem and withdraw until it claims a refund that restarts its cooldown
The requestRedeem function accepts any non-zero controller address without checking that the controller consented, so an attacker can queue a 1 share-wei redemption under a victim's account. That dust request becomes the head of the victim's claim list, making the standard redeem, withdraw, maxRedeem and maxWithdraw calls revert or return zero until the victim claims the refund, which restarts a one hour cooldown on its whole balance.
Originally disclosed on Immunefi
- Disclosed after under an hour
#99982 [SC-Low] TrancheVault.requestRedeem lets any share owner name another account as controller, so a 1 wei request blocks that account's redeem and withdraw until it claims a refund that restarts its cooldown
Submitted on Nov 16th 2026 at 00:12:28 UTC by @hybridthegeek for Audit Competition | Plether
- Report ID: #99982
- 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
TrancheVault is the ERC-7540 vault that holds pending LP deposits and funded withdrawals for the Senior and Junior tranches. requestRedeem(shares, controller, owner) checks only the share owner and accepts any non-zero controller, so any LP can add a redemption request to another account's claim list without that account's consent. A request of 1 share wei, placed in an epoch with no other redeemer, is refunded at settlement and then stays at the head of the victim's list. While it is there, the victim's redeem, withdraw, maxRedeem and maxWithdraw revert or return 0 for every later funded redemption. The only call that removes it, claimRedeemRefund, delivers the stranger's share to the victim and restarts the victim's one hour cooldown on its whole balance.
No privileged role is involved. No USDG is lost, and the victim can still be paid in full through the non-standard claimRedeem(requestId, ...). I am reporting this as griefing, not as a freeze.
Vulnerability Details
1. The request names a controller that never agreed. The owner side is fully checked (cooldown, balance, allowance or operator). The controller is only checked for the zero address, and the position is then queued under it.
// packages/perps/src/TrancheVault.sol:611-630
if (controller == address(0) || owner == address(0)) {
revert TrancheVault__ZeroAddress();
}
if (shares == 0) {
revert TrancheVault__WithdrawalTooSmall();
}
if (block.timestamp < lastDepositTime[owner] + DEPOSIT_COOLDOWN) {
revert TrancheVault__DepositCooldown();
}
uint256 maxShares = maxRequestRedeem(owner);
if (shares > maxShares) {
revert TrancheVault__ExceededMaxRequestRedeem(owner, shares, maxShares);
}
_requireMinimumRedeemSize(shares, maxShares);
if (msg.sender != owner && !isOperator[owner][msg.sender]) {
_spendAllowance(owner, msg.sender, shares);
}
_transfer(owner, address(this), shares);
requestId = _enqueueRedeemRequest(shares, controller);
_enqueueRedeemRequest (packages/perps/src/TrancheVault.sol:688-708) appends the epoch to the controller's linked list when the controller has no position in that epoch yet.
2. A 1 wei request is legal. The minimum size is waived when the request is the owner's whole balance, so an address that holds exactly 1 share wei can redeem it.
// packages/perps/src/TrancheVault.sol:1611-1618
function _requireMinimumRedeemSize(
uint256 shares,
uint256 maxShares
) internal view {
if (estimateRedeemAssets(shares) < POOL.minTrancheDepositAssets() && shares < maxShares) {
revert TrancheVault__WithdrawalTooSmall();
}
}
An attacker reaches that state by depositing the 1 USDG minimum, waiting out its own cooldown, and transferring 1 share wei to a second address it controls.
3. Settlement refunds the dust epoch instead of funding it. When the head redemption epoch of a tranche quotes to zero assets and nothing was funded earlier in the same call, HousePool refunds the remainder and marks the epoch refundable (packages/perps/src/HousePool.sol:957-987). One share wei is worth 0 USDG atoms, so an epoch that contains only the planted request always takes this branch.
4. Standard claims and views read only the head of the controller's list.
// packages/perps/src/TrancheVault.sol:998-1012
function withdraw(
uint256 assets,
address receiver,
address controller
) public override returns (uint256 shares) {
return _claimWithdraw(controllerRedeemHead[controller], assets, receiver, controller);
}
function redeem(
uint256 shares,
address receiver,
address controller
) public override returns (uint256 assets) {
return _claimRedeem(controllerRedeemHead[controller], shares, receiver, controller);
}
maxWithdraw and maxRedeem do the same (packages/perps/src/TrancheVault.sol:1299-1311). The refunded head has no funded shares, so both views return 0 and _claimRedeem reverts ERC4626ExceededMaxRedeem(controller, shares, 0) (packages/perps/src/TrancheVault.sol:1158-1162). A later epoch that is fully funded for the victim does not move the head.
5. The only way to remove the head restarts the victim's cooldown. A refundable position leaves the list only when refundClaimed is set (packages/perps/src/TrancheVault.sol:1216-1227), and only claimRedeemRefund sets it. That function requires the controller or its operator, requires the receiver to be the controller, and stamps the receiver's cooldown whenever the refund is not zero.
// packages/perps/src/TrancheVault.sol:927-945
if (!epoch.refundEnabled || position.refundClaimed || position.shares == 0) {
revert TrancheVault__RedeemRefundUnavailable();
}
shares = refundableRedeemRequest(requestId, controller);
_requireShareReceiver(controller, receiver);
position.refundClaimed = true;
epoch.refundBasisClaimed += position.shares;
if (shares != 0) {
position.refundedShares += shares;
epoch.refundedShares += shares;
pendingRedeemEscrowShares -= shares;
}
_maybeProcessRedeemFunding(controller, requestId);
_sweepRedeemRefundDust(epoch);
_maybeCloseRedeemPosition(controller, requestId);
if (shares != 0) {
lastDepositTime[receiver] = block.timestamp;
_transfer(address(this), receiver, shares);
}
DEPOSIT_COOLDOWN is 1 hour (packages/perps/src/TrancheVault.sol:38). During it, requestRedeem reverts for the victim (packages/perps/src/TrancheVault.sol:617-619) and so does any share transfer out (packages/perps/src/TrancheVault.sol:325-328). Cancelling the planted request before it matures has the same effect, and after maturity cancellation is not available.
The documented guarantee that breaks. The interface documents the head rule and then states the purpose of the receiver restriction:
// packages/perps/src/interfaces/IAsyncTrancheVault.sol:12-14
/// a later HousePool call. 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. Approved operators may execute these actions for the controller.
Here an unsolicited share from a stranger is exactly what the controller must accept, with a cooldown, to get its standard claim calls back. The interface also says that a "refundable redeem head must be cancelled or reclaimed before standard claims advance" (packages/perps/src/interfaces/IAsyncTrancheVault.sol:8-10). It does not say that a third party can create that head for someone else.
Comparison with known items. I read the full text of each of these.
- Cecuro LOW-40, "Controller can force a zero-balance receiver into LP cooldown" (fix
efcf629a). There the attacker chose the share receiver and stamped it directly. The fix forcesreceiver == controller. In this report the attacker chooses the controller of a request, and the stamp happens when the victim makes the only call that clears its list. This is not a bypass of that fix as written, because the attacker cannot stamp the victim by itself. It is a neighbouring path that reaches the outcome the fix was meant to remove. - Cecuro LOW-39, "Front-runner can block third-party vault share claims by dusting the receiver" (same fix). That was a receiver balance check, now removed. Different root cause.
- Cecuro LOW-43, on
max*views taking the controller. It documents whose limit the views report. It does not cover a third party setting them to zero. - Cecuro MED-24, "LP can delay other redeemers with zero-payout refund epochs" (accepted). It uses the same dust epoch, but the harm there is the global 16 epoch work cap per settlement call. This report is about the per-controller claim list and needs one dust epoch, not many.
- Cecuro LOW-67, "Same-window redeemer can burn a small LP's shares for no assets" (accepted). It explains what happens when another LP redeems in the planted epoch: the head is funded with 1 share for 0 assets. I cover that case under Impact Details.
packages/perps/SECURITY.md, "LP claim and allocation limitations": it listsreceiver == controller, zero entitlement for dust, and zero-payout epochs delaying later epochs. It does not mention a request made under another account's controller.- The AI scan and the pre-audit report have no item on the
controllerargument ofrequestRedeem.
A reviewer could read the documented head rule plus the accepted dust items as covering this. My view is that they cover every ingredient except the one that makes it an attack on someone else: the missing consent check on controller.
Impact Details
All figures below are test values from the proof of concept, at the release parameters, with a 100,000 USDG Junior position for the victim.
What the victim loses:
- Its standard ERC-7540 claim calls stop working. With 49,999.999978 USDG funded and waiting in vault escrow,
maxRedeemandmaxWithdrawreturn 0 andredeemandwithdrawrevert. The state does not clear with time: it was unchanged 25 hours later. The same happens on the Senior vault (20,000.7306 USDG funded, standard view 0). - To restore those calls it must call
claimRedeemRefund, which locksrequestRedeemand transfers on its whole remaining balance (about 49,999.999971 USDG of shares) for exactly 3,600 seconds. - The attack repeats every hourly epoch. In a 26 epoch run (95,399 seconds), a victim that cleared each planted head as it appeared was locked at all 26 mid-epoch checks.
What it costs the attacker: 1 share wei per plant (which ends up with the victim) and 313,554 gas on average for the two calls (472,009 for the first plant). The victim's clearing call cost 107,487 gas on average. The attacker gains nothing.
What is not affected:
- No USDG is lost or sent to the wrong party. After either escape the victim is paid the same amount it could claim before the attack.
- The funds are not frozen.
claimRedeem(requestId, ...)with the explicit epoch id pays the full funded amount at once and sets no cooldown. A victim that never clears the planted head is never locked, and a victim that requests the rest of its balance before clearing loses nothing to the cooldown. The proof of concept shows both. - If another LP redeems in the planted epoch, the head is funded with 1 share for 0 assets.
redeem(1)then clears it with no cooldown, and only callers that usewithdrawstay blocked. If the plant lands in the same epoch as the victim's own request, it merges into the victim's position and nothing is blocked.
Preconditions, stated plainly: the planted epoch must have no other redeemer in that tranche, it must be earlier than the victim's request, and the victim (or its front end or integration) must rely on the standard head-based calls. I could not check the last point, because the repository has no front end or integrator code that shows which claim path LPs are given.
Why this is the griefing row and not a freeze row. "Temporary freezing of funds for at least 1 hour" and the 24 hour row both need funds the owner cannot reach. That is not the case here, since the explicit-id claim always pays and the one hour lock can be avoided by ordering. Claiming either row would contradict my own tests.
Why I am not rating it lower: The damage is aimed at a chosen LP, costs the attacker close to nothing, can be repeated every hour on both tranches, and needs no mistake by the victim to disable its standard claim calls.
Suggested fix: require consent for the controller in requestRedeem, for example controller == owner or the owner being an approved operator of the controller. Either of these would also work: let standard claims skip refundable heads, or skip the cooldown stamp when the refunded shares did not come from the receiver. I did not test a fix, because the proof of concept rules do not allow changing the contracts in scope.
References
requestRedeem: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/TrancheVault.sol#L606-L632_enqueueRedeemRequest: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/TrancheVault.sol#L688-L708claimRedeemRefund: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/TrancheVault.sol#L916-L947withdrawandredeem: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/TrancheVault.sol#L998-L1012_maybeCloseRedeemPosition: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/TrancheVault.sol#L1216-L1227maxWithdrawandmaxRedeem: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/TrancheVault.sol#L1299-L1311_requireMinimumRedeemSize: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/TrancheVault.sol#L1611-L1618- Zero-quote refund branch: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/HousePool.sol#L957-L987
- Interface notes: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/interfaces/IAsyncTrancheVault.sol#L8-L17
- LP claim and allocation limitations: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/SECURITY.md
- Cecuro AI audit (LOW-39, LOW-40, LOW-43, LOW-67, MED-24): https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/audits/plether-ai-audit-report-2026-10-26.pdf
- AI scan findings: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/audits/scan-plether-fi-plether-core-d4541b49.md
- Program page: https://immunefi.com/audit-competition/plether/scope/
Proof of Concept
Proof of Concept
Environment
- Repository:
https://github.com/immunefi-team/audit-comp-pletherat commita82d4fefb02768e5b3bddcc97dee371eee24fea8(the commit in scope).packages/perps/srcis unmodified. - Toolchain as printed:
forge Version: 1.7.1(commit4072e48705af9d93e3c0f6e29e93b5e9a40caed8), compiling withSolc 0.8.35, using the repository'spackages/perps/foundry.toml(via_ir = true, optimizer 200 runs). - OS: Microsoft Windows 11.0.26200.
- Files added:
packages/perps/test/submission/ReleaseBase.sol(helper) andpackages/perps/test/submission/RedeemHeadPlant.t.sol(the tests). Both are given in full below. - The helper extends the repository's own
packages/perps/test/perps/BasePerpTest.sol, which deploys the full stack, and overrides its hooks so the risk parameters, the 1 USDG tranche seeds, the router values and the Senior caps match the release values inpackages/perps/DEPLOYMENT.md. - Mocks: the Pyth contract (
MockPyth, two synthetic feeds) and USDG (MockSettlementToken, a plain 6 decimal ERC-20), both from the repository's test tree. Everything else is the real code at the commit:TrancheVault(both instances),HousePool,CfdEngine,MarginClearinghouse,OrderRouterand the oracle wrapper. - The mocked price plays no part in the result. There are no open trader positions in any test, the mark is refreshed at 1.00 only so that settlement has a fresh mark, and LP settlement runs through the permissionless
HousePool.settleLpEpoch(0, 0). The attacker never sets a price. - The tests call only production functions on the vault and pool:
requestDeposit,claimDeposit,requestRedeem,transfer,redeem,withdraw,claimRedeem,claimRedeemRefund,cancelRedeemRequest,setOperator,settleLpEpoch, andupdateMarkPriceon the router.
No transaction is sent to any live network.
Steps
- Get the code at the commit in scope.
git clone https://github.com/immunefi-team/audit-comp-plether
cd audit-comp-plether
git checkout a82d4fefb02768e5b3bddcc97dee371eee24fea8
git submodule update --init --recursive
- Save the two files from the "PoC source" sections below at these paths:
packages/perps/test/submission/ReleaseBase.sol
packages/perps/test/submission/RedeemHeadPlant.t.sol
- Run the test file.
forge test --root packages/perps --match-path test/submission/RedeemHeadPlant.t.sol -vv
I ran step 3 in an existing checkout at the commit, with FOUNDRY_SPARSE_MODE=true and FOUNDRY_DYNAMIC_TEST_LINKING=true set in the environment. These two settings only limit how much of the test tree is compiled. Without them the first build compiles the whole perps test tree and takes much longer. I did not run the command without them, and I did not repeat steps 1 and 2 from a fresh clone.
Expected result
Ran 13 tests for test/submission/RedeemHeadPlant.t.sol:RedeemHeadPlant
[PASS] test_Attack_StandardClaimSurfaceDeadWhileFundedUsdgSitsInEscrow() (gas: 1549921)
Logs:
attack: funded USDG behind a dead standard surface 49999999978
[PASS] test_Benign_VictimRedeemsThroughStandardSurface() (gas: 974934)
Logs:
benign: USDG paid by standard redeem 49999999982
[PASS] test_Control_SameDustUnderPlantersOwnController_NoEffect() (gas: 1516364)
[PASS] test_EscapeA_ExplicitIdClaimPaysImmediately_NoCooldown_HeadStaysPinned() (gas: 2126560)
[PASS] test_EscapeB_RefundClaimClearsHead_ButStampsOneHourCooldownOnWholeBalance() (gas: 1986669)
Logs:
clear gas (claimRedeemRefund) 108015
locked share-wei for 3600s 50079074780004
locked value in USDG atoms (approx) 49999999971
[PASS] test_Escape_PreMaturityCancelAlsoStampsCooldown() (gas: 426341)
[PASS] test_Limit_RequestBeforeClearAvoidsTheLock() (gas: 2139288)
[PASS] test_Limit_VictimWhoIgnoresPlantsIsNeverLocked() (gas: 2447691)
[PASS] test_Reach_DustNeedsWholeBalanceOwner_AndNoVictimConsent() (gas: 736360)
Logs:
plant gas (transfer + requestRedeem) 472009
[PASS] test_Repeat_ReplantEveryEpoch_VictimWhoClearsEachHeadStaysLocked() (gas: 15573746)
Logs:
rounds 26
elapsed seconds 95399
attacker gas per plant (transfer + requestRedeem) 313554
victim gas per clear (claimRedeemRefund) 107487
attacker share-wei spent 26
[PASS] test_Senior_SamePlantPinsSeniorControllerHead() (gas: 3106315)
Logs:
senior: funded USDG behind a dead standard surface 20000730600
[PASS] test_Vary_BusyEpoch_FundedZeroAssetHead_RedeemClearsWithdrawCannot() (gas: 1762737)
[PASS] test_Vary_SameEpochMerge_NoPin() (gas: 1076414)
Suite result: ok. 13 passed; 0 failed; 0 skipped; finished in 97.54ms (129.56ms CPU time)
Ran 1 test suite in 113.41ms (97.54ms CPU time): 13 tests passed, 0 failed, 0 skipped (13 total tests)
Compiler warnings printed before these lines are omitted. Gas figures and timings can vary with the toolchain version. The pass condition is 13 passed; 0 failed.
What each test asserts
test_Benign_VictimRedeemsThroughStandardSurface: with no attacker, the victim's request becomes the head of its list,maxRedeemreports the funded shares, and the standardredeempays the full funded amount. This shows the harness models the normal flow.test_Control_SameDustUnderPlantersOwnController_NoEffect: the same 1 wei request in the same quiet epoch, but with the planter as its own controller, leaves the victim's standard claim working. Only thecontrollerargument differs from the attack, which isolates it as the cause.test_Reach_DustNeedsWholeBalanceOwner_AndNoVictimConsent: a 1 wei request from the attacker's main balance is rejected as too small. From an address whose whole balance is 1 wei it succeeds with the victim as controller, although the victim gave no operator approval and no allowance. The victim's list head becomes the planted epoch and the attacker has spent exactly 1 share wei.test_Attack_StandardClaimSurfaceDeadWhileFundedUsdgSitsInEscrow: after both epochs settle, the planted epoch is refundable and still the head, the victim's own epoch is fully funded,maxRedeemandmaxWithdraware 0, andredeem,withdrawand a 1 shareredeemall revert with a maximum of 0. The victim cannot cancel the planted request. All of this is unchanged 25 hours later, and the vault escrow identities hold.test_EscapeA_ExplicitIdClaimPaysImmediately_NoCooldown_HeadStaysPinned:claimRedeemwith the explicit epoch id pays the full funded amount and sets no cooldown, and the victim can transfer and request again at once. The planted head remains, so the standard views are still 0 for the victim's next funded request.test_EscapeB_RefundClaimClearsHead_ButStampsOneHourCooldownOnWholeBalance: an operator cannot send the refund to another receiver, and the attacker cannot make the clearing call. The victim'sclaimRedeemRefunddelivers 1 share wei, sets its cooldown to the current time and advances the head, after which the standardredeempays the same amount as before the attack.requestRedeemand transfers of the remaining balance then revert until exactly 3,600 seconds later (still reverting at 3,599).test_Limit_RequestBeforeClearAvoidsTheLock: a victim that requests redemption of its remaining balance before clearing the head exits in full on schedule. This shows the one hour lock is avoidable.test_Escape_PreMaturityCancelAlsoStampsCooldown: cancelling the planted request before it matures clears the head but also restarts the victim's cooldown.test_Vary_SameEpochMerge_NoPin: a plant in the same epoch as the victim's own request merges into the victim's position, the epoch is funded, and the standard claim works.test_Vary_BusyEpoch_FundedZeroAssetHead_RedeemClearsWithdrawCannot: when another LP redeems in the planted epoch, the head is funded with 1 share for 0 assets.withdrawreverts,redeem(1)pays 0 and removes the head with no cooldown, and the victim's claim is then paid.test_Repeat_ReplantEveryEpoch_VictimWhoClearsEachHeadStaysLocked: over 26 consecutive hourly epochs, each plant becomes a refundable head, and a victim that clears each one cannot request a redemption at any of the 26 mid-epoch checks. The attacker loses 1 share wei per round and the victim receives it. Average gas for the plant and for the clearing call is logged.test_Limit_VictimWhoIgnoresPlantsIsNeverLocked: with three planted heads left in place, the victim is never put in cooldown, can request its whole balance, and is paid in full through the explicit-id claim, while the standard view stays 0.test_Senior_SamePlantPinsSeniorControllerHead: the same steps on the Senior vault give a refundable head, a funded victim epoch of about 20,000 USDG, a standard view of 0, a revertingredeem, and full payment through the explicit id.
What the PoC shows and what it does not show
It shows that an address with no approval from the victim can place a request in the victim's claim list for 1 share wei, that the victim's standard ERC-7540 claim calls and views then stop working while its funded USDG is in escrow, that the only call restoring them restarts the victim's one hour cooldown on its whole balance, and that this can be repeated every epoch on both tranches.
It does not show any loss of USDG, and it does not show a freeze: two of the tests prove the victim can always be paid through the explicit-id claim and can avoid the lock. It does not show that real LPs use the head-based standard calls, since the repository has no front end or integrator to test against. All amounts are fixture values chosen for the test (100,000 USDG and 20,000 USDG positions), not live balances; the perps contracts are not deployed on a main network. The attack needs an epoch with no other redeemer in that tranche, which the test arranges and a live market may not always offer. Pyth and USDG are mocks, and the basket uses two synthetic feeds, although no result depends on a price. Epochs are advanced with vm.warp, so sequencer timing and competing transactions are not modelled. The recommended fix is not tested, because the contracts in scope may not be modified. Gas figures come from the Foundry test environment and will differ on Arbitrum.
PoC source: packages/perps/test/submission/ReleaseBase.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.35;
import {BasePerpTest} from "../perps/BasePerpTest.sol";
import {CfdTypes} from "@plether/perps/CfdTypes.sol";
import {OrderV3Types} from "@plether/perps/OrderV3Types.sol";
import {TrancheVault} from "@plether/perps/TrancheVault.sol";
import {ICfdEngineTypes} from "@plether/perps/interfaces/ICfdEngineTypes.sol";
import {IOrderRouterAdminHost} from "@plether/perps/interfaces/IOrderRouterAdminHost.sol";
/// @dev Shared proof-of-concept base. Applies the release parameters from packages/perps/DEPLOYMENT.md and only
/// reaches production surfaces: the V3 `commitOrder`, `executeOrder`, `settleLpEpoch` and vault ERC-7540 calls.
/// Replaced by mocks: Pyth (two synthetic feeds rather than six) and USDG. No in-scope contract is modified.
/// Inherited helpers `_open`, `_close`, `_fundTrancheAsync` and `_settleLpEpochForTest` prank the Router and
/// are for exploration only. A filed proof of concept must use the helpers in this file instead.
abstract contract ReleaseBase is BasePerpTest {
/// @dev Monday 2024-03-11 14:00 UTC, outside the frozen and FAD windows.
uint256 internal constant LIVE_MONDAY = SETUP_TIMESTAMP + 7 days + 4 hours;
uint256 internal constant RELEASE_MAX_SENIOR_EXPOSURE_ASSETS = 40_000_000e6;
uint256 internal constant RELEASE_MAX_SENIOR_SHARE_BPS = 8000;
uint256 private _clientNonce;
function _riskParams() internal pure virtual override returns (CfdTypes.RiskParams memory) {
return CfdTypes.RiskParams({
vpiFactor: 0.01e18,
maxSkewRatio: 0.4e18,
maintMarginBps: 10,
initMarginBps: 20,
fadMarginBps: 300,
baseCarryBps: 500,
minBountyAssets: 1e6,
bountyBps: 10,
keeperShareBps: 5000,
protocolShareBps: 0
});
}
function _initialJuniorDeposit() internal pure virtual override returns (uint256) {
return 0;
}
function _initialJuniorSeedDeposit() internal pure virtual override returns (uint256) {
return 1e6;
}
function _initialSeniorSeedDeposit() internal pure virtual override returns (uint256) {
return 1e6;
}
function setUp() public virtual override {
super.setUp();
_applyReleaseConfig();
vm.warp(LIVE_MONDAY);
vm.roll(block.number + 1);
}
function _applyReleaseConfig() internal {
IOrderRouterAdminHost.RouterConfig memory config = _routerConfig();
config.minOpenNotionalAssets = 1000e6;
config.maxPendingOrders = 5;
config.positionProtectionTriggerBountyAssets = 200_000;
config.basketMaxConfidenceRatioBps = 10;
config.adverseConfidenceMultiplierBps = 2500;
_setRouterConfig(config);
_setSeniorCapacity(RELEASE_MAX_SENIOR_EXPOSURE_ASSETS, RELEASE_MAX_SENIOR_SHARE_BPS);
assertEq(engine.settlementBufferBps(), 25, "release settlementBufferBps");
assertEq(engine.executionFeeBps(), 4, "release executionFeeBps");
}
// --- Production order surface ---
/// @dev Target price semantics, from the harness adapter: a LONG open or SHORT close uses a floor (1 is unbounded),
/// a LONG close or SHORT open uses a ceiling (type(uint256).max is unbounded).
function _commitV3(
address account,
CfdTypes.Side side,
uint256 size,
uint256 margin,
uint256 targetPrice,
bool isClose
) internal returns (uint64 orderId) {
uint256 maxWindow = router.maxExecutionWindowSeconds();
OrderV3Types.OrderRequest memory request = OrderV3Types.OrderRequest({
clientOrderId: keccak256(abi.encode("order", account, ++_clientNonce)),
side: side,
sizeDelta: size,
marginDelta: margin,
targetPrice: targetPrice,
isClose: isClose,
bounds: OrderV3Types.ExecutionBounds({
submitBy: uint64(block.timestamp) + uint64(maxWindow),
executionWindowSeconds: uint32(maxWindow),
allowedExecutionModes: 7,
expectedConfigHash: router.lifecycleBook().currentExecutionConfigHash(),
maxExecutionBountyAssets: type(uint256).max,
maxExecutionNotionalAssets: type(uint256).max,
maxGrossAccountDebi
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 the missing consent check on the controller argument in requestRedeem, which lets a third party enqueue a position under any account and pin that account's claim-list head.
Impact
The victim's standard claim calls are blocked while funded USDG sits in escrow, and clearing the planted head imposes a one hour cooldown on its whole balance, though funds are not lost and the explicit-id claimRedeem still pays in full.
What the attacker needed
Attacker holds 1 share wei; planted epoch has no other redeemer; planted epoch precedes victim's request; victim relies on standard head-based calls
The fix
The controller in requestRedeem should require consent, for example by requiring controller == owner or that the owner is an approved operator of the controller.
How it was found
- Deposit the minimum amount, wait out the deposit cooldown, and move 1 share wei to a second address so its whole balance is that dust.
- Call requestRedeem from the dust address with the victim as controller, in an epoch where no other redeemer is present.
- Let settlement run so the dust epoch is refunded rather than funded, leaving it at the head of the victim's list.
- Observe that the victim's maxRedeem and maxWithdraw return 0 and redeem and withdraw revert.
- Watch the victim clear the head with claimRedeemRefund, which delivers the dust share and restarts a one hour cooldown on its whole 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 request to take their money out, and each request is filed under an account name called the controller. The code never checks that the person named as controller actually agreed to it, so anyone can file a tiny request under someone else's name. Because the vault only looks at the oldest request in that person's queue, the planted one blocks their normal withdrawal buttons until they clear it, and clearing it locks their balance for an hour.
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.