# Rust smart contract audit: accounts, signers and the runtime

URL: https://shield.quillaudits.com/languages/rust/

A Rust smart contract audit checks the logic of the program and the rules of the runtime it runs on. On Solana that starts with every account the program accepts: who owns it, whether the right key signed, and whether it is the account the logic assumes. On CosmWasm and on Stylus for Arbitrum the questions change, but integer math, dependencies and the order of calls to other programs stay in scope. QuillShield audits Solidity today, so for Rust programs request a manual audit from QuillAudits.

**QuillShield doesn't support Rust today.** It audits Solidity in Foundry projects. For Rust code, [request a manual audit from QuillAudits](https://www.quillaudits.com/smart-contract-audit).

Last updated 3 December 2026. 7 minute read. By the QuillAudits Team.

## What does a Rust smart contract audit cover?

Rust handles memory safety, but a Rust smart contract still loses funds through its logic, so the audit reads the logic first. A [Rust security audit guide from Cyberscope](https://www.cyberscope.io/blog/rust-security-audits-a-complete-guide) lists reentrancy issues, integer overflow and underflow, misuse of `unsafe` blocks, flawed business logic and dependency risks as the classes reviewers look for.

[Three Sigma adds four](https://threesigma.xyz/services/rust-solana-audits) that come from how Rust programs store and upgrade state:

- Serialization drift, where changing struct fields, enum order or defaults breaks decoding of stored data.
- Storage layout changes that map old fields onto new meanings.
- Integer math and units, where Three Sigma recommends checked or saturating operations.
- State updated after a cross-program call, which lets the external effect happen before the invariants of the program are enforced.

The runtime sets the rest of the scope:

- **Solana.** The transaction passes in every account a program reads or writes, so the program must check each one, which the next section covers.
- **CosmWasm.** Contracts on Cosmos chains that use CosmWasm receive messages and send their own. The review follows each message, the funds attached to it and the replies that come back.
- **Stylus on Arbitrum.** Programs written in Rust are [compiled to WebAssembly and run alongside Solidity contracts](https://docs.arbitrum.io/assets/files/2024_09_05_open_zeppelin_security_audit_stylus_rust_sdk-a78b94ded01f4e5f96dfd55a47158680.pdf), so the review covers calls in both directions and the Rust SDK the program is built on.

## Why do Solana programs need account and signer checks?

A Solana program doesn't look up the accounts it works on, because the caller hands them in, so the program has to check, for every account, that the expected program owns it, that the right key signed when signing matters, and that it is the specific account the logic assumes, such as the real sysvar account or the mint that belongs to a given vault. The [audit scope Three Sigma publishes](https://threesigma.xyz/services/rust-solana-audits) names signer and ownership validation for this reason. A missing check lets an attacker pass in an account they built themselves.

| Protocol | Wormhole bridge, Solana side |
| --- | --- |
| Date | 2 February 2022 |
| Chain | Solana |
| Loss | 120,000 wrapped ETH minted, worth over $320M according to CertiK |
| What happened | The Wormhole program on Solana checked guardian signatures with `load_instruction_at`, a deprecated function that did not check that the account passed in was the real sysvar account. The attacker passed in a fake one, the signature check passed, and the program minted 120,000 wrapped ETH. Ackee Blockchain sums up the root cause as a missing ownership check on one account. |
| Sources | [Kudelski Security](https://kudelskisecurity.com/research/quick-analysis-of-the-wormhole-attack), [CertiK](https://www.certik.com/blog/wormhole-bridge-exploit-incident-analysis), [Ackee Blockchain](https://ackee.xyz/blog/2022-solana-hacks-explained-wormhole/) |

The [Kudelski Security analysis](https://kudelskisecurity.com/research/quick-analysis-of-the-wormhole-attack) records that Solana deprecated `load_instruction_at` in October 2021, months before the attack, which [CertiK dates](https://www.certik.com/blog/wormhole-bridge-exploit-incident-analysis) to 5:58 PM UTC on 2 February 2022, so the program was still calling a function that Solana had already deprecated. The [Ackee Blockchain write-up](https://ackee.xyz/blog/2022-solana-hacks-explained-wormhole/) walks through the accounts involved.

Cashio shows the same class with two accounts that had to match. According to [CertiK](https://www.certik.com/blog/security-risks-of-stablecoins), Cashio, a stablecoin backed by interest-bearing Saber USD liquidity provider tokens, lost $52.8M in 2022 because the code failed to check that the banking token and the minted token matched.

## What are the main Rust security vulnerabilities?

The table groups the classes by where they show up. Solidity pages are linked where the mechanics carry over.

| Bug class | Where it shows up | What to check |
| --- | --- | --- |
| Missing owner or identity check | Solana: an account passed in is not the one the logic assumes, as with the sysvar account in the Wormhole case. | For each account, which program must own it, and which address or seeds must it match? |
| Missing signer check | Solana: an instruction that moves funds or changes settings runs without a signature from the authority. | Does every privileged instruction require the right signer? |
| Accounts that must match | Solana: two related accounts are never checked against each other, as with the banking and minted tokens at Cashio. | Is each vault checked against its mint, and each position against its owner? |
| [Integer overflow and units](https://shield.quillaudits.com/learn/vulnerabilities/integer-overflow-underflow/) | Any runtime: amounts in mixed decimals, or arithmetic that wraps. | Are amounts computed with checked or saturating operations, in one unit? |
| State changed after an external call | Solana cross-program calls and CosmWasm messages: the external effect happens before the state of the program is final. | Is state final before each call to another program? |
| Serialization and layout drift | Upgrades that change struct fields, enum order or defaults. | Can the new code still decode every account or stored item the old code wrote? |
| `unsafe` blocks | Any Rust code, including dependencies. | Is each `unsafe` block needed, small and documented? |
| Dependency risks | Crates and SDKs, such as the Solana SDK or the Stylus SDK. | Is `cargo audit` clean, are versions pinned, and are deprecation notices read? |
| [Access control](https://shield.quillaudits.com/learn/vulnerabilities/access-control/) | CosmWasm and Stylus: messages or functions that change config, admins or code. | Who can change settings or upgrade the contract, and is that key held the way the docs say? |
| [Signature replay](https://shield.quillaudits.com/learn/vulnerabilities/signature-replay/) | Any runtime that accepts signed messages, such as a bridge. | Does each signed message carry a nonce, a domain and an expiry? |

## What should a CosmWasm review add?

CosmWasm code is Rust, so everything above applies. These questions are the ones a reviewer adds for contracts that talk through messages:

- Is every address that arrives in a message checked as a valid address on that chain before it is stored or compared?
- Are the funds sent with a message checked against what the message says they are?
- Do replies to submessages handle the failure path as carefully as the success path?
- Can any loop over stored entries grow with user input until it runs out of gas? The [denial of service](https://shield.quillaudits.com/learn/vulnerabilities/denial-of-service/) page covers the pattern.
- Who can migrate the contract or change its admin, and is that process written down?
- Does rounding in share, reward or fee math favor the contract? See [rounding and precision errors](https://shield.quillaudits.com/learn/vulnerabilities/rounding-precision-errors/).

## What changes when Rust runs on an EVM chain?

On Arbitrum, Stylus programs written in Rust are compiled to WebAssembly and deployed on-chain, where they can run alongside Solidity contracts. An [audit of the Stylus Rust SDK](https://docs.arbitrum.io/assets/files/2024_09_05_open_zeppelin_security_audit_stylus_rust_sdk-a78b94ded01f4e5f96dfd55a47158680.pdf), run from 8 July to 9 August 2024 and published in the Arbitrum docs, reported 36 findings, 2 of them Critical and 2 High. The SDK release a program is built on is part of what its audit has to pin.

A Stylus program that calls Solidity contracts, or is called by them, needs both sides reviewed. QuillShield covers the Solidity side, in a Foundry project, as the [Solidity audit page](https://shield.quillaudits.com/languages/solidity/) describes, and the Rust side needs a manual review.

## Which tools exist for Rust smart contract security?

- [Clippy](https://github.com/rust-lang/rust-clippy), the Rust linter, which the Cyberscope guide says catches a meaningful range of common issues through linting alone.
- [cargo audit](https://github.com/rustsec/rustsec/tree/main/cargo-audit), which flags crates with known vulnerabilities in your dependency tree, and which Cyberscope recommends running regularly.

Linters and dependency scanners don't know which accounts a Solana instruction must check or what a CosmWasm message promises. That part comes from review and from tests, and the Rust and Solana method Three Sigma describes names property tests, focused fuzzing and fork or devnet simulations.

## Can QuillShield audit Rust?

QuillShield does not audit Rust today. It supports Solidity, for Foundry projects, and its full audit and pull request checks don't cover Rust programs on Solana, CosmWasm or Stylus. For a Rust codebase, [request a manual audit from QuillAudits](https://www.quillaudits.com/smart-contract-audit), the audit firm that makes QuillShield, which has audited 1,500+ protocols since 2018 and is ISO/IEC 27001:2022 certified.

Cross-chain systems often have both: a Rust program on one side and Solidity contracts on an EVM chain on the other. The [bridge audit page](https://shield.quillaudits.com/use-cases/bridges/) covers what to check on the Solidity side, and [AI audit vs manual audit](https://shield.quillaudits.com/blog/ai-audit-vs-manual-audit/) covers how the two kinds of review split the work.

**[Talk to an auditor](https://calendly.com/akshadh-a-quillaudits/30min) about the scope and timing of a manual Rust audit.**

## What should you check before a Rust audit?

- For every Solana instruction, is there a written list of each account, its owner, whether it must sign and what it must match?
- If the program uses Anchor, does every account have a type or constraint that checks it, and is each unchecked account justified in a comment?
- Are all amounts computed with checked or saturating operations?
- Is state final before every cross-program call or outgoing message?
- Can every upgrade still decode the accounts and stored items the previous version wrote?
- Is `cargo audit` clean, and have you read the deprecation notes for the SDK release you pin?
- For CosmWasm, is every incoming address checked before use, and every attached fund matched to the message?

## FAQ

### Does Rust memory safety make smart contracts secure?

Memory safety doesn't cover logic, and logic is where the losses come from. The Wormhole program on Solana lost 120,000 wrapped ETH to [a missing check on one account](https://ackee.xyz/blog/2022-solana-hacks-explained-wormhole/), with no memory bug involved.

### What went wrong in the Wormhole hack?

Its signature check used `load_instruction_at`, a deprecated function that [did not check that the account passed in was the real sysvar account](https://kudelskisecurity.com/research/quick-analysis-of-the-wormhole-attack). The attacker passed a fake one on 2 February 2022 and minted 120,000 wrapped ETH.

### Should a Solana program use checked arithmetic?

Use checked or saturating operations for every amount. [Three Sigma recommends](https://threesigma.xyz/services/rust-solana-audits) them, together with invariant and property tests, to block integer overflow and underflow.

### Does QuillShield support Rust, Solana or CosmWasm?

QuillShield supports Solidity in Foundry projects today, so for Rust programs, request a manual audit from QuillAudits.

## Sources

- [Quick analysis of the Wormhole attack, Kudelski Security](https://kudelskisecurity.com/research/quick-analysis-of-the-wormhole-attack) · checked 3 December 2026
- [Wormhole bridge exploit incident analysis, CertiK](https://www.certik.com/blog/wormhole-bridge-exploit-incident-analysis) · checked 3 December 2026
- [2022 Solana hacks explained: Wormhole, Ackee Blockchain](https://ackee.xyz/blog/2022-solana-hacks-explained-wormhole/) · checked 3 December 2026
- [Security risks of stablecoins, CertiK](https://www.certik.com/blog/security-risks-of-stablecoins) · checked 3 December 2026
- [Rust and Solana audits, Three Sigma](https://threesigma.xyz/services/rust-solana-audits) · checked 3 December 2026
- [Rust security audits: a complete guide, Cyberscope](https://www.cyberscope.io/blog/rust-security-audits-a-complete-guide) · checked 3 December 2026
- [Stylus Rust SDK security audit, September 2024, Arbitrum docs](https://docs.arbitrum.io/assets/files/2024_09_05_open_zeppelin_security_audit_stylus_rust_sdk-a78b94ded01f4e5f96dfd55a47158680.pdf) · checked 3 December 2026
- [Clippy, Rust project](https://github.com/rust-lang/rust-clippy)
- [cargo audit, RustSec](https://github.com/rustsec/rustsec/tree/main/cargo-audit)
