CVE-2021-32638

CodeQL runner: Command-line options that make GitHub access tokens visible to other processes are now deprecated

4.4 medium EPSS 0.40%

Published 25 May 2021 Updated 3 Aug 2024 CNA: GitHub_M

Check your servers for CVE-2021-32638

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2021-32638 affects codeql-action, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

Description

Github's CodeQL action is provided to run CodeQL-based code scanning on non-GitHub CI/CD systems and requires a GitHub access token to connect to a GitHub repository. The runner and its documentation previously suggested passing the GitHub token as a command-line parameter to the process instead of reading it from a file, standard input, or an environment variable. This approach made the token visible to other processes on the same machine, for example in the output of the `ps` command. If the CI system publicly exposes the output of `ps`, for example by logging the output, then the GitHub access token can be exposed beyond the scope intended. Users of the CodeQL runner on 3rd-party systems, who are passing a GitHub token via the `--github-auth` flag, are affected. This applies to both GitHub.com and GitHub Enterprise users. Users of the CodeQL Action on GitHub Actions are not affected. The `--github-auth` flag is now considered insecure and deprecated. The undocumented `--external-repository-token` flag has been removed. To securely provide a GitHub access token to the CodeQL runner, users should **do one of the following instead**: Use the `--github-auth-stdin` flag and pass the token on the command line via standard input OR set the `GITHUB_TOKEN` environment variable to contain the token, then call the command without passing in the token. The old flag remains present for backwards compatibility with existing workflows. If the user tries to specify an access token using the `--github-auth` flag, there is a deprecation warning printed to the terminal that directs the user to one of the above options. All CodeQL runner releases codeql-bundle-20210304 onwards contain the patches. We recommend updating to a recent version of the CodeQL runner, storing a token in your CI system's secret storage mechanism, and passing the token to the CodeQL runner using `--github-auth-stdin` or the `GITHUB_TOKEN` environment variable. If still using the old flag, ensure that process output, such as from `ps`, is not persisted in CI logs.

Severity (CVSS)

4.4 medium CVSS 3.1 from GitHub_M (CNA)
CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N
Attack vector
local: the attacker needs local access, or a user has to open a prepared file
Attack complexity
low: an attack works without special conditions
Privileges required
high: the attacker needs an administrative account
User interaction
none: nobody has to click or open anything
Scope
unchanged: the damage stays inside the vulnerable component
Impact
confidentiality high, integrity none, availability none: what an attacker can read (confidentiality), change (integrity) or stop (availability)

Exploitation

EPSS 0.40%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 36.3% of all scored CVEs. Scores of 1 Dec 2026.

Weakness

  • CWE-200 Exposure of Sensitive Information to an Unauthorized Actor
  • CWE-214 Invocation of Process Using Visible Sensitive Information

Affected products

As the CNA lists them.

ProductVersions
codeql-action
affected < codeql-bundle-20210304

Is my server affected?

Find the installed version of codeql-action and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.

Debian, Ubuntu

dpkg -l | grep -i codeql-action
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2021-32638 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2021-32638

RHEL, Rocky, Alma, Fedora

rpm -q codeql-action
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2021-32638

Alpine

apk list --installed | grep -i codeql-action

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2021-32638
trivy image --scanners vuln IMAGE | grep CVE-2021-32638

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Advisories

Other references

Source: the record CVE-2021-32638 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.