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.

IDpda-substitution

Plain meaning

Start with the shortest useful explanation before going deeper.

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.

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.

PDA Substitution Attack (pda-substitution)
Category: Security
Definition: 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.
Related: Program Derived Address (PDA), Seeds
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

Program Derived Address (PDA)

An account address derived deterministically from a program ID and a set of seeds, with no corresponding private key. PDAs are created by finding a pubkey that does NOT lie on the Ed25519 curve (using a bump seed). Since there's no private key, only the deriving program can sign for the PDA via invoke_signed, making PDAs ideal for program-controlled state.

Branch

Seeds

Byte arrays used as inputs to derive a Program Derived Address. Seeds can be any combination of static strings, user pubkeys, mint addresses, or other identifiers (each seed max 32 bytes, up to 16 seeds). For example, seeds=[b'vault', user.key()] derives a unique vault PDA for each user.

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

Program Derived Address (PDA)

An account address derived deterministically from a program ID and a set of seeds, with no corresponding private key. PDAs are created by finding a pubkey that does NOT lie on the Ed25519 curve (using a bump seed). Since there's no private key, only the deriving program can sign for the PDA via invoke_signed, making PDAs ideal for program-controlled state.

Programming Model

Seeds

Byte arrays used as inputs to derive a Program Derived Address. Seeds can be any combination of static strings, user pubkeys, mint addresses, or other identifiers (each seed max 32 bytes, up to 16 seeds). For example, seeds=[b'vault', user.key()] derives a unique vault PDA for each user.

Security

Precision Loss / Rounding Errors

A class of numerical vulnerability where integer division discards fractional remainders, causing systematic under-accounting of fees, interest, or token amounts that an attacker can exploit through repeated small transactions to drain protocol funds or receive more than entitled. Because Solana programs use integer arithmetic exclusively (no native floating point in on-chain code), division operations like amount / price always truncate toward zero, and protocols must decide whether to round in favor of the protocol (ceiling division for fees collected, floor division for tokens distributed) using formulas such as (numerator + denominator - 1) / denominator. Precision errors can also compound across fixed-point representations, so high-precision intermediate scaling (e.g., multiplying by 10^9 before dividing) is a common mitigation.

Security

OtterSec

Leading Solana security audit firm that has audited major protocols including Jupiter, Marinade, Jito, and the Solana runtime. Known for deep expertise in Rust/Solana program security and responsible vulnerability disclosure. One of the most trusted names in Solana security.

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.

Securityinstruction-ordering-attack

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.

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 Modelpda

Program Derived Address (PDA)

An account address derived deterministically from a program ID and a set of seeds, with no corresponding private key. PDAs are created by finding a pubkey that does NOT lie on the Ed25519 curve (using a bump seed). Since there's no private key, only the deriving program can sign for the PDA via invoke_signed, making PDAs ideal for program-controlled state.

Programming Modelseeds

Seeds

Byte arrays used as inputs to derive a Program Derived Address. Seeds can be any combination of static strings, user pubkeys, mint addresses, or other identifiers (each seed max 32 bytes, up to 16 seeds). For example, seeds=[b'vault', user.key()] derives a unique vault PDA for each user.

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

Account Reloading Attack

A vulnerability in Anchor programs where a program reads an account's data before making a CPI call, the CPI modifies that account's lamports or data, but the program continues using the stale pre-CPI snapshot instead of reloading the account from the runtime. In Anchor, after a CPI the account reference still holds the pre-call data unless account.reload() is explicitly called, meaning balance checks, state assertions, or further computation can operate on incorrect values. Attackers can exploit this to pass checks using an initial account state that the CPI subsequently invalidates.