T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:5- Finding
Persistent Financial Operation Logs Are Created Without Restrictive Permissions
- Content
View full analysis
Vulnerability Details
File Location:
scripts/script.sh:5-8; input-writing branches atscripts/script.sh:126-305
Vulnerability Type: Plaintext sensitive-data storage with permissions inherited from the caller's umask
Risk Level: MediumVulnerable Code
bash DATA_DIR="${HOME}/.local/share/finml-toolkit" mkdir -p "$DATA_DIR" _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }Representative persistent input storage:
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: finml-toolkit run <input>" else local input="$*" local ts=$(date '+%Y-%m-%d %H:%M') echo "$ts|$input" >> "$DATA_DIR/run.log" local total=$(wc -l < "$DATA_DIR/run.log") echo " [Finml Toolkit] run: $input" echo " Saved. Total run entries: $total" _log "run" "$input" fi ;;The same storage pattern is repeated for the
check,convert,analyze,generate,preview,batch,compare,export,config,status, andreportcommands.Technical Analysis
The script persistently records arbitrary user input in plaintext log files under
~/.local/share/finml-toolkit. It creates the data directory withmkdir -pand creates log files through shell redirection, but it does not establish a restrictiveumaskor explicitly enforce directory and file permissions.Consequently, permissions depend on the invoking process's environment. With a common
022umask, a newly created directory may have mode0755and log files may have mode0644. If the user's home-directory traversal permissions permit access, other local accounts could read these files.This is particularly relevant because the documented use cases include financial strategy descriptions, portfolio verification, configuration records, and financial-processing reports. Use ...[truncated 1436 chars]
- Remediation
View remediation
Remediation Suggestions
- Establish a restrictive umask before creating any persistent storage:
bash umask 077- Create and enforce a private data directory:
bash DATA_DIR="${FINML_TOOLKIT_DIR:-${HOME}/.local/share/finml-toolkit}" mkdir -p -m 700 -- "$DATA_DIR" chmod 700 -- "$DATA_DIR"- Ensure every existing or newly created log and export file is owner-readable and owner-writable only:
bash touch -- "$DATA_DIR/history.log" chmod 600 -- "$DATA_DIR/history.log"Apply equivalent permission enforcement to command-specific logs and generated export files.
-
Validate that a configured data directory is owned by the current user and is not an unsafe symbolic link before writing to it.
-
Document that users must not place passwords, API tokens, private keys, or other credentials in log-command arguments.
-
Consider optional redaction of common secret formats and provide a retention or secure-deletion mechanism for sensitive historical records.
