T09 · Insecure Skill Coding Practices
- Location
SKILL.md:62- Finding
GitHub Token Persisted in Git Remote URL
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 62
Vulnerability Type: Credential exposure through insecure Git authentication configuration
Risk Level: HighVulnerable Code
bash git remote add origin https://${GITHUB_TOKEN}@github.com/username/repo.git git push -u origin mainTechnical Analysis
The documented push procedure interpolates
GITHUB_TOKENdirectly into the Git remote URL. Git persists remote URLs in the repository's.git/configfile. Consequently, the token can remain stored in plaintext after the command completes.The credential may also be exposed through command logging, diagnostic output, backups, support bundles, or tooling that prints the configured remote. Although the token value is read from a protected secret file elsewhere in the document, embedding it in a persistent URL defeats that protection.
The audit did not identify a hardcoded token value. Exploitation requires access to the resulting Git configuration, logs, backups, or equivalent process artifacts.
Attack Path
- The Skill reads a valid token into
GITHUB_TOKEN. - It adds an HTTPS remote containing the token.
- Git saves the complete URL in
.git/config. - An attacker with access to the workspace, a backup, logs, or collected diagnostics reads the URL.
- The attacker extracts the token and authenticates to GitHub.
- The attacker performs operations allowed by the token's scopes and repository access.
Impact Assessment
A recovered token may permit unauthorized access to repositories available to the associated GitHub identity. Depending on its scope, an attacker could read private source code, push malicious commits, alter releases, create repositories, or modify other GitHub resources.
The maximum impact is constrained by the token's scopes, organization policies, expiration, and repository authorization. The Skill metadata requires
GITHUB_TOKEN, but the reviewed files do not establish its exact privileges.- The Skill reads a valid token into
- Remediation
View remediation
Remediation Suggestions
- Do not place credentials in Git remote URLs.
- Configure the remote as
https://github.com/username/repo.git. - Authenticate through GitHub CLI, Git Credential Manager, a secure credential helper, or an ephemeral HTTP authorization header.
- Prefer short-lived, repository-scoped credentials with only the permissions needed for the requested operation.
- Ensure automation does not print credentials or authenticated URLs.
- Remove existing authenticated remote URLs from
.git/config, logs, backups, and diagnostic artifacts where feasible. - Revoke and rotate any token previously used in this manner.
