T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/setup-cron.js:29
- Finding
- OpenClaw gateway token exposed through process arguments during cron setup<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup-cron.js:29-34` **Vulnerability Type**: Credential exposure through command-line arguments **Risk Level**: Medium ### Vulnerable Code ```js async function runOpenClaw(subcommandArgs) { const args = buildArgs(subcommandArgs); args.push('--token', OPENCLAW_GATEWAY_TOKEN); const result = await execFileAsync('openclaw', args, { encoding: 'utf8', env: process.env }); return result.stdout; } ``` ### Technical Analysis The script passes `OPENCLAW_GATEWAY_TOKEN` to the OpenClaw CLI through the `--token` command-line argument. Although `execFile` avoids shell interpolation, it does not protect the contents of the child process argument vector. While the command is running, the token may be visible through operating-system process inspection interfaces, monitoring software, diagnostic collectors, audit logs, or process accounting. The exact exposure depends on host-level process visibility and access controls. This is not command injection: `execFile` safely separates the executable from its arguments. The weakness is the placement of a bearer credential in process metadata. ### Attack Path 1. A user runs `node scripts/setup-cron.js`. 2. The script starts an `openclaw` process with `--token <OPENCLAW_GATEWAY_TOKEN>`. 3. A local user, monitoring agent, or diagnostic tool with permission to inspect process arguments captures the token while the process is active. 4. The observer reuses the captured bearer token to authenticate to the configured OpenClaw gateway. 5. The attacker can perform whichever gateway operations are authorized for that token. ### Impact Assessment Successful exploitation discloses the OpenClaw gateway token. The resulting privileges are limited to those assigned to the token, but may include cron-job creation, modification, listing, or deletion. If the gateway exposes additional operations to the same credential, those operations may also become available. The pr ...[truncated 123 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not transmit bearer credentials through command-line arguments. - Prefer an OpenClaw-supported environment variable, protected credential file, operating-system secret store, or stdin-based authentication mechanism. - If environment-based authentication is supported, construct a minimal child environment and omit the `--token` argument. - Avoid passing the entire parent `process.env` unless required; explicitly provide only necessary variables. - Restrict the token to the minimum cron-management permissions required by this Skill. - Ensure the gateway is bound to a trusted interface and protected by transport security where it is not strictly local. - Rotate any token believed to have been captured by process monitoring, diagnostics, or audit infrastructure. ]]>
