T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/send_agent_task.sh:27
- Finding
- Agent Response Content Is Persisted in a Plaintext Log## Vulnerability Details **File Location**: `scripts/send_agent_task.sh`, lines 27–28 **Vulnerability Type**: Plaintext storage of potentially sensitive agent output **Risk Level**: Medium ### Vulnerable Code ```bash # Log response echo "[$(date)] Response (${#RESPONSE} chars): ${RESPONSE:0:100}..." >> ~/agent_task.log ``` ### Technical Analysis The script appends the first 100 characters of every agent response to `~/agent_task.log`. Agent responses may contain private conversation data, operational information, credentials, access tokens, internal identifiers, or other sensitive material. The script does not explicitly create the log with restrictive permissions. Its effective permissions therefore depend on the user's current umask and whether the file already exists. It also provides no redaction, retention limit, rotation policy, or user-controlled option to disable response-content logging. ### Attack Path 1. An automated task requests or otherwise causes the agent to return sensitive information. 2. The script captures the complete response in the `RESPONSE` variable. 3. The first 100 characters of that response are appended to `~/agent_task.log`. 4. A local process, user, backup service, or other entity with access to the log reads the persisted response excerpt. 5. Any sensitive information present in that excerpt is disclosed outside the intended chat workflow. ### Impact Assessment Exploitation does not directly grant additional operating-system privileges. The impact is unauthorized disclosure of data available to the invoking user's agent. The scope is limited to response excerpts written by this script, but those excerpts can include secrets or operational data with value beyond the local account. The log persists after the task finishes, extending the exposure beyond the lifetime of the process and potentially placing the information in backups or log collection systems.
- Remediation
- ## Remediation Suggestions - Do not log agent response content by default. Record only metadata such as timestamp, success status, and response length. - If content logging is explicitly required, redact credentials, tokens, personal information, and other sensitive values before writing. - Create the log with mode `0600` in a protected application directory rather than relying on the ambient umask. - Reject or securely replace an existing log path that is a symbolic link. - Add rotation and retention limits so historical response data is not retained indefinitely. - Make sensitive-content logging an explicit opt-in setting and document its privacy implications. A safer log entry would be: ```bash umask 077 printf '[%s] Response received (%s chars)\n' \ "$(date)" "${#RESPONSE}" >> "$HOME/agent_task.log" ```
