T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:43
- Finding
- Bearer Token Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `SKILL.md:43-47`; vulnerable command examples appear at `SKILL.md:53-56` **Vulnerability Type**: Bearer credential exposure through process arguments and command history **Risk Level**: Medium ### Vulnerable Code ```markdown ## Protect credentials - Treat the `--key` value as sensitive - Do not print, commit, or hardcode the token - Keep the token in the command line argument, not in repo files ``` The documented command pattern is: ```sh cosin --key <token> <METHOD> <PATH> [--json '<json>'] [--header 'Name: value'] [--base-url <url>] cosin --key <token> agent [status|me] [--base-url <url>] cosin --key <token> skills ``` ### Technical Analysis The skill explicitly instructs users and agents to place a sensitive bearer token in a command-line argument. Depending on the operating environment, command-line arguments can be exposed through: - Shell history files. - Process inspection utilities and operating-system process interfaces. - Terminal transcripts and agent tool-call records. - CI/CD logs, debugging output, telemetry, or monitoring systems. - Parent processes and other local processes operating with sufficient inspection privileges. Avoiding repository files does not make command-line transmission safe. The token remains exposed to multiple local and operational logging surfaces. ### Attack Path 1. A user provides a valid COS bearer token to the agent. 2. The agent follows the documented command shape and invokes `cosin --key <token> ...`. 3. The complete command, including the token, is retained in shell history, process metadata, terminal logs, or agent execution records. 4. An attacker with access to one of those sources extracts the bearer token. 5. The attacker uses the token to authenticate to COS and issue requests as the victim. ### Impact Assessment Token theft may permit unau ...[truncated 361 chars]
- Remediation
- ## Remediation Suggestions - Do not pass bearer tokens directly as command-line arguments. - Add support for reading the token from a protected environment variable, standard input, operating-system credential store, or permission-restricted configuration file. - Prefer an interactive hidden prompt when a human supplies the token. - Ensure the CLI and surrounding agent infrastructure redact authorization credentials from logs, errors, telemetry, and command previews. - Document shell-history protections for any unavoidable sensitive invocation. - Use short-lived, narrowly scoped tokens and provide an immediate revocation and rotation procedure.
