GHSA-V6MG-7F7P-QMQP
Vulnerability from github – Published: 2024-06-04 17:52 – Updated: 2024-06-04 17:52Summary
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:
- The
%sverb was used to format aurl.URLas a string, which includes un-redacted HTTP basic authentication credentials if they are included in the URL. - 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:
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:
apko build apko.yaml latest foo.tar --log-level debug
Observe instances of the password being shown verbatim in the log output, such as:
...
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.
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "chainguard.dev/apko"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.14.5"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2024-36127"
],
"database_specific": {
"cwe_ids": [
"CWE-522",
"CWE-532"
],
"github_reviewed": true,
"github_reviewed_at": "2024-06-04T17:52:15Z",
"nvd_published_at": "2024-06-03T15:15:09Z",
"severity": "HIGH"
},
"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\u0027s 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.",
"id": "GHSA-v6mg-7f7p-qmqp",
"modified": "2024-06-04T17:52:15Z",
"published": "2024-06-04T17:52:15Z",
"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"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
],
"summary": "apko Exposure of HTTP basic auth credentials in log output"
}
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.