T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:6- Finding
Sensitive Health Records Are Stored Without Enforced Restrictive Permissions
- Content
View full analysis
Vulnerability Details
File Location:
scripts/script.sh, lines 6–9 and 120–127; equivalent writes occur in the other record-handling branches
Vulnerability Type: Plaintext sensitive-data storage with umask-dependent permissions
Risk Level: MediumVulnerable Code
bash DATA_DIR="${HOME}/.local/share/symptom" mkdir -p "$DATA_DIR" _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }bash else local input="$*" local ts=$(date '+%Y-%m-%d %H:%M') echo "$ts|$input" >> "$DATA_DIR/log.log" local total=$(wc -l < "$DATA_DIR/log.log") echo " [Symptom] log: $input" echo " Saved. Total log entries: $total" _log "log" "$input"Technical Analysis
The skill stores health information and activity history as plaintext files beneath
~/.local/share/symptom/. It creates the directory and files without setting a restrictiveumaskor explicitly enforcing directory and file permissions.Consequently, permissions are inherited from the invoking process's umask. With a common umask such as
022, the directory may be created as0755and log files as0644. If the user's home-directory hierarchy is traversable by other local users, those users may be able to read symptom records.The same pattern is used by the
track,chart,goal,remind,weekly,monthly,compare,export,streak,milestone, andtrendbranches. The history log also duplicates submitted values, increasing the number of files containing sensitive information.Attack Path
- A user invokes the skill with private health information, such as
symptom log severe headache. - The script creates
~/.local/share/symptomand its log files using permissions derived solely from the current umask. - Under a permissive umask, the resulting directory or files are readable by group membe ...[truncated 886 chars]
- A user invokes the skill with private health information, such as
- Remediation
View remediation
Remediation Suggestions
-
Set a restrictive umask before creating or writing any application data:
bash umask 077 DATA_DIR="${HOME}/.local/share/symptom" mkdir -p -- "$DATA_DIR" chmod 700 -- "$DATA_DIR" -
Enforce secure permissions on existing data files:
bash find "$DATA_DIR" -type f -exec chmod 600 {} + -
Create new files with mode
0600, rather than relying only on the environment's umask. Where appropriate, initialize files withinstall -m 600 /dev/null "$file"before appending to them. -
Consider encrypting health records at rest when the expected threat model includes privileged backup operators, stolen disks, or accounts capable of bypassing ordinary file permissions.
-
Avoid duplicating sensitive values in
history.log, or retain only non-sensitive event metadata there. -
Add automated tests that run the skill under permissive umasks and verify that the data directory remains
0700and all record files remain0600.
-
