T09 · Insecure Skill Coding Practices
- Location
krea_api.py:279- Finding
API Secret Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
krea_api.py:279-280; supporting documentation atREADME.md:23-25andSKILL.md:34-38
Vulnerability Type: Sensitive credential exposure through process arguments and shell history
Risk Level: MediumVulnerable 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_SECRETTechnical 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.aiis 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.jsonand documents mode600. That file-based mechanism is more appropriate and means command-line secret handling is not required for normal operation.Attack Path
- A user follows the documented example and executes the program with
--secret SECRET_VALUE. - The complete command is retained in shell history, captured in logs, or temporarily exposed through local process-inspection facilities.
- A local user, administrator, monitoring component, or party with access to collected logs retrieves the command-line value.
...[truncated 855 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the
--secretoption and use the existing permission-restricted credential file as the primary authentication mechanism. - If interactive entry is required, read the secret with Python's
getpass.getpass()so it is neither echoed nor included in process arguments. - 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.
- Update
README.mdandSKILL.mdto remove examples or recommendations that place literal credentials on the command line. - Retain the dedicated
~/.openclaw/credentials/krea.jsonpath, 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. - Advise users who previously used
--secretto clear affected shell history and logs where feasible, then rotate the exposed Krea API credential.
- Remove the
