T09 · Insecure Skill Coding Practices
Warning
- Location
- krea_api.py:279
- Finding
- API Secret Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `krea_api.py:279-280`; supporting documentation at `README.md:23-25` and `SKILL.md:34-38` **Vulnerability Type**: Sensitive credential exposure through process arguments and shell history **Risk Level**: Medium ### Vulnerable Code ```python parser.add_argument("--key-id", help="API key ID") parser.add_argument("--secret", help="API secret") ``` The README explicitly instructs users to supply credentials this way: ```bash python3 krea_api.py --prompt "..." --key-id YOUR_KEY_ID --secret YOUR_SECRET ``` ### Technical Analysis The application accepts the Krea API secret as a literal command-line argument. Command-line arguments are not a secure secret-transport mechanism because they may be: - Stored in interactive shell history. - Captured by command auditing, telemetry, or process-monitoring systems. - Visible through operating-system process inspection while the command is running. - Included in terminal transcripts, support bundles, or automation logs. The secret is subsequently combined with the key ID and used as a Bearer credential. Although transmitting that credential to the fixed HTTPS endpoint `https://api.krea.ai` is necessary for the declared functionality, accepting it directly on the command line unnecessarily expands its exposure surface. The project also supports a dedicated credential file at `~/.openclaw/credentials/krea.json` and documents mode `600`. That file-based mechanism is more appropriate and means command-line secret handling is not required for normal operation. ### Attack Path 1. A user follows the documented example and executes the program with `--secret SECRET_VALUE`. 2. The complete command is retained in shell history, captured in logs, or temporarily exposed through local process-inspection facilities. 3. A local user, administrator, monitoring component, or party with access to collected logs retrieves the command-line value. ...[truncated 855 chars]
- Remediation
- ## Remediation Suggestions 1. Remove the `--secret` option and use the existing permission-restricted credential file as the primary authentication mechanism. 2. If interactive entry is required, read the secret with Python's `getpass.getpass()` so it is neither echoed nor included in process arguments. 3. For automation, integrate with a secret manager or accept the name of a protected environment variable rather than accepting the secret value as an argument. 4. Update `README.md` and `SKILL.md` to remove examples or recommendations that place literal credentials on the command line. 5. Retain the dedicated `~/.openclaw/credentials/krea.json` path, but validate before use that it is a regular file, is owned by the expected user, and is not accessible by group or other users. 6. Advise users who previously used `--secret` to clear affected shell history and logs where feasible, then rotate the exposed Krea API credential.
