Skip to content
Access control Audit finding Advanced

An incomplete ownership-renunciation fix can permanently freeze matured but unfunded LP redemptions

The fix for an earlier finding that blocked ownership renunciation was applied to three governance contracts but not to the CfdEngine/CfdTreasury lineage. If the Engine owner renounces ownership, a later ordinary settlement can latch degraded mode, and because only the owner can clear it, matured but unfunded LP redemption requests can never be settled or cancelled.

FestiveSRT Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#97807 [SC-Low] An incomplete ownership-renunciation fix can permanently freeze matured but unfunded LP redemptions

Submitted on Nov 3rd 2026 at 09:59:43 UTC by @FestiveSRT for Audit Competition | Plether

Description

Summary

The frozen fix for Cecuro LOW-59 is incomplete. LOW-59 recommended preventing ownership renunciation in every governance-bearing perps contract. The published fix added guards to HousePool, OrderRouterAdmin, and EmergencyPauseCoordinator, but omitted the CfdTreasury / CfdEngine ownership lineage even though the Engine owner is the only authority that can clear the protocol's degraded-mode latch.

The inherited renounceOwnership() therefore remains callable on CfdEngine. After Engine ownership becomes the zero address, an ordinary later Router settlement can latch degradedMode. The latch does not clear automatically when all positions and both directional liabilities reach zero. At the same time, HousePool refuses to fund any Senior or Junior LP redemption epoch while that latch is set. Because clearDegradedMode() is onlyOwner, renunciation cannot be reversed, and the deployment's Engine, Pool, and vault bindings are immutable or set once, every redemption request that matures without already being funded remains unable to settle or be cancelled.

Already-funded redemption claims remain claimable and are not included in this report.

Prior finding and incomplete-fix disclosure

This report does not claim that the ownership-renunciation family is new. Cecuro LOW-59, "Owner can leave emergency recovery ownerless," recommended overriding renounceOwnership() in every governance-bearing perps contract. Its fix commit, 1151d01fd30d5fe6f6d80d604c5ddd4b90845dc6, added the guard to:

  • packages/perps/src/HousePool.sol:264-267;
  • packages/perps/src/OrderRouterAdmin.sol:124-127; and
  • packages/perps/src/EmergencyPauseCoordinator.sol:101-104.

It did not add the guard to CfdTreasury or CfdEngine. The Engine already contained the owner-only degraded-mode recovery transition, so this is the same root left unfixed in another governance-bearing contract, with a separately demonstrated permanent LP-funds consequence. LOW-59's own impact text already names LP epoch settlement becoming permanently unavailable after a later pause; this report shows the same class of consequence through the Engine's degraded-mode latch, which the three guards do not cover. I am submitting it under the program rule that permits a same-root report when the frozen fix is incomplete.

The report does not rely on a compromised key, a malicious owner, or owner value extraction. The only owner action in the chain is one call to the inherited renounceOwnership(). The program lists the Owner's immediate powers, including recapitalizing the pool and clearing degraded mode, but does not list renunciation among them. The repository documents that "renouncing ownership does not prevent activation" of a scheduled protocol treasury (packages/perps/SECURITY.md:128) and describes ownership changes as a two-step transfer (packages/perps/DEPLOYMENT.md:302). It does not present renunciation as an operating procedure, and it keeps renunciation callable on the Engine.

This report relies on two program provisions. The in-scope provision covers "a legitimate, documented action by a trusted role that triggers a bug harming users or the protocol." The privileged-address standard adopted by the program also preserves a report "where an in-scope impact arises from a logic error that a privileged address can trigger." Whether one renunciation call qualifies is an interpretation of those provisions. The known-issues rule that applies to this report is separate: "For findings marked as fixed or Acknowledged in the reports above, 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." The harmful latch is entered later by ordinary Router settlement and affects LPs distinct from the owner.

The program excludes attacks that require a trusted role "to act maliciously, to be compromised, or to act outside its documented operational procedures", and "Impacts involving centralization risks". This report assumes no malice and no compromise, and it is not about key loss. It is about a callable code path: the project already treats an unguarded renounceOwnership() as a defect worth a code fix in three sibling contracts, and the Engine owner holds the only edge that restores LP redemption funding after the latch.

Root cause and execution path

  1. CfdEngine inherits CfdTreasury, which inherits Ownable2Step: packages/perps/src/CfdEngine.sol:37-46 and packages/perps/src/CfdTreasury.sol:4-10.
  2. Neither contract overrides renounceOwnership(). OpenZeppelin's inherited function transfers ownership to address(0), while Ownable2Step also deletes any pending owner: lib/openzeppelin-contracts/contracts/access/Ownable.sol:69-78 and Ownable2Step.sol:48-65.
  3. Ordinary close or liquidation settlement latches degradedMode when pool assets net of trader claims fall below the remaining maximum-liability envelope: packages/perps/src/CfdEngine.sol:1320-1368.
  4. The sole transition that clears the latch is clearDegradedMode() external onlyOwner: CfdEngine.sol:655-667.
  5. LP exits are asynchronous. HousePool.settleLpEpoch() must fund a matured redemption before the vault claim can pay the LP: packages/perps/src/HousePool.sol:794-883,944-1020 and packages/perps/src/TrancheVault.sol:771-798,998-1020,1148-1212.
  6. HousePool._requireWithdrawalsLive() unconditionally reverts with HousePool__DegradedMode() while the Engine latch is set: HousePool.sol:1864-1870.
  7. Closing every position and reducing both side liabilities to zero does not clear the stored latch. With owner and pending owner both zero, no ownership transfer or other existing administration path can invoke the only clear transition. The Engine dependencies, Pool, terminal book, and Router are set once; the Pool's Engine is immutable and its two vault addresses are set once; and each vault's Pool is immutable: CfdEngine.sol:339-440, HousePool.sol:129-142,269-297, and TrancheVault.sol:53-55,251-261.

Impact and Critical classification

The affected property is LP access to USDG backing matured, not-yet-funded Senior and Junior redemption requests. The funds remain in HousePool. Once a request matures, cancelRedeemRequest() rejects cancellation, while the degraded gate prevents settlement from reaching the funding phase (TrancheVault.sol:877-914; HousePool.sol:794-883). The LP can therefore neither recover the escrowed shares nor claim the corresponding assets through any path provided by the frozen contracts.

The local-fork PoC proves the terminal conditions rather than inferring them:

  • the deployed Engine owner becomes zero in the renounced branch;
  • an ordinary close executed through the deployed Router causes the Engine to latch degraded mode;
  • all LONG and SHORT positions are then closed;
  • both aggregate side liabilities are zero;
  • degraded mode remains latched;
  • a real matured Junior redemption stays pending and has zero claimable amount;
  • settlement reverts with exact selector 0x9f7adff3, HousePool__DegradedMode();
  • recovery reverts with exact selector 0x118cdaa7, OwnableUnauthorizedAccount(address); and
  • the same state from the same pre-branch snapshot settles and pays the same LP when ownership remains intact and the owner clears the latch.

This matches the listed Critical impact "Permanent freezing of funds." The PoC uses a 1-USDG Junior deposit as a nonzero witness. The position sizes are chosen so that, with the pool as it stood at the pinned block, the stressed close leaves effective assets below the maximum liability: the index falls from 1.00 to 0.20, an 80 percent decline, and a deeper pool would need larger positions or a larger move to latch. Senior funding passes through the same degraded-mode check in the same settlement function. I make no claim about production TVL, a total affected amount, a particular market move, pool utilization, or frequency.

Recommended remediation

Override renounceOwnership() in the Engine ownership lineage and revert, matching the three existing guards. For example, place the override in CfdTreasury so every Engine instance inherits it:

Solidity
/// @notice Ownership cannot be renounced because governance must retain emergency recovery authority.
function renounceOwnership() public view override onlyOwner {
    revert OwnableInvalidOwner(address(0));
}

Also:

  1. update the repository assumptions and the sentence in SECURITY.md that assume, at the frozen commit, that Engine renunciation succeeds;
  2. add automated regression coverage that composes renunciation, ordinary Router settlement into degraded mode, complete position/liability cleanup, and a matured LP redemption;
  3. assert that every contract holding a unique recovery authority rejects irreversible ownership loss; and
  4. consider a separately governed recovery design for the degraded latch so one ownership transition cannot permanently remove the only LP-exit recovery edge.

The narrow guard is sufficient to stop the demonstrated chain at its first step. On the local fork, a standalone control contract that carries the same one-function guard rejects the renunciation call: the transaction reverts and the owner is retained. The control is not a patched Engine, and it reverts with its own error name; the remediation above reverts with OwnableInvalidOwner(address(0)), as the three existing guards do. With the first step rejected, the ownerless terminal cannot be created.

Scope of the claim

The PoC proves the complete deployed-code path on the pinned local fork. It does not claim that ownership has already been renounced on a public deployment, that the measured test deployment holds production value, or that a particular market move will occur. Those questions are separate from the demonstrated frozen-source defect and its terminal consequence.

The fork uses the deployed release's own economics, which match the release parameters the program page states: maintenance margin 0.1%, initial margin 0.2%, execution fee 0.04%, frozen-close spread 0.50%, and a Senior cap of 40M USDG at 80% of the pool. The program states that the frozen code is intended for Arbitrum One with USDG and lists the v2.0.0 Arbitrum Sepolia deployment as the fork-testing resource; the release identifies six-decimal Mock USDG and test liquidity. This PoC therefore establishes deployed-code and release-shape behavior, not a live production state. Pool size matters to whether and when the latch occurs, and no production pool size is assumed.

References

Link to Proof of Concept

https://gist.github.com/AFestive/70f616da2e2afccc7cf6b0096ec46b27

Proof of Concept

Proof of concept

Safety, identity, and code delivery

The seven complete target/harness source files are inline below. Python comments and docstrings were removed mechanically to fit Immunefi's 65,535 character field limit; each normalized AST matches the corresponding retained 105/105-PASS source. The four Solidity files are byte-identical to the retained run. No exploit logic is delegated to the Gist.

The secret Gist contains only delivery/support material: the restricted state-read proxy, portable path/build wrapper, Foundry configuration, preregistration, release/code-hash checks, and retained logs/results. It also retains the original-format archive for byte-level evidence verification. The inline files are the PoC; the Gist is supporting evidence and safe execution plumbing.

This runs only on a fresh local Anvil fork of Arbitrum Sepolia v2.0.0 at block 323664360, chain ID 421614, from commit a82d4fefb02768e5b3bddcc97dee371eee24fea8. Before local adapters are installed, the wrapper checks all 30 deployed runtime hashes. It modifies only the external Pyth and ArbSys addresses on local Anvil, never an in-scope runtime, and sends no public-chain transaction.

Reproduction

  1. Clone the repository recursively, detach at the commit above, and install the pinned Foundry 1.5.1 toolchain plus Solc 0.8.35.
  2. Restore the seven inline files at their headings. Download the supporting files from secret Gist 70f616da2e2afccc7cf6b0096ec46b27 and place them beside executed/ as described by its README.
  3. Supply an Arbitrum Sepolia archive endpoint through PLETHER_FORK_RPC_URL, then run once with a new evidence path:
Bash
python3 portable_run.py \
  --repo /path/to/audit-comp-plether \
  --foundry-bin /path/to/foundry-1.5.1/bin \
  --evidence-dir /path/to/new-empty-parent/af001-run-01 \
  --ack-final-run

The retained run produced 105 PASS rows, no FAIL row, and 33 local transactions. The decisive output includes:

Text
renounced-owner-is-zero: PASS
renounced-owner-branch-long-liability-terminal: PASS
renounced-owner-branch-short-liability-terminal: PASS
renounced-owner-branch-degraded-still-latched: PASS
renounced-owner-branch-redemption-remains-unfunded: PASS
owner-intact-branch-degraded-cleared: PASS
owner-intact-branch-lp-payment: PASS
renunciation-guard-control: PASS
run-result: PASS

The ownerless branch closes both side liabilities to zero but leaves degradedMode latched, so the matured LP redemption remains pending with zero claimable amount. Reverting to the identical snapshot while retaining the owner lets clearDegradedMode() unlock the same redemption and pays the LP 0.680312 USDG. The guard control rejects renunciation and retains ownership.

executed/run_once.py

Python
from __future__ import annotations
import argparse
import hashlib
import json
import pathlib
import socket
import subprocess
import sys
import time
import urllib.error
import urllib.request
ROOT = pathlib.Path(__file__).resolve().parents[4]
PLETHER = ROOT / 'plether-engagement-2026-11'
CODE = pathlib.Path(__file__).resolve().parent
SOURCE = PLETHER / 'source' / 'audit-comp-plether'
MANIFEST = SOURCE / 'deployments' / 'releases' / '2026-10-28-perps-arbitrum-sepolia-v2.0.0' / 'manifest.json'
OUT = pathlib.Path('/data/market/debug-contracts/scratch/plether-af001-local-fork-2026-11-02-codex-r01/code/out')
LOG_DIR = pathlib.Path('/data/logs/plether-af001-local-fork-2026-11-02-codex-r01')
FOUNDRY = PLETHER / '.scratch' / 'toolchains' / 'foundry-v1.5.1' / 'versions' / 'foundry-rs' / 'foundry' / 'v1.5.1'
CAST = FOUNDRY / 'cast'
ANVIL = FOUNDRY / 'anvil'
PROXY = ROOT / 'docs' / 'venture' / 'tools' / 'rpc_key_proxy.py'
PROXY_PORT = 28680
ANVIL_PORT = 28681
PROXY_LOCAL_URL = 'http://127.0.0.1:28680'
ANVIL_LOCAL_URL = 'http://127.0.0.1:28681'
UPSTREAM_HOST = 'arb-sepolia.g.alchemy.com'
FORK_BLOCK = 323664360
CHAIN_ID = 421614
TOKEN = '0x3d051dbbf5ff427a4ae8ad09746902666af8fb9d'
ENGINE = '0xca18a6783d7542f9d2f28f4f259772b74c4d6baa'
POOL = '0xeb5604c393843b2f3c347ec24fa9ddad6ab2131e'
VAULT = '0x4a8b67184a1e3224c11a191cc69f22c50eef734e'
PYTH = '0x0b73614636c855bf23f342f307fb981a3e47f42b'
OWNER = '0x5a71a4094ec81165ada48aa4c27da48ec27e0d6b'
PRICE_ENTRY = 100000000
PRICE_STRESS = 20000000
LP_ASSETS = 100000 * 10 ** 6
LONG_FUNDS = 100000 * 10 ** 6
SHORT_FUNDS = 200000 * 10 ** 6
SIZE_400K = 400000 * 10 ** 18
SIZE_300K = 300000 * 10 ** 18
SIZE_700K = 700000 * 10 ** 18
MARGIN_50K = 50000 * 10 ** 6
RUN_LOG = LOG_DIR / 'run-final.jsonl'
RESULT = LOG_DIR / 'result-final.json'
PROXY_AUDIT = LOG_DIR / 'proxy-final.jsonl'
PROXY_STDOUT = LOG_DIR / 'proxy-final.stdout.log'
ANVIL_STDOUT = LOG_DIR / 'anvil-final.log'
_run_handle = None
_tx_count = 0

class RpcFailure(RuntimeError):
    pass

def _exclusive_paths() -> list[pathlib.Path]:
    return [RUN_LOG, RESULT, PROXY_AUDIT, PROXY_STDOUT, ANVIL_STDOUT]

def record(step: str, status: str, **details) -> None:
    row = {'time': time.strftime('%Y-%m-%dT%H:%M:%S%z'), 'step': step, 'status': status, **details}
    assert _run_handle is not None
    _run_handle.write(json.dumps(row, sort_keys=True) + '\n')
    _run_handle.flush()
    print(f'{step}: {status}', flush=True)

def rpc(method: str, params: list, local_url: str=ANVIL_LOCAL_URL):
    payload = json.dumps({'jsonrpc': '2.0', 'id': 1, 'method': method, 'params': params}).encode()
    request = urllib.request.Request(local_url, data=payload, headers={'Content-Type': 'application/json'})
    try:
        with urllib.request.urlopen(request, timeout=120) as response:
            body = json.loads(response.read())
    except urllib.error.HTTPError as error:
        raw = error.read()
        try:
            body = json.loads(raw)
        except json.JSONDecodeError as decode_error:
            raise RpcFailure(f'{method} HTTP {error.code} non-JSON response') from decode_error
    if 'error' in body:
        error = body['error']
        raise RpcFailure(f"{method}: code={error.get('code')} message={error.get('message')} data={error.get('data')}")
    return body['result']

def wait_for_anvil(process: subprocess.Popen) -> None:
    deadline = time.monotonic() + 180
    last_error = 'not attempted'
    while time.monotonic() < deadline:
        if process.poll() is not None:
            raise RuntimeError(f'Anvil exited during startup with {process.returncode}')
        try:
            if int(rpc('eth_chainId', []), 16) == CHAIN_ID:
                return
        except Exception as error:
            last_error = type(error).__name__
        time.sleep(0.25)
    raise RuntimeError(f'Anvil startup timeout; last error type {last_error}')

def ensure_port_free(port: int) -> None:
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
        sock.settimeout(0.2)
        if sock.connect_ex(('127.0.0.1', port)) == 0:
            raise RuntimeError(f'loopback port {port} is already in use')

def start_processes():
    ensure_port_free(PROXY_PORT)
    ensure_port_free(ANVIL_PORT)
    proxy_stdout = open(PROXY_STDOUT, 'x', encoding='utf-8')
    anvil_stdout = open(ANVIL_STDOUT, 'x', encoding='utf-8')
    proxy = None
    anvil = None
    try:
        proxy = subprocess.Popen([sys.executable, str(PROXY), '--port', str(PROXY_PORT), '--host', UPSTREAM_HOST, '--log', str(PROXY_AUDIT), '--max-requests', '100000'], cwd=ROOT, stdout=proxy_stdout, stderr=subprocess.STDOUT, text=True)
        time.sleep(0.25)
        if proxy.poll() is not None:
            raise RuntimeError(f'proxy exited during startup with {proxy.returncode}')
        anvil = subprocess.Popen([str(ANVIL), '--quiet', '--host', '127.0.0.1', '--port', str(ANVIL_PORT), '--fork-url', PROXY_LOCAL_URL, '--fork-block-number', str(FORK_BLOCK), '--no-rate-limit'], cwd=ROOT, stdout=anvil_stdout, stderr=subprocess.STDOUT, text=True)
        record('process-start', 'PASS', proxy_pid=proxy.pid, anvil_pid=anvil.pid)
        wait_for_anvil(anvil)
        return (proxy, anvil, proxy_stdout, anvil_stdout)
    except Exception:
        for process in (anvil, proxy):
            if process is not None and process.poll() is None:
                process.terminate()
                try:
                    process.wait(timeout=10)
                except subprocess.TimeoutExpired:
                    process.kill()
                    process.wait(timeout=10)
        anvil_stdout.close()
        proxy_stdout.close()
        raise

def stop_process(name: str, process: subprocess.Popen | None) -> None:
    if process is None:
        return
    if process.poll() is None:
        process.terminate()
        try:
            process.wait(timeout=10)
        except subprocess.TimeoutExpired:
            process.kill()
            process.wait(timeout=10)
    record(f'process-stop-{name}', 'PASS', pid=process.pid, exit_code=process.returncode)

def cast(*args: str) -> str:
    return subprocess.check_output([str(CAST), *args], cwd=ROOT, text=True).strip()

def calldata(signature: str, *args) -> str:
    return cast('calldata', signature, *(str(value) for value in args))

def selector(signature: str) -> str:
    return cast('sig', signature).lower()

def keccak_hex(value: str) -> str:
    return cast('keccak', value).lower()

def artifact(contract_file: str, contract_name: str) -> dict:
    path = OUT / contract_file / f'{contract_name}.json'
    with open(path, encoding='utf-8') as handle:
        return json.load(handle)

def object_hex(value: str) -> str:
    return value if value.startswith('0x') else '0x' + value

def wait_receipt(tx_hash: str) -> dict:
    deadline = time.monotonic() + 120
    while time.monotonic() < deadline:
        receipt = rpc('eth_getTransactionReceipt', [tx_hash])
        if receipt is not None:
            return receipt
        time.sleep(0.05)
    raise RuntimeError(f'receipt timeout for {tx_hash}')

def send(sender: str, to: str | None, data: str, label: str, expected_status: int=1) -> dict:
    global _tx_count
    transaction = {'from': sender, 'data': data, 'gas': hex(100000000), 'value': '0x0'}
    if to is not None:
        transaction['to'] = to
    tx_hash = rpc('eth_sendTransaction', [transaction])
    receipt = wait_receipt(tx_hash)
    status = int(receipt['status'], 16)
    _tx_count += 1
    record(label, 'PASS' if status == expected_status else 'FAIL', tx_hash=tx_hash, receipt=receipt, expected_status=expected_status)
    if status != expected_status:
        raise AssertionError(f'{label}: transaction status {status}, expected {expected_status}')
    return receipt

def deploy(sender: str, contract_file: str, contract_name: str, label: str) -> str:
    build = artifact(contract_file, contract_name)
    receipt = send(sender, None, object_hex(build['bytecode']['object']), label)
    address = receipt.get('contractAddress')
    if not address:
        raise AssertionError(f'{label}: no contract address')
    return address.lower()

def call_raw(to: str, signature: str, *args) -> str:
    return rpc('eth_call', [{'to': to, 'data': calldata(signature, *args)}, 'latest'])

def words(raw: str) -> list[int]:
    payload = raw[2:]
    if len(payload) % 64:
        raise AssertionError('non-word-aligned ABI response')
    return [int(payload[offset:offset + 64], 16) for offset in range(0, len(payload), 64)]

def uint_call(to: str, signature: str, *args) -> int:
    values = words(call_raw(to, signature, *args))
    if len(values) != 1:
        raise AssertionError(f'{signature}: expected one word, got {len(values)}')
    return values[0]

def bool_call(to: str, signature: str, *args) -> bool:
    value = uint_call(to, signature, *args)
    if value not in (0, 1):
        raise AssertionError(f'{signature}: invalid bool {value}')
    return bool(value)

def address_call(to: str, signature: str, *args) -> str:
    raw = call_raw(to, signature, *args)
    if len(raw) != 66:
        raise AssertionError(f'{signature}: invalid address ABI length')
    return '0x' + raw[-40:].lower()

def bytes4_call(to: str, signature: str, *args) -> str:
    raw = call_raw(to, signature, *args)
    if len(raw) != 66:
        raise AssertionError(f'{signature}: invalid bytes4 ABI length')
    return ('0x' + raw[2:10]).lower()

def current_timestamp() -> int:
    block = rpc('eth_getBlockByNumber', ['latest', False])
    return int(block['timestamp'], 16)

def advance_to(timestamp: int, label: str) -> None:
    current = current_timestamp()
    if timestamp > current:
        rpc('evm_setNextBlockTimestamp', [timestamp])
    rpc('evm_mine', [])
    observed = current_timestamp()
    if observed < timestamp:
        raise AssertionError(f'{label}: timestamp {observed} below {timestamp}')
    record(label, 'PASS', requested=timestamp, observed=observed)

def advance(seconds: int, label: str) -> None:
    rpc('evm_increaseTime', [seconds])
    rpc('evm_mine', [])
    record(label, 'PASS', seconds=seconds, observed=current_timestamp())

def assert_equal(label: str, observed, expected) -> None:
    ok = observed == expected
    record(label, 'PASS' if ok else 'FAIL', observed=observed, expected=expected)
    if not ok:
        raise AssertionError(f'{label}: observed {observed!r}, expected {expected!r}')

def assert_positive(label: str, observed: int) -> None:
    ok = observed > 0
    record(label, 'PASS' if ok else 'FAIL', observed=observed)
    if not ok:
        raise AssertionError(f'{label}: expected positive value')

def manifest_runtime_check() -> None:
    with open(MANIFEST, encoding='utf-8') as handle:
        release = json.load(handle)
    rows = []
    for name, item in release['contracts'].items():
        address = item['address'].lower()
        code = rpc('eth_getCode', [address, 'latest'])
        actual = keccak_hex(code)
        expected = item['runtimeCodeHash'].lower()
        rows.append({'name': name, 'address': address, 'actual': actual, 'expected': expected})
        if actual != expected:
            record('runtime-hashes', 'FAIL', rows=rows)
            raise AssertionError(f'runtime mismatch: {name}')
    record('runtime-hashes', 'PASS', count=len(rows), rows=rows)

def set_external_pyth_adapter() -> None:
    build = artifact('LocalPythAdapter.sol', 'LocalPythAdapter')
    runtime = object_hex(build['deployedBytecode']['object'])
    rpc('anvil_setCode', [PYTH, runtime])
    observed = rpc('eth_getCode', [PYTH, 'latest'])
    assert_equal('external-pyth-adapter-code', keccak_hex(observed), keccak_hex(runtime))

def actor_send(sender: str, actor: str, signature: str, args: tuple, label: str) -> dict:
    return send(sender, actor, calldata(signature, *args), label)

def commit_execute(sender: str, actor: str, side: int, close: bool, size: int, margin: int, price: int, label: str) -> int:
    if close:
        actor_send(sender, actor, 'commitClose(uint8,uint256)', (side, size), f'{label}-commit')
    else:
        actor_send(sender, actor, 'commitOpen(uint8,uint256,uint256)', (side, size, margin), f'{label}-commit')
    order_id = uint_call(actor, 'lastOrderId()')
    advance(2, f'{label}-post-commit-time')
    actor_send(sender, actor, 'executeLast(uint256)', (price,), f'{label}-execute')
    record(f'{label}-order', 'PASS', order_id=order_id, actor=actor, price=price)
    return order_id

def position_size(account: str) -> int:
    return words(call_raw(ENGINE, 'positions(address)', account))[0]

def side_liability(side: int) -> int:
    return words(call_raw(ENGINE, 'sides(uint256)', side))[0]

def terminal_sequence(sender: str, long_actor: str, short_actor: str, branch: str) -> None:
    commit_execute(sender, short_actor, 1, False, SIZE_400K, MARGIN_50K, PRICE_ENTRY, f'{branch}-short-open-400k')
    commit_execute(sender, long_actor, 0, False, SIZE_400K, MARGIN_50K, PRICE_ENTRY, f'{branch}-long-open-400k')
    commit_execute(sender, short_actor, 1, False, SIZE_300K, MARGIN_50K, PRICE_ENTRY, f'{branch}-short-open-300k')
    assert_equal(f'{branch}-long-size-open', position_size(long_actor), SIZE_400K)
    assert_equal(f'{branch}-short-size-open', position_size(short_actor), SIZE_700K)
    commit_execute(sender, long_actor, 0, True, SIZE_400K, 0, PRICE_STRESS, f'{branch}-long-close-stress')
    assert_equal(f'{branch}-degraded-latched', bool_call(ENGINE, 'degradedMode()'), True)
    commit_execute(sender, short_actor, 1, True, SIZE_700K, 0, PRICE_ENTRY, f'{branch}-short-close-terminal')
    assert_equal(f'{branch}-long-size-terminal', position_size(long_actor), 0)
    assert_equal(f'{branch}-short-size-terminal', position_size(short_actor), 0)
    assert_equal(f'{branch}-long-liability-terminal', side_liability(0), 0)
    assert_equal(f'{branch}-short-liability-terminal', side_liability(1), 0)
    assert_equal(f'{branch}-degraded-still-latched', bool_call(ENGINE, 'degradedMode()'), True)

def request_mature_redeem(sender: str, lp_actor: str, branch: str) -> int:
    actor_send(sender, lp_actor, 'requestAllJuniorRedeem()', (), f'{branch}-request-redeem')
    request_id = uint_call(lp_actor, 'lastRedeemId()')
    epoch_start = uint_call(POOL, 'lpEpochStart(uint256)', request_id)
    advance_to(epoch_start + 1, f'{branch}-redeem-maturity')
    pending = uint_call(VAULT, 'pendingRedeemRequest(uint256,address)', request_id, lp_actor)
    assert_positive(f'{branch}-pending-before-settlement', pending)
    return request_id

def probe_blocked_settlement(sender: str, lp_actor: str, request_id: int, branch: str) -> None:
    actor_send(sender, lp_actor, 'probeSettleLpEpoch(uint256)', (PRICE_ENTRY,), f'{branch}-probe-settlement')
    assert_equal(f'{branch}-settlement-call-fa

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

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 Engine ownership lineage inherits OpenZeppelin's renounceOwnership() without an override, so the only owner-only recovery transition (clearDegradedMode) can be permanently removed while the degraded latch still blocks LP redemption funding.

Impact

Matured but unfunded Senior and Junior LP redemption requests could be permanently frozen, since they can neither be settled nor cancelled, though already-funded claims remain claimable.

What the attacker needed

Engine owner calls renounceOwnership; later settlement latches degraded mode; LP redemption matures unfunded

The fix

Override renounceOwnership() in the Engine ownership lineage to revert, matching the three existing guards, and add regression coverage.

How it was found

  1. Renounce ownership on the Engine so the owner becomes the zero address.
  2. Execute an ordinary close through the Router so the Engine latches degraded mode.
  3. Close all positions and bring both side liabilities to zero; the latch stays set.
  4. Attempt to settle a matured Junior redemption, which reverts with the degraded-mode error.
  5. Attempt recovery, which reverts with an ownership-authorisation error.

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.

Some smart contracts have an 'owner' account that holds special powers, such as clearing an emergency state. A contract can normally give up that owner role permanently, leaving nobody in charge. Here, giving up the role means an emergency flag can never be switched off, so users waiting to withdraw their money get stuck forever.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by FestiveSRT

View all

22 more disclosed reports, best first.

More from Plether

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.