T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:6- Finding
Sensitive context logs are created without enforced restrictive permissions
- Content
View full analysis
Vulnerability Details
File Location:
scripts/script.sh:6-9; representative log writes occur atscripts/script.sh:131-300
Vulnerability Type: Insecure storage permissions for potentially sensitive context data
Risk Level: MediumVulnerable Code
bash DATA_DIR="${HOME}/.local/share/ctxkeeper" mkdir -p "$DATA_DIR" _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }Representative category-specific storage follows this pattern:
bash echo "$ts|$input" >> "$DATA_DIR/run.log" _log "run" "$input"Technical Analysis
The Skill stores user-provided conversation and operational context under
~/.local/share/ctxkeeper, but it does not establish a restrictiveumaskor explicitly set permissions on the directory and log files.File and directory permissions therefore depend on the invoking process's environment. With a common
umaskof022, the directory can be created with mode0755and log files with mode0644. If the user's home directory permits traversal, other local users may be able to read the retained context.Each submitted entry is written both to a category-specific log and to
history.log, increasing the number of copies containing potentially sensitive information. The Skill does not warn users against storing credentials, access tokens, private conversation content, internal hostnames, deployment details, or other confidential operational data.Attack Path
- A user invokes a recording command and supplies sensitive information, such as
ctxkeeper run "deployed with token ...". - The script creates the data directory and log files using permissions inherited from the current
umask. - The submitted content is written to a category-specific log and duplicated in
history.log. - On a shared system where the home directory is traversable, another local account enumerates or directly reads
~/.local/share/ctxkeeper/*.log. 5 ...[truncated 959 chars]
- A user invokes a recording command and supplies sensitive information, such as
- Remediation
View remediation
Remediation Suggestions
Enforce private permissions before creating any data files:
bash umask 077 DATA_DIR="${HOME}/.local/share/ctxkeeper" install -d -m 700 "$DATA_DIR" touch "$DATA_DIR/history.log" chmod 600 "$DATA_DIR/history.log"Apply restrictive permissions to existing logs during startup or migration:
bash find "$DATA_DIR" -maxdepth 1 -type f -name '*.log' -exec chmod 600 {} + chmod 700 "$DATA_DIR"Additional hardening should include:
- Documenting that credentials and secrets must not be recorded.
- Avoiding unnecessary duplication of sensitive entries in
history.log. - Providing pruning and secure deletion controls.
- Considering encryption at rest when the logs may contain confidential context.
- Verifying ownership of the data directory before writing to it.
