T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:5- Finding
Plaintext Activity Logs Are Created Without Restrictive Permissions
- Content
View full analysis
Vulnerability Details
File Location:
scripts/script.sh:5-8; representative data write atscripts/script.sh:125-132
Vulnerability Type: Insecure local storage and insufficient file-permission hardening
Risk Level: MediumVulnerable Code
bash DATA_DIR="${HOME}/.local/share/trivia" mkdir -p "$DATA_DIR" _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }Representative storage of user-controlled content:
bash run) shift if [ $# -eq 0 ]; then echo "Recent run entries:" tail -20 "$DATA_DIR/run.log" 2>/dev/null || echo " No entries yet. Use: trivia run <input>" else local input="$*" local ts=$(date '+%Y-%m-%d %H:%M') echo "$ts|$input" >> "$DATA_DIR/run.log"Technical Analysis
The script persistently records user-provided task descriptions, configuration entries, reports, and other command arguments in plaintext files under
~/.local/share/trivia/. It creates the directory withmkdir -pand creates log files through shell redirection, but it does not establish a restrictiveumaskor explicitly set directory and file permissions.Consequently, effective permissions depend on the invoking process's ambient umask. With a permissive configuration, other local users or processes may be able to read the stored content. The Skill documentation encourages recording configuration changes and general workflow data, which could include confidential project names, paths, answer keys, operational details, or accidentally supplied credentials.
This issue does not itself provide remote access, privilege escalation, or code execution. Exploitation requires local filesystem access and permissions that allow the attacker to read the generated files.
Attack Path
- A user invokes a command such as
trivia config,trivia report, ortrivia runwith sensitive con ...[truncated 874 chars]
- A user invokes a command such as
- Remediation
View remediation
Remediation Suggestions
-
Set a restrictive umask before creating any storage:
bash umask 077 -
Create and validate the data directory with owner-only permissions:
bash install -d -m 0700 "$DATA_DIR" -
Create log files with mode
0600, and correct permissions on existing files:bash touch "$DATA_DIR/history.log" chmod 0600 "$DATA_DIR/history.log" -
Apply equivalent protection to every command-specific log and generated export.
-
Refuse to use the path if it is a symbolic link or is owned by another user.
-
Document that users should not submit credentials, API keys, tokens, or other secrets.
-
Consider configurable retention limits and a secure command for deleting historical records.
-
