Security

Instruction Ordering Attack

Exploit where an attacker crafts a transaction with instructions in a specific order to manipulate program state between instructions within the same transaction. Since Solana executes all instructions in a transaction sequentially, earlier instructions can modify account state that later instructions depend on, enabling unexpected state transitions.

IDinstruction-ordering-attack

Plain meaning

Start with the shortest useful explanation before going deeper.

Exploit where an attacker crafts a transaction with instructions in a specific order to manipulate program state between instructions within the same transaction. Since Solana executes all instructions in a transaction sequentially, earlier instructions can modify account state that later instructions depend on, enabling unexpected state transitions.

Mental model

Use the quick analogy first so the term is easier to reason about when you meet it in code, docs, or prompts.

Think of it as a building block that connects one definition to the larger Solana system around it.

Technical context

Place the term inside its Solana layer so the definition is easier to reason about.

Failure modes, audits, attack surfaces, and safe design patterns.

Why builders care

Turn the term from vocabulary into something operational for product and engineering work.

This term unlocks adjacent concepts quickly, so it works best when you treat it as a junction instead of an isolated definition.

AI handoff

AI handoff

Use this compact block when you want to give an agent or assistant grounded context without dumping the entire page.

Instruction Ordering Attack (instruction-ordering-attack)
Category: Security
Definition: Exploit where an attacker crafts a transaction with instructions in a specific order to manipulate program state between instructions within the same transaction. Since Solana executes all instructions in a transaction sequentially, earlier instructions can modify account state that later instructions depend on, enabling unexpected state transitions.
Related: Instruction, Transaction, Front-Running
Glossary Copilot

Ask grounded Solana questions without leaving the glossary.

Use glossary context, relationships, mental models, and builder paths to get structured answers instead of generic chat output.

Explain this code

Optional: paste Anchor, Solana, or Rust code so the Copilot can map primitives back to glossary terms.

Ask a glossary-grounded question

Ask a glossary-grounded question

The Copilot will answer using the current term, related concepts, mental models, and the surrounding glossary graph.

Concept graph

See the term as part of a network, not a dead-end definition.

These branches show which concepts this term touches directly and what sits one layer beyond them.

Branch

Instruction

A single operation within a transaction that invokes a program. An instruction specifies: (1) the program ID to call, (2) an array of account metas (pubkey, is_signer, is_writable), and (3) an opaque data byte array. Programs decode the instruction data to determine which operation to perform.

Branch

Transaction

An atomic unit of execution containing one or more instructions, a recent blockhash, and one or more signatures. All instructions in a transaction execute sequentially and atomically—if any instruction fails, the entire transaction reverts. Transactions have a 1,232-byte size limit (matching IPv6 MTU) and a default 200,000 CU budget.

Branch

Front-Running

An attack where an adversary observes a pending or not-yet-finalized transaction (e.g., a large swap or NFT mint) and submits a competing transaction with higher priority fees or via validator relationships to execute before the victim's transaction, profiting from predictable price impact. On Solana, transactions are not held in a public mempool the same way as in Ethereum — leaders receive transactions privately — but front-running is still possible through Jito's block engine bundle mechanism, validator collusion, or by monitoring gossip. Slippage tolerance parameters and commit-reveal schemes are the primary application-level defenses.

Next concepts to explore

Keep the learning chain moving instead of stopping at one definition.

These are the next concepts worth opening if you want this term to make more sense inside a real Solana workflow.

Programming Model

Instruction

A single operation within a transaction that invokes a program. An instruction specifies: (1) the program ID to call, (2) an array of account metas (pubkey, is_signer, is_writable), and (3) an opaque data byte array. Programs decode the instruction data to determine which operation to perform.

Programming Model

Transaction

An atomic unit of execution containing one or more instructions, a recent blockhash, and one or more signatures. All instructions in a transaction execute sequentially and atomically—if any instruction fails, the entire transaction reverts. Transactions have a 1,232-byte size limit (matching IPv6 MTU) and a default 200,000 CU budget.

Security

Front-Running

An attack where an adversary observes a pending or not-yet-finalized transaction (e.g., a large swap or NFT mint) and submits a competing transaction with higher priority fees or via validator relationships to execute before the victim's transaction, profiting from predictable price impact. On Solana, transactions are not held in a public mempool the same way as in Ethereum — leaders receive transactions privately — but front-running is still possible through Jito's block engine bundle mechanism, validator collusion, or by monitoring gossip. Slippage tolerance parameters and commit-reveal schemes are the primary application-level defenses.

Security

Insufficient Account Constraints

A broad vulnerability category in Anchor programs where the account struct's constraint annotations — such as has_one, constraint = expr, seeds, bump, mint, authority, and token::mint — are missing or incomplete, allowing callers to supply accounts that pass deserialization and ownership checks but violate the program's intended relationships. For example, omitting has_one = authority on a vault account means any account can be passed as the authority; omitting mint = token_account.mint on an SPL token account means a different mint's token account could be substituted. Thorough Anchor account structs should declare every meaningful relationship between accounts as a typed constraint.

Commonly confused with

Terms nearby in vocabulary, acronym, or conceptual neighborhood.

These entries are easy to mix up when you are reading quickly, prompting an LLM, or onboarding into a new layer of Solana.

Securityrevival-attack

Account Revival Attack

An exploit that resurrects an account that a program has logically closed within the same transaction by sending lamports back to it before the transaction finalizes, causing its on-chain data — which was never securely wiped — to re-appear as a funded, seemingly valid account in future transactions. Because the Solana runtime keeps an account alive as long as it holds any lamports, transferring even 1 lamport back to a closed-but-not-wiped account prevents its deletion and allows an attacker to reuse its stale state. The defense is to explicitly overwrite account data with a closed discriminator and to use force-defund patterns so any lamports transferred in during the same transaction are immediately drained.

Securityflash-loan-attack

Flash Loan Attack

An exploit where an attacker borrows a large amount of tokens via an uncollateralized flash loan, uses the borrowed funds to manipulate protocol state (typically distorting oracle prices or satisfying collateral requirements), extracts profit from the manipulated state, and repays the loan — all within a single atomic transaction. On Solana, flash loans are possible because transactions are atomic: if any instruction fails, the entire transaction reverts including the loan. Defenses include using time-weighted oracle prices, enforcing borrowing caps, and requiring multi-slot settlement.

Securitysandwich-attack

Sandwich Attack

A form of MEV where an attacker places one transaction immediately before (front-run) and one immediately after (back-run) a victim's large AMM swap: the front-run buys the asset first, driving up the price the victim pays, and the back-run sells the asset immediately after the victim's transaction at the inflated price, extracting the difference as profit. On Solana, sandwich attacks are facilitated through Jito bundles, which allow searchers to atomically guarantee ordering of multiple transactions within a block. Victims can mitigate exposure by setting tight slippage tolerances (e.g., 0.1–0.5%) and using DEX aggregators that route across multiple pools to reduce single-pool price impact.

Related terms

Follow the concepts that give this term its actual context.

Glossary entries become useful when they are connected. These links are the shortest path to adjacent ideas.

Programming Modelinstruction

Instruction

A single operation within a transaction that invokes a program. An instruction specifies: (1) the program ID to call, (2) an array of account metas (pubkey, is_signer, is_writable), and (3) an opaque data byte array. Programs decode the instruction data to determine which operation to perform.

Programming Modeltransaction

Transaction

An atomic unit of execution containing one or more instructions, a recent blockhash, and one or more signatures. All instructions in a transaction execute sequentially and atomically—if any instruction fails, the entire transaction reverts. Transactions have a 1,232-byte size limit (matching IPv6 MTU) and a default 200,000 CU budget.

Securityfront-running

Front-Running

An attack where an adversary observes a pending or not-yet-finalized transaction (e.g., a large swap or NFT mint) and submits a competing transaction with higher priority fees or via validator relationships to execute before the victim's transaction, profiting from predictable price impact. On Solana, transactions are not held in a public mempool the same way as in Ethereum — leaders receive transactions privately — but front-running is still possible through Jito's block engine bundle mechanism, validator collusion, or by monitoring gossip. Slippage tolerance parameters and commit-reveal schemes are the primary application-level defenses.

More in category

Stay in the same layer and keep building context.

These entries live beside the current term and help the page feel like part of a larger knowledge graph instead of a dead end.

Security

Missing Signer Check

A vulnerability where a program accepts an account in a privileged role (e.g., admin, authority, payer) without verifying that the account actually signed the transaction, allowing any caller to impersonate that authority by simply passing the target pubkey as an instruction account. In native Solana programs, the check requires asserting account.is_signer == true; in Anchor, the Signer<'info> type enforces this automatically. Exploitation lets an attacker bypass all access control gated on authority equality checks, making it one of the most critical and commonly audited vulnerabilities in Solana programs.

Security

Missing Owner Check

A vulnerability where a program deserializes and trusts account data without first confirming that the account is owned by the expected program, allowing an attacker to substitute a maliciously crafted account owned by a different program whose byte layout happens to satisfy the deserialization. On Solana, every account stores a 32-byte owner field set to the program that created it; native programs must assert account.owner == &expected_program_id, while Anchor's Account<'info, T> wrapper performs this check automatically. Failure to validate ownership can lead to complete auth bypass if an attacker can construct a fake account whose data parses into a struct with elevated privileges.

Security

Arbitrary CPI

A vulnerability where a program accepts an arbitrary program account from the caller and invokes it via Cross-Program Invocation (CPI) without verifying it matches a known, trusted program ID, effectively letting an attacker substitute a malicious program that executes under the victim program's authority or manipulates accounts the victim program passes to it. A common pattern is accepting a token_program account without checking it equals spl_token::ID, so the attacker passes a lookalike program that records or drains account data. Prevention requires hard-coding or explicitly checking the program ID before every CPI call.

Security

PDA Substitution Attack

A vulnerability where a program derives a PDA internally but accepts an externally supplied account as that PDA without re-deriving and comparing the address, allowing an attacker to pass a different PDA (derived from attacker-controlled seeds) that the program will treat as legitimate. Because PDAs are deterministic, the only way to guarantee account identity is to call Pubkey::find_program_address (or equivalent) with the expected seeds inside the program and assert the result equals the supplied key. Anchor's seeds and bump constraints on the Account type automate this re-derivation and equality check.