T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/search.py:35
- Finding
- Unredacted Search Queries Written to Standard Output<![CDATA[ ## Vulnerability Details **File Location**: `scripts/search.py`, lines 35–40 **Vulnerability Type**: Sensitive data exposure through application logging **Risk Level**: Medium ### Vulnerable Code ```python query = sys.argv[1] parse_data = {} try: parse_data = json.loads(query) print(f"success parse request body: {parse_data}") except json.JSONDecodeError as e: print(f"JSON parse error: {e}") ``` ### Technical Analysis After parsing the command-line JSON argument, the script prints the complete request object to standard output. This includes the value of `query` and any additional caller-supplied fields. Search queries can contain confidential names, internal URLs, unpublished project information, incident data, personal information, credentials pasted by mistake, or other sensitive context. Printing the full request is not necessary to perform the declared search functionality. Standard output may be retained in OpenClaw transcripts, gateway logs, terminal capture systems, CI/CD logs, monitoring services, or other centralized logging infrastructure. Consequently, data intended only for the search provider may be disclosed to additional parties with log access. The API key itself is not included in this log statement. ### Attack Path 1. A user or Agent invokes the Skill with confidential information in the `query` field. 2. The script parses the supplied JSON. 3. The `print` statement serializes and writes the entire parsed object to standard output. 4. OpenClaw, a shell wrapper, CI system, or monitoring service captures the output. 5. A user or process with access to those logs retrieves the confidential query. An attacker able to influence search requests could also deliberately place sensitive-looking or misleading content in logs, although this does not directly grant code execution. ### Impact Assessment Successful exploitation exposes the contents of search requests to parties that can access captured output. The scope i ...[truncated 312 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions Remove the request-body logging statement entirely: ```python parse_data = json.loads(query) ``` If operational logging is required: 1. Log only non-sensitive metadata, such as whether parsing succeeded. 2. Do not log the query text or arbitrary caller-supplied fields. 3. Send diagnostics to standard error rather than mixing them with structured search results. 4. Make verbose logging opt-in and disabled by default. 5. Apply field-based redaction before logging any request object. 6. Configure Agent and gateway logs with restrictive access controls and short retention periods. 7. Review existing logs and securely delete historical query data where appropriate. ]]>
