T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:62
- Finding
- GitHub Token Persisted in Git Remote URL## Vulnerability Details **File Location**: `SKILL.md`, line 62 **Vulnerability Type**: Credential exposure through insecure Git authentication configuration **Risk Level**: High ### Vulnerable Code ```bash git remote add origin https://${GITHUB_TOKEN}@github.com/username/repo.git git push -u origin main ``` ### Technical Analysis The documented push procedure interpolates `GITHUB_TOKEN` directly into the Git remote URL. Git persists remote URLs in the repository's `.git/config` file. 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 1. The Skill reads a valid token into `GITHUB_TOKEN`. 2. It adds an HTTPS remote containing the token. 3. Git saves the complete URL in `.git/config`. 4. An attacker with access to the workspace, a backup, logs, or collected diagnostics reads the URL. 5. The attacker extracts the token and authenticates to GitHub. 6. 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.
- 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.
