CVE-2026-42576: Chainguard.dev/apko Apko `DiscoverKeys` Has A Panic Vulnerability

MODERATE
Advisory Identifier: GHSA-m7hm-vm4x-28jf
CVSS 6.5
CWE-704
Published
Advisory Summary

CVE-2026-42576 is a MODERATE (CVSS 6.5) apko `discoverkeys` has a panic vulnerability (CWE-704: Incorrect Type Conversion or Cast) affecting Chainguard.dev/apko libraries in the Go ecosystem. The issue involves apko `discoverkeys` has a panic on non-rsa jwks key that causes crash during key discovery. Remediation is available by upgrading affected packages to version 1.2.7.

CVE-2026-42576 at a Glance

CVE Identifier CVE-2026-42576
GHSA Identifier GHSA-m7hm-vm4x-28jf
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-704: Incorrect Type Conversion or Cast
Affected Product Chainguard.dev/apko
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.5

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:R/S:U/C:N/I:N/A:H).

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

How to Fix CVE-2026-42576

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

chainguard.dev/apko fixed: 1.2.7
Upgrade chainguard.dev/apko to 1.2.7
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 chainguard.dev/apko

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-42576, inspect your project dependencies for Chainguard.dev/apko:

inspect dependencies for chainguard.dev/apko

Analyze the terminal output to locate any version of Chainguard.dev/apko in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.7), 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-704: Incorrect Type Conversion or Cast, where the product does not correctly convert an object, resource, or structure from one type to a different type. In Chainguard.dev/apko, 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

`DiscoverKeys` in `pkg/apk/apk/implementation.go` unconditionally type-asserts JWKS keys as `*rsa.PublicKey` without checking the key type. If a repository JWKS endpoint returns a non-RSA key (e.g. EC), the unchecked assertion panics and crashes apko. This affects any workflow that initializes the APK database and fetches repository keys. Affected versions <= 0.30.34. **Fix:** No fix available yet. **Acknowledgements** apko thanks Oleh Konko from [1seal](https://1seal.org/) for discovering and reporting this issue.

CVE-2026-42576 Affected Chainguard.dev/apko Versions

1 component(s)
Fixed Versions:
1.2.7
Product / Package Ecosystem Affected Versions Fixed Version
chainguard.dev/apko
Go
< 1.2.7
1.2.7

References

Frequently Asked Questions

What is CVE-2026-42576?
CVE-2026-42576 is a security vulnerability in Chainguard.dev/apko involving apko `DiscoverKeys` has a panic on non-rsa jwks key that causes crash during key discovery under CWE-704: Incorrect Type Conversion or Cast.
Which Chainguard.dev/apko versions are affected?
Affected versions include releases prior to 1.2.7 across affected packages: chainguard.dev/apko.
What version fixes CVE-2026-42576?
Upgrading to 1.2.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is chainguard.dev/apko affected?
Yes, chainguard.dev/apko is affected in releases prior to 1.2.7. Upgrade your dependency to 1.2.7 or later.
What is the CVSS score of CVE-2026-42576?
CVE-2026-42576 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-42576?
CVE-2026-42576 is classified under CWE-704: Incorrect Type Conversion or Cast (The product does not correctly convert an object, resource, or structure from one type to a different type.).
How can I check Go dependencies for CVE-2026-42576?
Run the dependency tree command: 'inspect dependencies for chainguard.dev/apko'. 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-m7hm-vm4x-28jf",
  "modified" : "2026-05-13T13:42:36Z",
  "published" : "2026-05-04T21:25:30Z",
  "aliases" : [ "CVE-2026-42576" ],
  "summary" : "apko `DiscoverKeys` has a panic on non-rsa jwks key that causes crash during key discovery",
  "details" : "`DiscoverKeys` in `pkg/apk/apk/implementation.go` unconditionally type-asserts JWKS keys as `*rsa.PublicKey` without checking the key type. If a repository JWKS endpoint returns a non-RSA key (e.g. EC), the unchecked assertion panics and crashes apko. This affects any workflow that initializes the APK database and fetches repository keys. Affected versions <= 0.30.34.\n\n**Fix:** No fix available yet.\n\n**Acknowledgements**\n\napko thanks Oleh Konko from [1seal](https://1seal.org/) for discovering and reporting this issue.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "chainguard.dev/apko"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/chainguard-dev/apko/security/advisories/GHSA-m7hm-vm4x-28jf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42576"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/chainguard-dev/apko/commit/6604826b19e36e9bc6e196592800fad93738f4a1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/chainguard-dev/apko"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/chainguard-dev/apko/releases/tag/v1.2.7"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-704" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-04T21:25:30Z",
    "nvd_published_at" : "2026-05-09T20:16:29Z"
  }
}