/

CVE-2026-45137

Severity:

HIGH RISK

(8.2)

Improper Input Validation in Solana Anchor Program<'a

CVE-2026-45137

Awaiting Analysis

Vulnerability type

Category:

Improper Input Validation

CWE:

CWE-20

Impact:

Arbitrary Cross-Program Invocation and Payment Bypass

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A logic flaw in Solana's Anchor framework causes programs to accept any executable program ID where the System Program is expected.

When a program assumes Anchor has validated the System Program account but the runtime actually allows arbitrary programs, attackers may gain arbitrary cross-program invocation (CPI) capabilities or bypass payment logic.

Affected context

This vulnerability appears in Solana programs built with vulnerable versions of the Anchor framework that:

  • Use Program<'a, System> accounts and rely on Anchor to validate that the passed program is the System Program
  • Invoke System Program instructions via CPI using that Program<'a, System> account
  • Do not perform their own explicit verification of the System Program's public key

The issue arises specifically in the TryFrom<&'a AccountInfo<'a>> implementation for Program<'a, T>, where the type-level ID comparison treats T = () and T = System equivalently due to both resolving to Pubkey::default().

Exploit preconditions

  • Attack surface: Solana programs compiled with affected Anchor versions that expose CPI entrypoints or on-chain logic expecting the System Program.
  • Required access: Ability to invoke the vulnerable program with custom account lists (a standard capability for Solana transaction senders).
  • Trigger point: Passing an arbitrary executable account in place of the System Program when the program expects Program<'a, System>.
  • Why exploitation is possible: Anchor's runtime compares the expected program ID to Pubkey::default(), causing Program<'a, System> to be treated like the generic Program<'a, ()>. As a result, any executable account is accepted where only the System Program should be allowed, breaking the program's assumptions about which program is being called.

Why this happens

The core issue is an improper input validation (CWE-20) in Anchor's type-to-runtime translation for Program<'a, T>.

Anchor uses the Id trait and Id::id() to decide if a program account must match a specific public key or if any executable account is acceptable. Both T = () and T = System use Pubkey::default() as their ID, so the check cannot distinguish between "generic executable program" and "the System Program".

As a result, the runtime validation step fails to enforce the intended invariant "this must be the System Program" and instead permits any executable program, undermining the safety guarantees developers expect from the Program<'a, System> type.

Potential impact

  • Attackers can cause the program to perform CPI calls to an attacker-controlled program instead of the System Program.
  • Payment-related logic that assumes interaction with the System Program may be bypassed or redirected.
  • Authorization checks tied to specific System Program instructions can be subverted.
  • On-chain state integrity can be compromised if critical flows rely on trusted System Program behavior.
  • Chained exploits may be possible if the attacker-controlled program is used to pivot into other Solana programs.

General mitigation guidance

Effective mitigation focuses on strengthening account validation and reducing implicit trust in framework-level invariants:

  • Explicitly validate that any Program<'a, System> account has the expected System Program public key before using it for CPI.
  • Treat framework-provided type guarantees as advisory and add explicit runtime checks for critical program IDs (e.g., System, Token, and governance programs).
  • Isolate high-privilege or payment-related logic so it depends on strongly validated accounts and minimal assumptions about caller-provided programs.
  • Favor patterns where the program derives and validates well-known program IDs internally instead of relying solely on caller-supplied Program accounts.
  • Apply defense-in-depth by validating both the program ID and any related accounts (e.g., payer, source, and destination accounts) before executing business logic.

How teams detect issues like this

Detection can combine code-level inspection with automated checks:

  • Static analysis: Search for usages of Program<'_, System> that perform CPI without an explicit comparison against the System Program public key.
  • Code review: Flag any reliance on Anchor's default Program<'a, T> validation where the specific program ID is security-critical (payments, authorization, or governance actions).
  • Automated review tools: Configure linters or custom analyzers to detect CPI calls into Program<'_, System> that lack explicit ID checks or to warn on any trust in Pubkey::default()-based identity.
  • Security testing: Design fuzzing or property tests that attempt to substitute arbitrary executable programs in place of the System Program and confirm that the program rejects them.

Sources

SourceLink
github.comgithub.com/otter-sec/anchor/security/advisories/GHSA-c6rc-8jpp-2fgc

Frequently asked

questions

Yes. Any party capable of submitting Solana transactions to the vulnerable program and controlling the supplied accounts can attempt to exploit the issue by substituting an arbitrary executable program for the System Program.

The attacker only needs the normal ability to invoke the affected program with custom account lists. No special on-chain privileges are required beyond the standard capability to create and submit transactions.

Add explicit runtime checks that verify the Program<'a, System> account's public key matches the canonical System Program ID before performing CPI or payment-related actions, and fail fast if the check does not pass.

Avoid relying solely on type-level guarantees from frameworks for security-critical invariants. Instead, perform explicit validation of all critical program IDs and accounts, especially before CPI or payment flows, and enforce these validations through code review standards and automated checks.

Find out what's already
exploitable in your codebase.