T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/script.sh:4
- Finding
- Undisclosed Persistent Storage and Raw Activity Logging<![CDATA[ ## Vulnerability Details **File Location**: `scripts/script.sh:4-7`, `scripts/script.sh:30`, and `scripts/script.sh:44-52` **Vulnerability Type**: Undisclosed persistence of user-supplied data and command arguments **Risk Level**: Medium ### Vulnerable Code ```bash VERSION="2.0.0" DATA_DIR="${TEST_PUBLISH_CHECK_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/test-publish-check}" DB="$DATA_DIR/data.log" mkdir -p "$DATA_DIR" ``` ```bash _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; } ``` ```bash cmd_list() { [ -f "$DB" ] && cat "$DB" || echo " (empty)" _log "list" "${1:-}" } cmd_add() { echo "$(date +%Y-%m-%d) $*" >> "$DB"; echo " Added: $*" _log "add" "${1:-}" } ``` ### Technical Analysis The script creates a persistent data directory and stores user-supplied content in `data.log`. It also silently records command activity and the first supplied argument in `history.log`. This behavior is not aligned with the functionality documented in `SKILL.md`, which presents the skill as a generator of release-readiness checklists for code, APIs, deployment, versioning, launches, and regression tests. The documentation does not disclose that user input or command activity may be retained on disk. The storage destination is derived from `TEST_PUBLISH_CHECK_DIR`, `XDG_DATA_HOME`, or the user's home directory. Consequently, data can persist across executions and outside the audited project directory. Raw arguments are written without data classification, redaction, retention controls, or restrictive file permissions. This is not agent memory poisoning because the stored content is not shown to be loaded as future agent instructions. It is an insecure data-handling and privacy practice. ### Attack Path 1. A user or agent invokes `scripts/script.sh`, believing it provides the documented release-checking functionality. 2. The script creates a persistent directory under the configured data path. 3. The caller executes ...[truncated 1203 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove `scripts/script.sh` if it is unrelated to the documented checklist-generation capability. 2. If persistence is intentional, clearly document: - What data is stored. - The storage location. - The retention period. - How users can inspect and permanently delete records. 3. Require explicit user consent before writing supplied content to disk. 4. Do not log raw command arguments. Record only non-sensitive event metadata, or redact secrets and identifiers before logging. 5. Create the data directory and files with restrictive permissions, such as a `umask` of `077`. 6. Validate and constrain environment-controlled storage paths where the execution environment requires path isolation. 7. Add retention limits and secure deletion behavior. 8. Add automated tests confirming that sensitive arguments are not written to logs and that persistence does not occur unless explicitly requested. ]]>
