T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:7- Finding
Plaintext Persistence of User-Supplied Content with Insufficient Access Controls
- Content
View full analysis
Vulnerability Details
File Location:
scripts/script.sh:7-81
Vulnerability Type: Plaintext sensitive-data storage and log injection
Risk Level: MediumVulnerable Code
bash DATA_DIR="${ADWORDS_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/adwords}" DB="$DATA_DIR/data.log" mkdir -p "$DATA_DIR" _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; } cmd_draft() { echo " Draft: $1 Target: ${2:-800} words" _log "draft" "${1:-}" } cmd_headline() { echo " 1. How to $1 2. $1: Complete Guide 3. Why $1 Matters" _log "headline" "${1:-}" } cmd_outline() { echo " 1. Intro | 2. Problem | 3. Solution | 4. Examples | 5. CTA" _log "outline" "${1:-}" } cmd_seo() { echo " Keywords: $1 | Title tag | Meta desc | H1-H3 | Internal links" _log "seo" "${1:-}" } cmd_schedule() { echo " Mon: Research | Tue: Write | Wed: Edit | Thu: Publish | Fri: Promote" _log "schedule" "${1:-}" } cmd_hooks() { echo " Question | Statistic | Story | Bold claim | Controversy" _log "hooks" "${1:-}" } cmd_cta() { echo " Subscribe | Share | Comment | Try it | Learn more" _log "cta" "${1:-}" } cmd_repurpose() { echo " Blog -> Thread -> Video -> Carousel -> Newsletter" _log "repurpose" "${1:-}" } cmd_metrics() { echo " Views | Clicks | Shares | Time on page | Conversions" _log "metrics" "${1:-}" } cmd_ideas() { echo " How-to | Listicle | Case study | Interview | Comparison" _log "ideas" "${1:-}" }Technical Analysis
The script records the first user-supplied argument from every content command in the persistent file
$DATA_DIR/history.log. This behavior is enabled by default and is not disclosed in the documented invocation workflow.Neither the data directory nor the history file is created with explicit restrictive permissions. T ...[truncated 2396 chars]
- Remediation
View remediation
Remediation Suggestions
-
Disable history logging by default and require an explicit opt-in configuration option.
-
Do not store raw user arguments. If operational telemetry is required, record only non-sensitive command names or irreversible, appropriately keyed identifiers.
-
Create the data directory and log with restrictive permissions:
bash umask 077 install -d -m 700 -- "$DATA_DIR" touch "$DATA_DIR/history.log" chmod 600 "$DATA_DIR/history.log" -
Validate that
ADWORDS_DIRrefers to an expected, user-owned directory and reject unsafe destinations where appropriate. -
Remove carriage returns and newline characters before writing any user-controlled value to a line-oriented log, or use a structured serialization format with proper escaping.
-
Document what is logged, the storage location, retention period, deletion procedure, and security implications.
-
Provide a command or documented process for securely deleting existing history.
-
Add automated tests confirming that logging is opt-in, files are not accessible to other local users, and multiline input cannot forge records.
-
