Seguridad

Duplicate Mutable Accounts

A vulnerability where the same account is passed twice in the accounts list for a single instruction under different argument names, and the program writes to what it believes are two independent accounts, with the second write silently overwriting the first on the single underlying account in the runtime's account map. For example, if from and to in a transfer handler reference the same key, debiting from and crediting to nets out to a free credit. In native programs the check requires comparing account keys; Anchor automatically detects duplicate mutable accounts and returns an error when the same pubkey appears more than once in writable positions within a single instruction's account list.

IDduplicate-mutable-accounts

Lectura rápida

Empieza por la explicación más corta y útil antes de profundizar.

A vulnerability where the same account is passed twice in the accounts list for a single instruction under different argument names, and the program writes to what it believes are two independent accounts, with the second write silently overwriting the first on the single underlying account in the runtime's account map. For example, if from and to in a transfer handler reference the same key, debiting from and crediting to nets out to a free credit. In native programs the check requires comparing account keys; Anchor automatically detects duplicate mutable accounts and returns an error when the same pubkey appears more than once in writable positions within a single instruction's account list.

Modelo mental

Usa primero la analogía corta para razonar mejor sobre el término cuando aparezca en código, docs o prompts.

Piensa en esto como un bloque de construcción que conecta una definición aislada con el sistema mayor donde vive.

Contexto técnico

Ubica el término dentro de la capa de Solana en la que vive para razonar mejor sobre él.

Fallos, auditorías, superficies de ataque y patrones seguros.

Por qué le importa a un builder

Convierte el término de vocabulario en algo operacional para producto e ingeniería.

Este término desbloquea conceptos adyacentes rápido, así que funciona mejor cuando lo tratas como un punto de conexión y no como una definición aislada.

Handoff para IA

Handoff para IA

Usa este bloque compacto cuando quieras dar contexto sólido a un agente o asistente sin volcar toda la página.

Duplicate Mutable Accounts (duplicate-mutable-accounts)
Categoría: Seguridad
Definición: A vulnerability where the same account is passed twice in the accounts list for a single instruction under different argument names, and the program writes to what it believes are two independent accounts, with the second write silently overwriting the first on the single underlying account in the runtime's account map. For example, if from and to in a transfer handler reference the same key, debiting from and crediting to nets out to a free credit. In native programs the check requires comparing account keys; Anchor automatically detects duplicate mutable accounts and returns an error when the same pubkey appears more than once in writable positions within a single instruction's account list.
Relacionados: Cuenta Escribible, Cuenta
Glossary Copilot

Haz preguntas de Solana con contexto aterrizado sin salir del glosario.

Usa contexto del glosario, relaciones entre términos, modelos mentales y builder paths para recibir respuestas estructuradas en vez de output genérico.

Abrir workspace completa del Copilot
Explicar este código

Opcional: pega código Anchor, Solana o Rust para que el Copilot mapee primitivas de vuelta al glosario.

Haz una pregunta aterrizada en el glosario

Haz una pregunta aterrizada en el glosario

El Copilot responderá usando el término actual, conceptos relacionados, modelos mentales y el grafo alrededor del glosario.

Grafo conceptual

Ve el término como parte de una red, no como una definición aislada.

Estas ramas muestran qué conceptos toca este término directamente y qué existe una capa más allá de ellos.

Rama

Cuenta Escribible

An account marked as writable in an instruction's account metas, allowing the program to modify its data or lamport balance. Non-writable accounts are read-only. The runtime enforces that programs can only modify writable accounts. Writable accounts also affect scheduling—transactions sharing writable accounts cannot run in parallel.

Rama

Cuenta

The fundamental data storage unit on Solana. Every piece of state is stored in an account identified by a 32-byte public key. Accounts hold a lamport balance, an owner program, a data byte array (up to 10MB), and an executable flag. Only the owning program can modify an account's data, but anyone can credit lamports to it.

Siguientes conceptos para explorar

Mantén la cadena de aprendizaje en movimiento en lugar de parar en una sola definición.

Estos son los siguientes conceptos que vale la pena abrir si quieres que este término tenga más sentido dentro de un workflow real de Solana.

Modelo de Programación

Cuenta Escribible

An account marked as writable in an instruction's account metas, allowing the program to modify its data or lamport balance. Non-writable accounts are read-only. The runtime enforces that programs can only modify writable accounts. Writable accounts also affect scheduling—transactions sharing writable accounts cannot run in parallel.

Modelo de Programación

Cuenta

The fundamental data storage unit on Solana. Every piece of state is stored in an account identified by a 32-byte public key. Accounts hold a lamport balance, an owner program, a data byte array (up to 10MB), and an executable flag. Only the owning program can modify an account's data, but anyone can credit lamports to it.

Seguridad

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.

Seguridad

Desbordamiento de Entero

A class of arithmetic vulnerabilities where an integer computation produces a result outside the bounds of its fixed-width type, wrapping around silently in Rust's release builds (since Rust panics on overflow only in debug mode), yielding an incorrect value that can corrupt token balances, borrow limits, or access control counters. For example, subtracting a larger u64 from a smaller one wraps to near u64::MAX (~1.8 × 10^19), which could be interpreted as an enormous balance. Solana programs must use Rust's checked_add, checked_sub, checked_mul, and checked_div methods (or the saturating_* / wrapping_* variants with deliberate intent) on all financial arithmetic to eliminate this class of bugs.

Comúnmente confundido con

Términos cercanos en vocabulario, acrónimo o vecindad conceptual.

Estas entradas son fáciles de mezclar cuando lees rápido, haces prompting a un LLM o estás entrando en una nueva capa de Solana.

Seguridadclosing-accounts

Closing Accounts Vulnerability

A vulnerability that arises when a program closes an account by zeroing its data and transferring lamports without setting the account's discriminator or data to a sentinel closed state before the end of the instruction, leaving a window within the same transaction where other instructions can still interact with the now-empty account. The Solana runtime only removes an account from the account set when its lamports reach zero at the end of a transaction, so mid-transaction the account still exists and a subsequent instruction can re-fund it and reinstate stale data, enabling an account revival attack. Anchor's close constraint writes a CLOSED_ACCOUNT_DISCRIMINATOR (8 bytes of 0xff) and uses a force-defund mechanism to prevent resurrection.

Seguridadremaining-accounts

Remaining Accounts Misuse

A vulnerability arising from the use of ctx.remaining_accounts in Anchor (or unchecked trailing accounts in native programs), where accounts passed beyond the explicitly declared account struct are not subject to any automatic owner, signer, or constraint checks, leaving it entirely to the program to validate them. Attackers can exploit this by injecting unexpected accounts — fake mints, unauthorized signers, or accounts owned by a malicious program — that the program then treats as trusted inputs. Programs using remaining_accounts must manually verify every account's key, owner, is_signer, and is_writable properties before use, making this pattern a frequent audit finding.

Términos relacionados

Sigue los conceptos que realmente le dan contexto a este término.

Las entradas del glosario se vuelven útiles cuando están conectadas. Estos enlaces son el camino más corto hacia ideas adyacentes.

Modelo de Programaciónwritable

Cuenta Escribible

An account marked as writable in an instruction's account metas, allowing the program to modify its data or lamport balance. Non-writable accounts are read-only. The runtime enforces that programs can only modify writable accounts. Writable accounts also affect scheduling—transactions sharing writable accounts cannot run in parallel.

Modelo de Programaciónaccount

Cuenta

The fundamental data storage unit on Solana. Every piece of state is stored in an account identified by a 32-byte public key. Accounts hold a lamport balance, an owner program, a data byte array (up to 10MB), and an executable flag. Only the owning program can modify an account's data, but anyone can credit lamports to it.

Más en la categoría

Quédate en la misma capa y sigue construyendo contexto.

Estas entradas viven junto al término actual y ayudan a que la página se sienta parte de un grafo de conocimiento más amplio en lugar de un callejón sin salida.

Seguridad

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.

Seguridad

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.

Seguridad

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.

Seguridad

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.