T09 · Insecure Skill Coding Practices
- Location
SKILL.md:62- Finding
GitHub Token Persisted in an Authenticated Git Remote URL
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 62
Vulnerability Type: Credential exposure through an authenticated URL
Risk Level: Highbash git remote add origin https://${GITHUB_TOKEN}@github.com/username/repo.gitTechnical Analysis
The command expands
GITHUB_TOKENdirectly into the Git remote URL. Git normally stores this URL in the repository's.git/configfile. The credential may also be captured by shell tracing, command logging, process inspection, diagnostic output, backups, or accidental disclosure of repository metadata.Although the destination is the legitimate GitHub domain rather than an attacker-controlled endpoint, persisting a bearer token in plaintext violates secure credential-handling practices. Anyone who obtains the expanded URL can authenticate with the permissions assigned to the token until it expires or is revoked.
Attack Path
- The Skill obtains
GITHUB_TOKENfrom the execution environment. - The shell expands the token inside the remote URL.
- Git writes the expanded URL to
.git/config. - A local user, diagnostic process, backup reader, log reader, or subsequent automated task obtains the stored URL.
- The exposed token is extracted from the URL.
- The token is reused through Git or the GitHub API to access resources authorized by its scopes.
Impact Assessment
Successful exploitation grants access equivalent to the compromised token. Depending on its scopes, this can include reading private repositories, pushing arbitrary commits, modifying releases, creating repositories, altering repository settings, or accessing organization resources. The impact is constrained by the token's permissions and any organization-level access controls.
- The Skill obtains
- Remediation
View remediation
Remediation Suggestions
- Keep the Git remote URL free of credentials, for example:
bash git remote add origin https://github.com/username/repo.git - Authenticate through a secure Git credential helper, GitHub CLI, or an ephemeral
GIT_ASKPASSimplementation. - Prefer short-lived, narrowly scoped credentials over long-lived personal access tokens.
- Disable shell tracing while credentials are in use and redact authenticated URLs from logs and diagnostics.
- Inspect existing
.git/configfiles and logs for exposed tokens. - Revoke and rotate any token that may already have been persisted.
- Keep the Git remote URL free of credentials, for example:
