Incomplete fix of audit finding MED-10 in PletherOracle: frozen-regime liquidation still subtracts the confidence shift from the already capped mark, so keepers can liquidate SHORT positions that are solvent at the policy price
During oracle-frozen windows the liquidation price for SHORT positions is computed by subtracting the confidence shift from the already capped Engine mark, so the result falls below the cap. A keeper can then liquidate a SHORT that is solvent at the protocol's stated policy price, costing the trader the liquidation charge plus unpaid profit.
Originally disclosed on Immunefi
- Disclosed after under an hour
#99616 [SC-Medium] Incomplete fix of audit finding MED-10 in PletherOracle: frozen-regime liquidation still subtracts the confidence shift from the already capped mark, so keepers can liquidate SHORT positions that are solvent at the policy price
Submitted on Nov 14th 2026 at 14:19:37 UTC by @IronsideSec for Audit Competition | Plether
- Report ID: #99616
- Report Type: Smart Contract
- Report severity: Medium
- Target: https://github.com/immunefi-team/audit-comp-plether/tree/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src
- Impacts:
- Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Brief/Intro
The Cecuro audit finding MED-10 ("Liquidator can liquidate short traders at prices below the configured cap-adjusted mark") is marked Addressed: liquidation pricing is supposed to apply the adverse confidence shift to the raw, uncapped basket and only then clamp the result to CAP_PRICE. At the in-scope commit this holds only while the oracle is live. During every oracle-frozen window (each weekend, Friday 17:00 to Sunday 17:00 New York) PletherOracle replays the Engine's stored mark, which is already clamped to the cap, as the "raw" price, so updateLiquidationPrice and updateLiquidationBatchPrice once again return CAP_PRICE - shift for SHORT positions. If the basket is at or above the cap when the market freezes, any keeper can liquidate, with empty update data and no oracle fee, a SHORT that is solvent at the protocol's own policy price and that the same keeper could not liquidate a minute earlier. In the PoC a SHORT with 60,100 USDG of equity against a 60,000 USDG requirement is liquidated: the trader loses 2,490 USDG and the keeper collects 995 USDG. The same cap-then-shift arithmetic also remains on the order-execution path, where SHORT closes and LONG opens fill below the policy price.
Vulnerability Details
Affected in-scope asset and classification
- Asset:
packages/perps/src/PletherOracle.solat the in-scope commita82d4fefb02768e5b3bddcc97dee371eee24fea8. It is covered by the fourth listed asset, "All other contracts, libraries, router contracts and interfaces in packages/perps/src, except the six view-only contracts listed as out of scope below" (targetpackages/perps/src). The wrong price is consumed by the Router's liquidation paths andCfdEngine.liquidatePosition, and by order execution. - Report class: incomplete fix of a prior-audit finding. The competition's scope page states that for findings marked fixed or acknowledged in the listed reports, a report on the same root cause is valid if it shows that the fix at commit
a82d4fef…"is incomplete or introduces a new bug". MED-10 is such a finding. - Selected severity and impact: Medium — "Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)". This is the closest listed Medium impact and it is the severity the prior audit assigned to the same root cause. To be precise about the fit: the liquidating keeper does collect the ordinary liquidation bounty, so a profit motive exists. I am deliberately not selecting a higher impact, because the amount per event is bounded (liquidation charge plus the shift, about 0.125% of notional) and the trigger is an extreme market state.
This is not a claim about the cap itself (the immutable CAP_PRICE is the acknowledged pre-audit item SC-M6), about oracle clock alignment (HIGH-1), or about keeper tick selection (MED-7). It is only about the order in which the confidence shift and the cap are applied.
What the fix was supposed to guarantee
The project's disposition of MED-10 in the Cecuro report (pp. 29-30 of audits/plether-ai-audit-report-2026-10-26.pdf) reads:
MED-10 — Addressed. Single-account and batch liquidation pricing now apply the directional confidence adjustment to the raw, uncapped basket, then clamp the resulting liquidation price to CAP. The neutral Engine mark remains capped separately. This removes the artificial below-cap SHORT liquidation price caused by subtracting confidence from an already capped mark. Confidence adjustments remain part of liquidation pricing; the fix changes their ordering, not the policy of using adverse prices.
The NatSpec of updateLiquidationPrice states the same rule and names both sources: it "Resolves a current basket or frozen Engine mark … shifts the price … downward for a SHORT position by the configured fraction of aggregate confidence, then caps it at CAP_PRICE." (emphasis added)
So the policy price for a SHORT liquidation is:
policyPrice = min(rawBasket - shift, CAP_PRICE) shift = confidence * adverseConfidenceMultiplierBps / 10_000
When the raw basket is at or above CAP_PRICE + shift, the policy price is exactly CAP_PRICE.
Root cause: in the frozen regime the "raw" price is the already capped mark
The fix introduced _updateLiquidationSnapshot, which hands the pre-cap basket price to the shift:
/// @dev Retains the pre-cap price for adverse liquidation shifts while keeping the neutral snapshot capped.
function _updateLiquidationSnapshot(
bytes[] calldata pythUpdateData
) internal returns (PriceSnapshot memory snapshot, uint256 rawPrice, uint256 confidence) {
...
BasketPrice memory basket = _resolveCurrentBasket(pythUpdateData, PriceMode.Liquidation, policy);
snapshot = _snapshotFromBasket(basket, policy, true);
rawPrice = basket.price;
confidence = basket.confidence;
}
But when the oracle is frozen, _resolveCurrentBasket never builds a basket; it returns _frozenBasket:
if (policy.oracleFrozen) {
return _frozenBasket(mode, policy.maxStaleness);
}
function _frozenBasket(PriceMode mode, uint256 maxStaleness) internal view returns (BasketPrice memory basket) {
basket.price = engine.lastMarkPrice();
basket.publishTime = engine.lastMarkTime();
...
// Liquidations receive a deterministic, conservative confidence shift while Pyth is closed.
basket.confidence = basket.price * basketMaxConfidenceRatioBps / 10_000;
}
engine.lastMarkPrice() is never above the cap: every writer clamps it, for example CfdEngine.updateMarkPrice (uint256 clamped = price > CAP_PRICE ? CAP_PRICE : price;). Therefore, in the frozen regime, rawPrice in _updateLiquidationSnapshot is the capped mark, and both liquidation entrypoints compute "capped mark minus shift" again:
updateLiquidationPrice:snapshot.price = _clampToCap(_adverseLiquidationPrice(account, rawPrice, confidence));updateLiquidationBatchPrice:shortPrice: _clampToCap(_directionalLiquidationPriceFromShift(CfdTypes.Side.SHORT, rawPrice, shift))_directionalLiquidationPriceFromShift:side == LONG ? price + shift : price > shift ? price - shift : 0
With the mark at the cap this yields CAP_PRICE - shift, which is exactly the artifact MED-10 described and the disposition says was removed. These are the same two functions MED-10 listed.
The information needed to apply the rule is on-chain during the freeze: the last accepted live basket is stored before clamping (_acceptedBasket = basket;), and only its clamped value is ever read back.
The shift magnitude is not what differs between the regimes. In the PoC the last live tick carries the maximum admissible confidence (10 bps of price), so the live shift and the frozen "policy-derived" shift are both 50,000. The only difference is the base: 200,100,000 (raw) while live, 200,000,000 (capped mark) while frozen.
Second manifestation: order execution shifts the clamped snapshot price
Order execution was not changed by the fix. Both the single and the batch path clamp first and shift afterwards (#L283-L284, #L557-L558, with the clamp at #L887):
snapshot = _snapshotFromBasket(basket, policy, false); // snapshot.price = _clampToCap(basket.price)
snapshot.price = _orderExecutionPrice(request, snapshot.price, basket.confidence, policy.oracleFrozen);
_orderExecutionPrice ends with return _clampToCap(_adverseOrderPrice(request, price, confidence));. An upward shift from the cap is clamped back to the cap, a downward shift is not, so the two downward-adverse sides (SHORT close, LONG open) receive CAP_PRICE - shift although min(raw - shift, CAP_PRICE) equals CAP_PRICE. I include this for completeness and flag honestly that the NatSpec of that entrypoint (#L208-L210) says the base basket "is capped and then shifted", so the project may regard the order-path half as documented. The frozen-liquidation half is the core of this report.
Worked numbers at release parameters
CAP_PRICE = 200,000,000, basketMaxConfidenceRatioBps = 10, adverseConfidenceMultiplierBps = 2,500 (DEPLOYMENT.md, "Initial release parameters"). Take a raw basket of 200,100,000 (2.0010) with aggregate confidence 200,000 (accepted: 200,000 * 10,000 <= 200,100,000 * 10). Then shift = 200,000 * 2,500 / 10,000 = 50,000.
| Path | Computation | SHORT-adverse price |
|---|---|---|
| Policy (fix note, NatSpec) | min(200,100,000 - 50,000, 200,000,000) |
200,000,000 |
| Live liquidation (fixed) | raw shifted, then clamped | 200,000,000 |
| Frozen liquidation, single and batch | stored mark 200,000,000 - 50,000 |
199,950,000 |
| Order execution: SHORT close, LONG open | clamped 200,000,000 - 50,000 |
199,950,000 |
| Order execution: SHORT open, LONG close | clamped 200,000,000 + 50,000, re-clamped |
200,000,000 |
Exact sequence (frozen-regime liquidation)
All calls are permissionless. Times are those used in the PoC.
- A trader holds a SHORT of 10,000 lots (about 2,000,000 USDG notional at the cap). The basket rises above the cap and anyone refreshes the mark; the Engine stores the capped mark
200,000,000. - Friday 16:45 New York (FAD window, oracle still live, 3% margin requirement): the trader's equity at the cap is 60,100 USDG against a 60,000 USDG requirement. A keeper calls
executeLiquidation(account, liveTick); the live path prices the SHORT atmin(raw - shift, CAP_PRICE) = CAP_PRICEand the call reverts withCfdEngine__PositionIsSolvent. - Friday 17:00 New York: the calendar freezes the oracle. The position, the stored mark and the last accepted basket are unchanged.
- Any keeper calls
executeLiquidation(account, [])(orexecuteLiquidationBatch) with empty update data and no oracle fee. The frozen SHORT price is199,950,000. At that price equity is 59,600 USDG against a 59,985 USDG requirement, and the account is liquidated. - Outcome measured in the PoC: the trader's account value falls by 2,490 USDG (the 1,990 USDG liquidation charge, split 995 USDG to the keeper and 995 USDG to LPs, plus 500 USDG of SHORT profit not paid because settlement happens at
CAP_PRICE - shift). The keeper's balance rises by 995 USDG.
The window stays open for the whole frozen period. A SHORT is affected whenever its equity at the cap is below requirement(CAP) + 0.97 * lots * shift, i.e. within about 2.4 bps of notional above the 3% requirement (485 USDG for this position).
Preconditions and limits
- The basket must be at or above
CAP_PRICE(2.00) when the market freezes, so that the stored mark is the cap. This is an extreme market state. The scope page says "Feasibility limitations do not change the impact or severity of a finding, only the amount paid for it"; I state the precondition plainly and do not claim it is likely. - Only SHORT positions close to the frozen/FAD requirement are affected, in the band given above. LONG liquidations are not affected (the upward shift is clamped back to the cap). Frozen voluntary closes are not affected (they are unshifted by design). The live liquidation path is fixed.
- Per event the loss is bounded: the liquidation charge (10 bps of notional, capped by the position's liquidation reserve) plus
lots * shift(at most 2.5 bps of notional). On the order path the loss is at mostlots * shiftper fill. - No attacker capital is required, and during the freeze the keeper needs no Pyth payload.
- I do not claim loss of LP funds, protocol insolvency, or any freezing of funds.
Known-issue boundary
- Cecuro MED-10 is the same root cause. Its disposition is "Addressed", and its fix landed in
eadc5c58(PR #124). This report shows the fix is incomplete at the in-scope commit: in the frozen regime the two functions MED-10 named still subtract the shift from an already capped mark. - The fix's own tests cover live baskets only.
test_Liquidation_SingleShiftsRawBasketBeforeCap,test_Liquidation_BatchShiftsRawBasketBeforeCapandtest_Liquidation_ShortStaysCappedWhenShiftLeavesRawPriceAboveCapassert the rule with live prices above the cap. The fuzz testtestFuzz_Liquidation_SingleAndBatchMatchRawBasketPolicyhas a frozen branch, but it pins the installed mark at100,000,000(1.00), so the capped case is never exercised. That branch models the frozen base as "the installed mark with policy-derived confidence"; I mention it because the project may point to it. It shows that a shift is applied in the frozen regime, which is not disputed here. It does not show that the shift is meant to go below an already capped mark, which is what the MED-10 disposition says was removed. - Documentation. The whitepaper says frozen liquidations "apply a conservative confidence shift synthesized from the configured maximum basket confidence ratio" (WHITEPAPER.md) and that the side-adverse price is capped at C (same file). Neither statement, nor anything in the
SECURITY.mdsections listed as known limitations, says that a frozen SHORT liquidation is priced below the cap when the basket is above it. - SC Audit Studio SC-M6 (immutable
CAP_PRICE, acknowledged) concerns the existence and immutability of the cap. MED-10 was raised and accepted separately from it.
Recommended remediation
- Frozen liquidation. Keep the pre-cap value of the basket that produced the stored mark and use it as the shift base for liquidation while the oracle is frozen. The oracle already stores the pre-cap accepted basket;
_frozenBasketinPriceMode.Liquidationcan use_acceptedBasket.pricewhen_acceptedBasket.publishTime == engine.lastMarkTime(). As a minimal alternative, when the stored mark equalsCAP_PRICEand no pre-cap value is available, do not apply the downward SHORT shift. - Order execution. Pass the pre-cap
basket.priceinto_orderExecutionPriceand clamp once after the shift, keepingmarkPricecapped, or state explicitly in the specification that order execution is intentionally capped before shifting. - Regression tests. Extend the frozen branch of the liquidation fuzz test to marks at the cap, and add order-quote tests with a raw basket above the cap.
Impact Details
Selected impact: Medium — "Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)", with the fit explained under "Affected in-scope asset and classification".
Frozen-regime liquidation of a SHORT that is solvent at the policy price:
- The trader is force-closed although the account satisfies the margin requirement at the protocol's stated liquidation price. In the PoC the trader's account value drops by 2,490 USDG on a position of about 2,000,000 USDG notional: 1,990 USDG liquidation charge and 500 USDG of profit that is not paid.
- The liquidating keeper gains 995 USDG; LPs gain the other 995 USDG of the charge and retain the 500 USDG of unpaid profit. The loss is permanent for the trader.
- The loss scales linearly with position size: about 12.5 bps of notional per wrongly liquidated position (10 bps charge plus 2.5 bps shift).
- The condition persists for the entire frozen window (about 48 hours on an ordinary weekend) and can be used by any account acting as keeper without capital or oracle fees.
Order execution while the basket is above the cap:
- A SHORT close of 10,000 lots realizes 9,500 USDG instead of 10,000 USDG (500 USDG, 2.5 bps of notional, kept by the pool).
- A LONG open of the same size is filled 500 USDG below the neutral mark it is immediately valued at.
- A SHORT limit close with its target at the cap is terminally rejected as
Slippage, although the policy price equals the target.
Limits: the basket has to be at or above the 2.00 cap, which is an extreme price for the index, and only positions inside the narrow equity band are flipped into liquidation. I do not claim that this is likely under normal conditions, and I do not claim theft from LPs or insolvency.
References
- In-scope repository and commit: https://github.com/immunefi-team/audit-comp-plether/tree/a82d4fefb02768e5b3bddcc97dee371eee24fea8
_updateLiquidationSnapshot(pre-cap price retained for the shift): https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/PletherOracle.sol#L531-L543- Frozen routing in
_resolveCurrentBasket: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/PletherOracle.sol#L749-L756 _frozenBasket(stored Engine mark used as the basket price): https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/PletherOracle.sol#L729-L743updateLiquidationBatchPrice: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/PletherOracle.sol#L308-L322updateLiquidationPriceand its NatSpec ("then caps it atCAP_PRICE"): https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/PletherOracle.sol#L324-L344- Liquidation shift helpers: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/PletherOracle.sol#L943-L972
- Pre-cap accepted basket stored by the oracle: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/PletherOracle.sol#L795-L799
- Order-execution call sites: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/PletherOracle.sol#L283-L284 and https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/PletherOracle.sol#L557-L558
- Clamp inside
_snapshotFromBasket: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/PletherOracle.sol#L878-L888 - Order shift helpers: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/PletherOracle.sol#L905-L941
- Order-path NatSpec ("capped and then shifted"): https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/PletherOracle.sol#L204-L215
- Engine mark is always clamped: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/CfdEngine.sol#L1466-L1477
- Fix tests (live cases and the fuzz test's frozen branch): https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/test/perps/spec/oracle/PletherOracle.t.sol#L649-L737
- Release parameters: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/DEPLOYMENT.md#L124-L150
- Whitepaper, frozen liquidation shift: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/WHITEPAPER.md#L1071-L1077
- Cecuro AI audit report, MED-10 (pp. 29-30): https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/audits/plether-ai-audit-report-2026-10-26.pdf
- Fix commit for MED-10 in the competition repository (PR #124): https://github.com/immunefi-team/audit-comp-plether/commit/eadc5c587e2f2f1ec26c51132472ab876d6edc15
- Fix commit cited in the MED-10 disposition: https://github.com/Plether-Fi/plether-core/commit/006c818d364282943e2063eab52ab0c89181304c
Proof of Concept
Proof of Concept
What the tests prove
The PoC is one Foundry test file added to the repository's own test suite. It runs locally against the unmodified in-scope contracts at commit a82d4fef; only Pyth and the settlement token are mocks (the repository's own MockPyth and mock settlement token). It makes no network call and sends no transaction to any public chain.
It contains five tests:
test_A_FrozenLiquidation_ShortSolventAtCapIsLiquidated(main result). A SHORT of 10,000 lots is opened in a live market, the basket rises above the cap and the capped mark is installed. In the Friday FAD window the trader holds 60,100 USDG equity against the 60,000 USDG requirement. Control: a liveexecuteLiquidationreverts withCfdEngine__PositionIsSolvent. After the 17:00 New York freeze, with nothing else changed, the lens reports the account as not liquidatable atCAP_PRICEand liquidatable atCAP_PRICE - shift; the frozen single and batch quotes are both199,950,000;executeLiquidation(account, [])succeeds. The test asserts the trader's loss equals the full liquidation charge pluslots * shiftand that the keeper's balance increased.test_B_SameTick_LiveLiquidationQuoteIsFixed_OrderQuotesAreNot(control on one tick). For the same signed tick above the cap, the fixed live liquidation quote for a SHORT isCAP_PRICE, while the order quotes for a SHORT close (single, batch, batch-cache reuse) and a LONG open areCAP_PRICE - shift; the upward-adverse sides are clamped back to the cap.test_C_OrderPath_ShortCloseAboveCap_FillsAtCapMinusShift. End to end through the Router: the close realizes 9,500 USDG instead of 10,000 USDG.test_D_OrderPath_LongOpenAboveCap_EntersAtCapMinusShift. End to end: the LONG's entry basis islots * (CAP_PRICE - shift)while the neutral mark stays at the cap.test_E_OrderPath_ShortLimitCloseAtCap_RejectedAsSlippage. A limit close targeting the cap endsFailedwith reasonSlippage.
Test file
Save the complete block below as packages/perps/test/audit/Med10FixIncompleteFrozenCap.t.sol.
PoC SHA-256: aae52e606942df3c8005dff859448c296a77d770350ab4df3a17674927a730b1.
// 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 {ICfdEngineTypes} from "@plether/perps/interfaces/ICfdEngineTypes.sol";
import {IHousePool} from "@plether/perps/interfaces/IHousePool.sol";
import {IOrderRouterAdminHost} from "@plether/perps/interfaces/IOrderRouterAdminHost.sol";
import {IPletherOracle} from "@plether/perps/interfaces/IPletherOracle.sol";
import {MockPyth} from "@plether/test-utils/MockPyth.sol";
import {Vm} from "forge-std/Vm.sol";
/// @notice PoC: the fix for Cecuro MED-10 ("Liquidator can liquidate short traders at prices below the configured
/// cap-adjusted mark") is incomplete at commit a82d4fef.
/// The fix shifts the RAW (pre-cap) basket and clamps afterwards, but only when the basket is live:
/// (1) in the oracle-frozen regime `_frozenBasket` replays the CAP-clamped Engine mark as the "raw"
/// price, so `updateLiquidationPrice` / `updateLiquidationBatchPrice` return CAP - shift again and
/// a SHORT that is solvent at the policy price is liquidated;
/// (2) order execution (`_orderExecutionPrice(request, snapshot.price, ...)`, single and batch) shifts
/// the already clamped snapshot price, so SHORT closes and LONG opens fill at CAP - shift.
/// Runs on the repository's own harness (`BasePerpTest`) with the release risk parameters, release Senior
/// limits and release oracle/router policy (DEPLOYMENT.md "Initial release parameters"). Only Pyth and the
/// settlement token are mocks (the repository's `MockPyth` / mock settlement token).
contract Med10FixIncompleteFrozenCapTest is BasePerpTest {
// Release values that differ from BasePerpTest.
uint256 internal constant RELEASE_ADVERSE_MULTIPLIER_BPS = 2500;
uint256 internal constant RELEASE_MAX_SENIOR_EXPOSURE = 40_000_000e6;
uint256 internal constant RELEASE_MAX_SENIOR_SHARE_BPS = 8000;
// Basket above CAP: raw 2.0010 with aggregate confidence 0.0020 (exactly the 10 bps release ratio ceiling is
// 0.002001, so this tick is accepted). shift = 200_000 * 2500 / 10_000 = 50_000.
uint256 internal constant RAW_ABOVE_CAP = 200_100_000;
uint64 internal constant CONF_ABOVE_CAP = 200_000;
uint256 internal constant SHIFT = 50_000;
uint256 internal constant ENTRY_PRICE = 199_000_000;
uint256 internal constant LOTS = 10_000;
uint256 internal constant SIZE = LOTS * 1e20; // 10,000 lots of 100 tokens (~$2M notional at 2.0)
// Fri 2024-03-08 21:45:00 UTC (16:45 EST) is FAD-live; 22:00:30 UTC (17:00:30 EST) is oracle-frozen.
uint256 internal constant FRIDAY_FAD_LIVE = 1_709_934_300;
uint256 internal constant FRIDAY_FROZEN = 1_709_935_230;
// Thu 2024-03-07 12:00:00 UTC: ordinary live market.
uint256 internal constant THURSDAY_LIVE = 1_709_812_800;
address internal shortTrader = address(0x5110);
address internal longTrader = address(0x1011);
address internal keeper = address(0xBEEF);
function _riskParams() internal pure 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 override returns (uint256) {
return 10_000_000e6;
}
function _initialJuniorSeedDeposit() internal pure override returns (uint256) {
return 1e6;
}
function _initialSeniorSeedDeposit() internal pure override returns (uint256) {
return 1e6;
}
function setUp() public override {
super.setUp();
// Release Senior limits (40M / 80%) and release Router/Oracle policy, both th
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 frozen-oracle path feeds the already capped Engine mark into the liquidation shift as if it were the raw basket price, so the shift is applied after the cap instead of before it.
Impact
A SHORT that is solvent at the policy price can be force-closed during the frozen window, costing the trader about 12.5 bps of notional per event, though only when the basket is at or above the cap and the position sits in a narrow equity band.
What the attacker needed
Basket at or above the 2.00 cap at freeze; SHORT position near the margin requirement; oracle in a frozen weekend window; no attacker capital needed
The fix
The frozen liquidation path should use the stored pre-cap accepted basket as the shift base (or skip the downward shift when only the capped mark is available), and the order path should shift before clamping.
How it was found
- A trader holds a large SHORT and the basket rises above the cap, so the Engine stores the capped mark.
- While the oracle is still live, a keeper's liquidation attempt reverts because the position is solvent at the policy price.
- The calendar freezes the oracle at the weekend; the position, stored mark and last accepted basket are unchanged.
- Any keeper calls the liquidation entrypoint with empty update data and no oracle fee.
- The frozen SHORT price is below the cap, the account is judged insolvent and is liquidated.
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 price oracle feeds the protocol a market price, and it also reports how uncertain that price is. The protocol deliberately moves the price against a trader by that uncertainty before deciding whether to liquidate. The fix for an earlier audit was meant to apply that adjustment to the true price and only then cap it at a maximum. But when the oracle is closed at weekends, the code starts from a price that has already been capped, so subtracting the adjustment pushes it below the cap and a healthy position looks unsafe.
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.