CVE-2024-36127: Chainguard.dev/apko Apko Exposure Of HTTP Basic Vulnerability

HIGH
Advisory Identifier: GHSA-v6mg-7f7p-qmqp
CVSS 7.5
CWE-532 CWE-522
Published
Advisory Summary

CVE-2024-36127 is a HIGH (CVSS 7.5) apko exposure of http basic vulnerability (CWE-532: Insertion of Sensitive Information into Log File) affecting Chainguard.dev/apko libraries in the Go ecosystem. The issue involves apko exposure of http basic auth credentials in log output. Remediation is available by upgrading affected packages to version 0.14.5.

CVE-2024-36127 at a Glance

CVE Identifier CVE-2024-36127
GHSA Identifier GHSA-v6mg-7f7p-qmqp
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-532: Insertion of Sensitive Information into Log File
Affected Product Chainguard.dev/apko
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.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:N/S:U/C:H/I:N/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 High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-36127

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: 0.14.5
Upgrade chainguard.dev/apko to 0.14.5
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-2024-36127, 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 0.14.5), 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-532: Insertion of Sensitive Information into Log File, where the product writes sensitive information to a log file. 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

### Summary Exposure of HTTP basic auth credentials from repository and keyring URLs in log output ### Details There was a handful of instances where the `apko` tool was outputting error messages and log entries where HTTP basic authentication credentials were exposed for one of two reasons: 1. The`%s` verb was used to format a `url.URL` as a string, which includes un-redacted HTTP basic authentication credentials if they are included in the URL. 2. A string URL value (such as from the configuration YAML file supplied used in an apko execution) was never parsed as a URL, so there was no chance of redacting credentials in the logical flow. apko, as well as its companion library `go-apk`, have been updated to ensure URLs are parsed and redacted before being output as string values. ### PoC Create a config file like this `apko.yaml`: ```yaml contents: keyring: - https://packages.wolfi.dev/os/wolfi-signing.rsa.pub repositories: - https://me%40example.com:supersecretpassword@localhost:8080/os packages: - wolfi-base cmd: /bin/sh -l archs: - x86_64 - aarch64 ``` Then run: ```shell apko build apko.yaml latest foo.tar --log-level debug ``` Observe instances of the password being shown verbatim in the log output, such as: ```text ... DEBU image configuration: contents: repositories: - https://me%40example.com:supersecretpassword@localhost:8080/os keyring: - https://packages.wolfi.dev/os/wolfi-signing.rsa.pub packages: - wolfi-base ... ``` ### Impact For users accessing keyring or APK repository content using HTTP basic auth, credentials were being logged in plaintext, depending on the user's logging settings. If you use apko in continuous integration jobs, it is likely that the credentials leak via logs of these jobs. Depending on the accessibility of these logs, this could be a company-internal or public leakage of credentials.

CVE-2024-36127 Affected Chainguard.dev/apko Versions

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

References

Frequently Asked Questions

What is CVE-2024-36127?
CVE-2024-36127 is a security vulnerability in Chainguard.dev/apko involving apko Exposure of HTTP basic auth credentials in log output under CWE-532: Insertion of Sensitive Information into Log File.
Which Chainguard.dev/apko versions are affected?
Affected versions include releases prior to 0.14.5 across affected packages: chainguard.dev/apko.
What version fixes CVE-2024-36127?
Upgrading to 0.14.5 (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 0.14.5. Upgrade your dependency to 0.14.5 or later.
What is the CVSS score of CVE-2024-36127?
CVE-2024-36127 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2024-36127?
CVE-2024-36127 is classified under CWE-532: Insertion of Sensitive Information into Log File (The product writes sensitive information to a log file.).
How can I check Go dependencies for CVE-2024-36127?
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-v6mg-7f7p-qmqp",
  "modified" : "2024-06-04T17:52:15Z",
  "published" : "2024-06-04T17:52:15Z",
  "aliases" : [ "CVE-2024-36127" ],
  "summary" : "apko Exposure of HTTP basic auth credentials in log output",
  "details" : "### Summary\n\nExposure of HTTP basic auth credentials from repository and keyring URLs in log output\n\n### Details\n\nThere was a handful of instances where the `apko` tool was outputting error messages and log entries where HTTP basic authentication credentials were exposed for one of two reasons:\n\n1. The`%s` verb was used to format a `url.URL` as a string, which includes un-redacted HTTP basic authentication credentials if they are included in the URL.\n2. A string URL value (such as from the configuration YAML file supplied used in an apko execution) was never parsed as a URL, so there was no chance of redacting credentials in the logical flow.\n\napko, as well as its companion library `go-apk`, have been updated to ensure URLs are parsed and redacted before being output as string values.\n\n### PoC\n\nCreate a config file like this `apko.yaml`:\n\n```yaml\ncontents:\n  keyring:\n    - https://packages.wolfi.dev/os/wolfi-signing.rsa.pub\n  repositories:\n    - https://me%40example.com:supersecretpassword@localhost:8080/os\n  packages:\n    - wolfi-base\n\ncmd: /bin/sh -l\n\narchs:\n- x86_64\n- aarch64\n```\n\nThen run:\n\n```shell\napko build apko.yaml latest foo.tar --log-level debug\n```\n\nObserve instances of the password being shown verbatim in the log output, such as:\n\n```text\n...\nDEBU image configuration:\ncontents:\n    repositories:\n        - https://me%40example.com:supersecretpassword@localhost:8080/os\n    keyring:\n        - https://packages.wolfi.dev/os/wolfi-signing.rsa.pub\n    packages:\n        - wolfi-base\n...\n```\n\n### Impact\n\nFor users accessing keyring or APK repository content using HTTP basic auth, credentials were being logged in plaintext, depending on the user's logging settings. If you use apko in continuous integration jobs, it is likely that the credentials leak via logs of these jobs. Depending on the accessibility of these logs, this could be a company-internal or public leakage of credentials.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "chainguard.dev/apko"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.14.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/chainguard-dev/apko/security/advisories/GHSA-v6mg-7f7p-qmqp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-36127"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/chainguard-dev/apko/commit/2c0533e4d52e83031a04f6a83ec63fc2a11eff01"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/chainguard-dev/apko"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-522", "CWE-532" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-04T17:52:15Z",
    "nvd_published_at" : "2024-06-03T15:15:09Z"
  }
}