T09 · Insecure Skill Coding Practices
- Location
scripts/cerebrun.py:154- Finding
Bearer API Token Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/cerebrun.py:154-155andSKILL.md:59-64
Vulnerability Type: Sensitive credential exposure through process arguments and shell history
Risk Level: MediumVulnerable 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_KEYmarkdown 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-keyargument, 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
Authorizationheader and transmitted to the declaredhttps://cereb.run/mcpendpoint. 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
- A user follows the documented example and invokes the script using
--api-keywith a real bearer token. - The command containing the token is recorded in shell history, process metadata, monitoring telemetry, or audit logs.
- A local user, compromised process, administrator, or party with access to collected logs retrieves the exposed token.
- The attacker submits authenticated requests to ...[truncated 953 chars]
- A user follows the documented example and invokes the script using
- Remediation
View remediation
Remediation Suggestions
- Remove the
--api-keycommand-line option so secrets cannot be supplied through process arguments. - Prefer a protected credential source such as an operating-system keyring, a secret manager, or a configuration file restricted to the current user.
- Retain
CEREBRUN_API_KEYonly as a compatibility mechanism and document the security implications of environment-based secrets. - If interactive operation is required, obtain the token with
getpass.getpass()so it is not echoed or stored in shell history. - Replace all documentation examples that use
--api-keywith secure credential-setup instructions. - Ensure errors, debug output, telemetry, and HTTP diagnostics never include the
Authorizationheader or token value. - Encourage short-lived, narrowly scoped tokens and provide token rotation and revocation guidance in case exposure is suspected.
- Remove the
