T09 · Insecure Skill Coding Practices
- Location
SKILL.md:96- Finding
GitHub Personal Access Token Stored in an Unprotected Plaintext File
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 12-14 and 94-98
Vulnerability Type: Plaintext sensitive-data storage
Risk Level: MediumVulnerable Code Snippet
markdown 2. **Set a GitHub Personal Access Token** - Visit https://github.com/settings/personal-access-tokens/new - Create a fine-grained token with the Copilot Requests permission - Save the token to `~/.copilot/github_token.txt`bash echo "new token" > ~/.copilot/github_token.txtThe snippets above are English translations of the corresponding instructions and command placeholder in the audited document.
Technical Analysis
The skill directs users to store a GitHub Personal Access Token in a regular plaintext file and provides a shell redirection command to create or replace that file. It does not require a restrictive
umask, explicitly set file permissions, verify the permissions of the parent directory, or recommend an operating-system credential store.Shell redirection creates the file according to the user's active
umask. Under a commonly used022umask, a newly created file may be readable by other local users. If the file already exists, redirection preserves its existing permissions, meaning an already over-permissive token file remains exposed.Subsequent examples read the token directly from this predictable location and place it in the
COPILOT_GITHUB_TOKENenvironment variable:bash COPILOT_GITHUB_TOKEN=$(cat ~/.copilot/github_token.txt) copilot -p "your question"Consequently, any process or local account capable of reading the token file can recover and reuse the credential. Exploitation depends on local filesystem access and the effective permissions of the file and its parent directories.
Attack Path
- A user follows the documented setup procedure and writes a valid GitHub token to
~/.copilot/github_token.txt. - The shell creates the file using the curre ...[truncated 1190 chars]
- A user follows the documented setup procedure and writes a valid GitHub token to
- Remediation
View remediation
Remediation Suggestions
-
Store the token in an operating-system credential manager, such as macOS Keychain, Windows Credential Manager, or a Linux Secret Service implementation, rather than in a plaintext file.
-
Prefer an official authenticated GitHub CLI workflow where supported, so credential storage and renewal are delegated to a maintained authentication mechanism.
-
If file-based storage is unavoidable, create both the configuration directory and token file with explicit restrictive permissions:
bash install -d -m 700 ~/.copilot umask 077 install -m 600 /dev/null ~/.copilot/github_token.txt -
Write the token using a non-echoing prompt rather than embedding it directly in a shell command:
bash read -r -s -p "GitHub token: " COPILOT_TOKEN printf '\n' printf '%s' "$COPILOT_TOKEN" > ~/.copilot/github_token.txt unset COPILOT_TOKEN chmod 600 ~/.copilot/github_token.txt -
Add a permissions check before loading the credential and reject files accessible by group or other users.
-
Document token rotation and immediate revocation procedures for suspected disclosure.
-
Continue requiring a fine-grained token with only the minimum Copilot permission, and explicitly warn users not to reuse a broader GitHub token.
-
