Cairo Smart Contract Audit

A Cairo audit is a security review of Starknet contracts written in Cairo, focused on field-element arithmetic that does not behave like integer arithmetic, native account abstraction changing what caller identity means, L1 to L2 message handling, and the contract class and upgrade model.

Why Cairo code needs a specialist review

Cairo's primitive type is a field element, not a machine integer. Arithmetic wraps around the prime field, so a subtraction that "cannot go negative" produces an enormous positive value instead, and a range check you did not write is a range check that does not exist. This single difference invalidates a great deal of intuition carried over from Solidity, and it is the source of a large share of the findings we report on Cairo code.

The second source is account abstraction. On Starknet every account is a contract, so signature validation, multicall behaviour and the meaning of the caller address are all contract-defined rather than protocol-guaranteed. We review the account contracts, the entry point validation split, and every place your logic assumes the caller is a simple key-holder.

Cairo-specific security considerations

Felt arithmetic and range checks

Field-element wraparound, u256 helper correctness, downcasts, and every comparison that assumes integer semantics it does not have.

Native account abstraction

__validate__ and __execute__ separation, signature scheme assumptions, multicall atomicity, and logic that treats the caller as an EOA.

L1 to L2 messaging

Message consumption and replay protection, messages sent but never consumed, and value stranded when the L2 handler reverts.

Storage addressing and collisions

Storage variable address derivation, mapping key collisions, and packed-struct assumptions across upgrades.

Class hash and upgrade authority

replace_class authority, declare/deploy separation, and constructor logic across upgrade boundaries.

Sequencer and fee behaviour

Fee estimation, sequencer liveness assumptions in time-sensitive logic, and behaviour under congestion.

Tooling we run on Cairo

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

Cairo audit: frequently asked questions

Why is Cairo arithmetic a security concern?

Because felts are field elements, not integers. Underflow does not revert — it produces a huge positive number. Any comparison or balance check written with Solidity intuition can be wrong in a way that compiles and passes happy-path tests.

Do you audit Cairo 1 / Cairo 2 contracts?

Yes, and modern Cairo with its component model is the common case. We also review older Cairo 0 code where a migration is in progress, which has its own bug classes at the boundary.

Do you review our account contract?

Yes. On Starknet the account contract is a security boundary in a way it never is on Ethereum, and a weak validate implementation compromises everything the account can reach.

Can you review the L1 side too?

Yes — the Solidity bridge or messaging contract on L1 is part of the same system, and most messaging findings live at the seam between the two sides.

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.

Chains that run Cairo

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.