T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:6- Finding
Plaintext Operational Data Is Stored Without Restrictive Permissions
- Content
View full analysis
Vulnerability Details
File Location:
scripts/script.sh:6-9, 143-301
Vulnerability Type: Plaintext sensitive-data storage with ambient filesystem permissions
Risk Level: MediumVulnerable Code
bash DATA_DIR="${HOME}/.local/share/etl" mkdir -p "$DATA_DIR" _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }Representative logging code used by the data commands:
bash local input="$*" local ts=$(date '+%Y-%m-%d %H:%M') echo "$ts|$input" >> "$DATA_DIR/query.log" local total=$(wc -l < "$DATA_DIR/query.log") echo " [Etl] query: $input" echo " Saved. Total query entries: $total" _log "query" "$input"Equivalent verbatim logging is performed for ingest, transform, filter, aggregate, visualize, export, sample, schema, validate, pipeline, and profile entries.
Technical Analysis
The Skill stores caller-controlled operational information in plaintext under
~/.local/share/etl/. This information may include SQL statements, source and destination identifiers, schemas, validation results, storage locations, and pipeline configurations.The script creates its data directory with
mkdir -pand creates log files through shell redirection, but it does not establish a restrictiveumaskor explicitly set directory and file permissions. As a result, permissions depend on the invoking process's environment. Under a commonumaskof022, newly created files are typically mode0644and the directory is typically mode0755. If the user's home directory and its parent components permit traversal, other local users may be able to read the logs.The code does not introduce command execution through the logged values because the input is quoted when written. The security concern is local confidentiality rather than command injection.
Attack Path
- A user invokes an ETL logging command with sensitive operational content, such as a SQL query, interna ...[truncated 1216 chars]
- Remediation
View remediation
Remediation Suggestions
-
Establish a restrictive file-creation mask before creating any persistent data:
bash umask 077 -
Create and enforce a user-only directory:
bash mkdir -p -m 700 "$DATA_DIR" chmod 700 "$DATA_DIR" -
Create log files with mode
0600, or enforce that mode after creation:bash touch "$DATA_DIR/history.log" chmod 600 "$DATA_DIR/history.log"Apply the same protection to every command-specific log and generated export file.
-
Validate existing storage at startup and reject unsafe conditions, including a data directory owned by another user or implemented as an unexpected symbolic link.
-
Document that users must not record passwords, access tokens, private keys, or other secrets. Where feasible, redact common credential patterns before persistence.
-
Consider an optional encrypted storage mechanism when logs are expected to contain confidential operational data.
-
