CVE-2026-59947: Composer URL-embedded HTTP-Basic Username Leaks To Vulnerability

MODERATE
Advisory Identifier: GHSA-g6xq-892h-64w3
CVSS 4.7
CWE-532
Published
Advisory Summary

CVE-2026-59947 is a MODERATE (CVSS 4.7) url-embedded http-basic username leaks to vulnerability (CWE-532: Insertion of Sensitive Information into Log File) affecting Composer libraries in the Packagist ecosystem. The issue involves url-embedded http-basic username leaks to verbose logs (github pat exposure). Remediation is available by upgrading affected packages to version 2.10.2, 2.2.29.

CVE-2026-59947 at a Glance

CVE Identifier CVE-2026-59947
GHSA Identifier GHSA-g6xq-892h-64w3
Severity MODERATE
CVSS v3.1 Base Score 4.7
CWE Classification CWE-532: Insertion of Sensitive Information into Log File
Affected Product Composer
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 4.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
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-2026-59947

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

composer/composer fixed: 2.10.2
Upgrade composer/composer to 2.10.2
composer/composer fixed: 2.2.29
Upgrade composer/composer to 2.2.29
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 composer/composer

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-59947, inspect your project dependencies for Composer:

inspect dependencies for composer/composer

Analyze the terminal output to locate any version of Composer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.10.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-532: Insertion of Sensitive Information into Log File, where the product writes sensitive information to a log file. In Composer, 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 When Composer is run with -vvv (debug verbosity), it could print a credential that was embedded directly in a repository or package URL, but not as a password, to its debug output. Composer already masked the password portion of such URLs, but the username portion was shown in clear text. Because GitHub and several other services support placing an access token in the username position of a URL (for example https://[token]@github.com/owner/repo), a token used that way could end up written to the verbose log in full. This is an information disclosure issue. The credential is only ever exposed to whoever can already read Composer's debug output. ## Am I affected? You are potentially affected only if **all** of the following apply: - A credential is embedded inside a URL that Composer handles, e.g. in a `repositories` entry in composer.json, in a package dist/source URL - rather than being supplied through auth.json or the COMPOSER_AUTH environment variable. - The secret sits in the username slot of that URL (e.g. `https://TOKEN@host/…`). A normal `username:password@host` pair where the username is an ordinary account name did not expose the password, that was already masked. - Composer is run with -vvv (debug verbosity), and that output is retained or shared somewhere others can read it: public CI build logs, output pasted into an issue or chat, archived terminal sessions, and so on. If you keep credentials in auth.json or environment variables, or you never run Composer at debug verbosity, you were not exposed. The most realistic exposure is the documented pattern of embedding a GitHub Personal Access Token in a URL's username position on a machine (often CI) that captures verbose output. ## Patched versions The username is now masked the same way the password already was, so an embedded token no longer appears in verbose output (a short, non-secret prefix may be shown to aid debugging, but never the full value). Fixed in Composer 2.10.2 and the 2.2.29. ## Workarounds There is no configuration setting that prevents outputting credentials while keeping normal behavior. If you cannot upgrade right away, you can reduce exposure by: - Not running Composer with -vvv (debug verbosity) in environments where output is captured or shared. - Moving credentials out of URLs and into auth.json or COMPOSER_AUTH. - Scrubbing existing CI/build logs that may already contain a leaked token.

CVE-2026-59947 Affected Composer Versions

2 component(s)
Fixed Versions:
2.10.22.2.29
Product / Package Ecosystem Affected Versions Fixed Version
composer/composer
Packagist
≥ 2.3.0
< 2.10.2
2.10.2
composer/composer
Packagist
≥ 1.0.0
< 2.2.29
2.2.29

References

Frequently Asked Questions

What is CVE-2026-59947?
CVE-2026-59947 is a security vulnerability in Composer involving URL-embedded HTTP-Basic username leaks to verbose logs (GitHub PAT exposure) under CWE-532: Insertion of Sensitive Information into Log File.
Which Composer versions are affected?
Affected versions include releases prior to 2.10.2, 2.2.29 across affected packages: composer/composer.
What version fixes CVE-2026-59947?
Upgrading to 2.10.2, 2.2.29 (or the latest patched release for your respective branch) resolves the vulnerability.
Is composer/composer affected?
Yes, composer/composer is affected in releases prior to 2.10.2, 2.2.29. Upgrade your dependency to 2.10.2, 2.2.29 or later.
What is the CVSS score of CVE-2026-59947?
CVE-2026-59947 has a CVSS v3.1 base score of 4.7 (MODERATE) with vector string CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2026-59947?
CVE-2026-59947 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 Packagist dependencies for CVE-2026-59947?
Run the dependency tree command: 'inspect dependencies for composer/composer'. 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-g6xq-892h-64w3",
  "modified" : "2026-07-20T21:55:05Z",
  "published" : "2026-07-20T21:55:05Z",
  "aliases" : [ "CVE-2026-59947" ],
  "summary" : "Composer: URL-embedded HTTP-Basic username leaks to verbose logs (GitHub PAT exposure)",
  "details" : "## Summary\n\nWhen Composer is run with -vvv (debug verbosity), it could print a credential that was embedded directly in a repository or package URL, but not as a password, to its debug output. Composer already masked the password portion of such URLs, but the username portion was shown in clear text. Because GitHub and several other services support placing an access token in the username position of a URL (for example https://[token]@github.com/owner/repo), a token used that way could end up written to the verbose log in full.\n\nThis is an information disclosure issue. The credential is only ever exposed to whoever can already read Composer's debug output.\n\n## Am I affected?\n\nYou are potentially affected only if **all** of the following apply:\n\n- A credential is embedded inside a URL that Composer handles, e.g. in a `repositories` entry in composer.json, in a package dist/source URL - rather than being supplied through auth.json or the COMPOSER_AUTH environment variable.\n- The secret sits in the username slot of that URL (e.g. `https://TOKEN@host/…`). A normal `username:password@host` pair where the username is an ordinary account name did not expose the password, that was already masked.\n- Composer is run with -vvv (debug verbosity), and that output is retained or shared somewhere others can read it: public CI build logs, output pasted into an issue or chat, archived terminal sessions, and so on.\n\nIf you keep credentials in auth.json or environment variables, or you never run Composer at debug verbosity, you were not exposed.\n\nThe most realistic exposure is the documented pattern of embedding a GitHub Personal Access Token in a URL's username position on a machine (often CI) that captures verbose output.\n\n## Patched versions\n\nThe username is now masked the same way the password already was, so an embedded token no longer appears in verbose output (a short, non-secret prefix may be shown to aid debugging, but never the full value).\n\nFixed in Composer 2.10.2 and the 2.2.29.\n\n## Workarounds\n\nThere is no configuration setting that prevents outputting credentials while keeping normal behavior.\n\nIf you cannot upgrade right away, you can reduce exposure by:\n\n- Not running Composer with -vvv (debug verbosity) in environments where output is captured or shared.\n- Moving credentials out of URLs and into auth.json or COMPOSER_AUTH.\n- Scrubbing existing CI/build logs that may already contain a leaked token.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "composer/composer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.3.0"
      }, {
        "fixed" : "2.10.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "composer/composer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "2.2.29"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/security/advisories/GHSA-g6xq-892h-64w3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-59947"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/commit/6bd66874ae523ecb69aca5964487a0cdfda03ef8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/commit/8887ad76fbd830cb1861a2b1fd8ead78ed1fa1ec"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/composer/composer"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/releases/tag/2.10.2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/releases/tag/2.2.29"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-532" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-20T21:55:05Z",
    "nvd_published_at" : "2026-07-08T20:16:59Z"
  }
}