T09 · Insecure Skill Coding Practices
- Location
scripts/merge.sh:8- Finding
Sensitive agent memory is stored in an insecure temporary directory and exposed through output logs
- Content
View full analysis
/dev/null || echo "") if [ -n "$memory" ]; then echo "=== $agent_id ===" >> "$STAGING_DIR/all-memories.txt" echo "$memory" >> "$STAGING_DIR/all-memories.txt" echo "" >> "$STAGING_DIR/all-memories.txt" fi done echo "[merge] Staged memory files from: $AGENT_BRANCHES" echo "[merge] Output at: $STAGING_DIR/all-memories.txt" cat "$STAGING_DIR/all-memories.txt" ``` ### Technical Analysis The script creates a predictable temporary directory using its process ID: ```bash STAGING_DIR="/tmp/clawng-merge-$$" mkdir -p "$STAGING_DIR" ``` This construction does not provide atomic, secure temporary-directory creation. An attacker with local access may be able to predict the process ID and create the path before the script does. Depending on operating-system protections and account permissions, this can cause denial of service or facilitate unsafe path manipulation. The script also does not set a restrictive `umask` or explicitly assign owner-only permissions. It writes aggregated contents from every remote agent's `MEMORY.md` into a plaintext file. These files may contain user context, operational information, private conversations, or other sensitive long-term memory. The temporary directory is removed only when no ...[truncated 1935 chars]- Remediation
View remediation
"$OUTPUT_FILE" chmod 600 "$OUTPUT_FILE" # Populate OUTPUT_FILE without printing its contents. echo "[merge] Memory collection completed." ``` A more robust design would avoid writing the aggregate to disk and instead stream it directly to the authorized synthesis process through a pipe or protected standard input. ]]>
