CVE-2025-46820 Overview
CVE-2025-46820 affects phpgt/Dom, a PHP library that provides access to modern Document Object Model (DOM) APIs. Versions prior to 4.1.8 expose the GITHUB_TOKEN inside a GitHub Actions workflow run artifact. The ci.yml workflow uses actions/upload-artifact@v4 to upload a zip of the working directory, which includes the auto-generated .git/config file containing the active GITHUB_TOKEN. An attacker who downloads the artifact while the workflow is still running can extract the token and use the GitHub API to push malicious code or rewrite release commits. This issue is tracked as [CWE-200] Information Exposure and is fixed in version 4.1.8.
Critical Impact
Attackers who win a short race condition can hijack the repository's GITHUB_TOKEN to push malicious code or rewrite release commits, affecting any downstream consumer of phpgt/Dom.
Affected Products
- phpgt/Dom versions prior to 4.1.8
- GitHub Actions workflows using actions/upload-artifact@v4 with the repository checkout directory
- Downstream projects consuming phpgt/Dom releases produced by the affected workflow
Discovery Timeline
- 2025-05-06 - CVE-2025-46820 published to the National Vulnerability Database
- 2026-04-15 - Last updated in NVD database
Technical Details for CVE-2025-46820
Vulnerability Analysis
The phpgt/Dom continuous integration workflow uploads the entire build directory as an artifact using actions/upload-artifact@v4. GitHub Actions writes a GITHUB_TOKEN into .git/config during repository checkout so subsequent Git operations can authenticate. When the workflow zips the working directory, the .git/config file is bundled into the published artifact.
GitHub allows artifacts to be downloaded before the workflow completes. During the window between artifact upload and workflow termination, the GITHUB_TOKEN remains valid. An attacker can poll the artifacts API, download the zip, extract the token from .git/config, and use it against the repository.
The GITHUB_TOKEN granted to a workflow typically has write permissions to the repository. Stolen tokens can push commits, modify tags, rewrite release commits, or trigger further workflows. Any downstream project pulling phpgt/Dom releases could receive tampered code.
Root Cause
The root cause is including the .git directory in the artifact payload. The actions/upload-artifact@v4 step targeted the checkout root without excluding .git/config, embedding a short-lived but privileged credential in a downloadable file. This maps to [CWE-200] Exposure of Sensitive Information to an Unauthorized Actor.
Attack Vector
Exploitation requires the attacker to enumerate in-progress workflow runs through the public GitHub API, download the artifact during the brief validity window of the token, and extract the credential from .git/config. The attack vector is network-based with high complexity because of the timing race. Once the token is captured, the attacker authenticates to the GitHub API and performs write operations against the phpgt/Dom repository before the workflow finishes and the token expires.
No verified proof-of-concept code has been published. See the GitHub Security Advisory GHSA-cwj7-6v67-2cm4 and the remediation commit for technical details.
Detection Methods for CVE-2025-46820
Indicators of Compromise
- Unexpected pushes, tag updates, or release commit rewrites in repositories that consumed phpgt/Dom prior to 4.1.8
- Artifact downloads from workflow runs by accounts or IP addresses that are not part of the development team
- GitHub audit log entries showing GITHUB_TOKEN activity originating from outside expected runner IP ranges
Detection Strategies
- Inspect uploaded workflow artifacts for the presence of .git/config containing an http.https://github.com/.extraheader line with an AUTHORIZATION: basic value
- Review GitHub audit logs for git.push, release.publish, and git.create_tag events tied to workflow runs rather than human actors
- Correlate artifact download events with subsequent repository write operations within the same workflow execution window
Monitoring Recommendations
- Enable GitHub Enterprise audit log streaming to a SIEM and alert on artifact downloads by non-collaborator accounts
- Monitor commits to default and release branches for unexpected authorship or signing anomalies
- Track dependency updates in downstream projects that pin phpgt/Dom versions and verify release artifact integrity
How to Mitigate CVE-2025-46820
Immediate Actions Required
- Upgrade phpgt/Dom to version 4.1.8 or later in all dependent projects
- Audit prior workflow runs of phpgt/Dom and any forks reusing the affected ci.yml for unauthorized artifact downloads
- Rotate any long-lived secrets that may have been accessible to the workflow runner during the exposure window
- Review repository commit history and release tags for unauthorized modifications
Patch Information
The maintainers fixed the issue in phpgt/Dom 4.1.8. The remediation excludes the .git directory from the uploaded artifact. See the upstream commit 205cddc for the exact workflow change.
Workarounds
- Modify the workflow to upload only build output directories instead of the entire checkout root
- Add an explicit exclusion for .git/** in the actions/upload-artifact step path patterns
- Set persist-credentials: false on actions/checkout so the GITHUB_TOKEN is not written into .git/config
- Restrict the permissions: block of the workflow to the minimum scopes required for the job
# Example hardening for the workflow upload step
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/upload-artifact@v4
with:
name: build
path: |
build/
!**/.git
!**/.git/**
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

