Perpetual DEX Security Audit

Perp DEX Audit — A perpetual DEX audit reviews the derivatives engine — margin accounting, funding rates, mark price construction, liquidation and auto-deleveraging, and the insurance fund — to determine whether a trader can extract value from the protocol or leave it holding unbacked losses.

What a perp dex audit covers

Perp DEXs combine the hardest parts of DeFi: continuous accounting, oracle dependence, adversarial market participants and a liquidation engine that must work fastest exactly when the chain is most congested. The failure modes are specific and repeatable — self-trading against your own liquidity, funding-rate manipulation, mark price divergence, and insurance funds sized for normal volatility rather than the event that actually happens.

We test the engine under adversarial conditions rather than average ones: what a well-capitalised trader can do with maximum leverage across correlated markets, what happens when the oracle lags the real market by two blocks, and whether ADL distributes losses the way the documentation claims.

Vulnerability classes we look for

Margin and PnL accounting errors

Unrealised PnL counted as collateral, cross- vs isolated-margin boundary errors, and rounding that accumulates in the trader's favour.

Mark price and oracle latency

Mark price constructible by the trader, index/mark divergence exploitable within the update window, and stale-price behaviour during volatility.

Funding rate manipulation

Funding computed from a manipulable imbalance, sampling windows that can be pinned, and payments that can be dodged by entering and exiting around the settlement block.

Liquidation engine failure

Liquidations unprofitable under congestion, partial liquidation griefing, and positions that cannot be closed because liquidity does not exist at the assumed depth.

Auto-deleveraging and socialised loss

ADL ranking that can be gamed, and socialisation that hits the wrong counterparties or leaves the protocol short.

Insurance fund solvency

Fund sized against historical rather than adversarial volatility, and drain paths that do not require the market to move at all.

Self-trading and wash-trading paths

Taking both sides to farm rebates or points, and fee structures that make no-risk volume profitable.

Order and matching integrity

Off-chain matching trust assumptions, sequencer or keeper censorship, and order cancellation races.

In scope

Not in scope unless agreed

How the engagement runs

  1. Scoping and threat modelling

    We fix a commit hash, agree the in-scope contracts and read your architecture docs, then build a threat model: who the actors are, what the trust boundaries are, and which invariants must never break. Nothing is reviewed against assumptions we have not written down.

  2. Manual review

    Line-by-line review by at least two auditors working independently, focused on authorisation, accounting, upgrade paths, external integrations and the gap between what the code does and what the documentation claims it does. Most critical findings come from this phase, not from tooling.

  3. Static and dynamic analysis

    Static analysers appropriate to the language, plus property-based fuzzing and invariant testing to push the system into states no unit test covers. Tooling is used to widen coverage, never to replace the manual pass.

  4. Exploit-path simulation

    Candidate findings are proven on a forked network with a working proof of concept. We report what an attacker can actually do and what it costs them, not a theoretical severity label.

  5. Reporting

    Every finding gets a severity rating, reproduction steps, the affected code, the impact in concrete terms and a specific remediation. You get a draft for discussion before anything is finalised.

  6. Fix review and re-test

    We re-test every remediation against the original proof of concept and check that the fix has not opened a new path. The final report is yours to publish.

What you receive

How we rate severity

SeverityWhat it means
CriticalDirect loss of funds or permanent freezing of assets, exploitable by any actor.
HighLoss of funds or protocol insolvency under realistic conditions, or requiring a privileged actor to misbehave.
MediumBroken protocol behaviour, denial of service, or value leakage that does not directly drain the contract.
LowEdge-case incorrectness with limited impact, or an issue requiring implausible preconditions.
InformationalCode quality, gas efficiency, documentation mismatch and defence-in-depth suggestions.

Pricing

Single token contract: starts from $999, report in 24–48 hours. dApp, GameFi or RWA project: starts from $2,999. DeFi protocol, L2 / rollup, Bridge, ZK circuit, AI agent / MCP: scoped per project after we have seen the code.

Perp DEX Audit: frequently asked questions

Do you simulate adversarial market conditions?

Yes. We simulate maximum-leverage positions across correlated markets, oracle lag, congestion that delays liquidations, and coordinated positioning designed to move funding — then report where the protocol ends up short.

Can you review an off-chain order book with on-chain settlement?

Yes, and the trust boundary is the focus: what the matcher can do that it should not, what a user can prove if the matcher misbehaves, and what happens when it stops.

How do you assess insurance fund sizing?

Against adversarial rather than historical scenarios: the worst simultaneous move across correlated markets with realistic liquidation delays. Historical VaR is not a security argument.

Do you cover points and incentive programmes?

Yes. Incentive programmes are an attack surface — if risk-free volume earns rewards, someone will manufacture it, and that cost lands on the protocol.

What do you need from us to start an audit?

A repository or contract address, a commit hash to freeze the scope, whatever architecture or spec documentation exists, and a point of contact who can answer design questions. If documentation is thin we will write our understanding of the system back to you and ask you to confirm it — that step alone catches design-level bugs.

How long does an audit take?

A single token contract is 24–48 hours. A typical dApp or mid-sized protocol runs one to two weeks. Large DeFi systems, L2s, bridges and ZK circuits are scoped per project after we have seen the code. We will give you a fixed timeline with the quote, not an estimate that moves.

Is a re-test included after we fix the issues?

Yes. Fix review is part of the engagement, not an upsell. We re-run the original proof of concept against your patched code and confirm the fix has not introduced a new path.

Related security services

Get a fixed quote in 24 hours

Send the repository and a commit hash through the contact form, message @bugtester25 on Telegram, or book a 30-minute scoping call. 200+ protocols audited · $4B+ secured · 0 hacks post-audit. Prefer email? info@safeedges.in.