T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/cerebrun.py:154
- Finding
- Bearer API Token Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `scripts/cerebrun.py:154-155` and `SKILL.md:59-64` **Vulnerability Type**: Sensitive credential exposure through process arguments and shell history **Risk Level**: Medium ### Vulnerable Code `scripts/cerebrun.py:154-155`: ```python parser.add_argument("--api-key", default=os.getenv("CEREBRUN_API_KEY"), help="Cerebrun API key (or CEREBRUN_API_KEY env)") ``` `SKILL.md:59-64`: ```markdown scripts/cerebrun.py get_context --layer 0 --api-key YOUR_KEY scripts/cerebrun.py search_context --query "project" --api-key YOUR_KEY scripts/cerebrun.py push_knowledge --content "New idea" --category "todo" --api-key YOUR_KEY ``` ```markdown Store API key in environment: `CEREBRUN_API_KEY` or pass via `--api-key` ``` ### Technical Analysis The CLI accepts the Cerebrun bearer token directly through the `--api-key` argument, and the documentation actively demonstrates this usage. Command-line arguments may be retained in shell history and exposed through process inspection, endpoint monitoring, terminal logging, command auditing, or diagnostic data. This token is subsequently placed in the HTTP `Authorization` header and transmitted to the declared `https://cereb.run/mcp` endpoint. Sending the token to that endpoint over HTTPS is necessary for the advertised remote-client functionality. The vulnerability is not the intended network request itself, but the avoidable exposure created by accepting and documenting the secret as a command-line argument. ### Attack Path 1. A user follows the documented example and invokes the script using `--api-key` with a real bearer token. 2. The command containing the token is recorded in shell history, process metadata, monitoring telemetry, or audit logs. 3. A local user, compromised process, administrator, or party with access to collected logs retrieves the exposed token. 4. The attacker submits authenticated requests to ...[truncated 953 chars]
- Remediation
- ## Remediation Suggestions 1. Remove the `--api-key` command-line option so secrets cannot be supplied through process arguments. 2. Prefer a protected credential source such as an operating-system keyring, a secret manager, or a configuration file restricted to the current user. 3. Retain `CEREBRUN_API_KEY` only as a compatibility mechanism and document the security implications of environment-based secrets. 4. If interactive operation is required, obtain the token with `getpass.getpass()` so it is not echoed or stored in shell history. 5. Replace all documentation examples that use `--api-key` with secure credential-setup instructions. 6. Ensure errors, debug output, telemetry, and HTTP diagnostics never include the `Authorization` header or token value. 7. Encourage short-lived, narrowly scoped tokens and provide token rotation and revocation guidance in case exposure is suspected.
