T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:6- Finding
Sensitive health records are created without restrictive permissions
- Content
View full analysis
> "$DATA_DIR/history.log"; } ``` A representative health-data write is: ```bash log) shift if [ $# -eq 0 ]; then echo "Recent log entries:" tail -20 "$DATA_DIR/log.log" 2>/dev/null || echo " No entries yet. Use: bmi log " 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 " [Bmi] log: $input" echo " Saved. Total log entries: $total" _log "log" "$input" fi ``` The same unrestricted append pattern is used for the other health-related log files. ### Technical Analysis The program stores potentially sensitive health information, including weight tracking, goals, reminders, trends, and milestones, under `~/.local/share/bmi`. It neither establishes a restrictive process `umask` nor explicitly assigns secure permissions to the data directory and files. Consequently, the effective permissions depend on the environment from which the program is launched. With a permissive `umask`, the directory may be created as mode `0755` and files as mode `0644`, allowing other local users to traverse the directory and read the records. Existing directories and files are also not checked or hardened. This issue is conditional on the caller's `umask`, home-directory permissions, and local filesystem access controls. It does not independently bypass an otherwise non-traversable home directory. ### Attack Path 1. A user runs the BMI tool in an environment with a permissive `umask`, such as `0022`. 2. The scrip ...[truncated 706 chars]- Remediation
View remediation
