T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/bitwarden-credential.sh:22
- Finding
- Credentials Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/bitwarden-credential.sh`, lines 22-29 **Vulnerability Type**: Sensitive information exposure through process arguments **Risk Level**: High ### Vulnerable Code ```bash NAME="${1:-}" USERNAME="${2:-}" PASSWORD="${3:-}" NOTES="${4:-}" if [ -z "$NAME" ] || [ -z "$USERNAME" ] || [ -z "$PASSWORD" ]; then echo "Usage: bitwarden-credential.sh <name> <username> <password> [notes]" exit 1 fi ``` The insecure invocation pattern is also explicitly documented in `SKILL.md`, lines 32-40 and 49: ```bash BW_SESSION="<session-key>" ./bitwarden-credential.sh <name> <username> <password> [notes] ``` ```bash ./scripts/bitwarden-credential.sh "<name>" "<username>" "<password>" "[notes]" ``` ### Technical Analysis The script accepts passwords, API keys, OAuth tokens, and other secrets as positional command-line arguments. Command-line arguments are not an appropriate transport for sensitive values because they can be exposed through: - Process inspection interfaces such as `ps` or `/proc`. - Shell command history. - Agent command transcripts and execution telemetry. - Endpoint monitoring and operating-system audit logs. - CI/CD logs or debugging output that records executed commands. Quoting the arguments prevents shell word splitting but does not prevent their disclosure through process metadata or command logging. ### Attack Path 1. A user or AI agent follows the documented invocation pattern and includes a credential as the third argument. 2. The shell starts the script with the secret present in its argument vector. 3. A process monitor, local process running under an authorized account, shell-history collector, audit subsystem, or agent telemetry system records the command arguments. 4. An attacker obtains access to the process data, history, transcript, or logs. 5. The attacker extracts and reuses the password, API key, or OAuth token. ### Impact Assessment Successful exploitation discloses the cr ...[truncated 421 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not accept passwords or tokens as positional command-line arguments. - Read the secret from standard input or a dedicated file descriptor. For interactive use, use a hidden prompt such as `read -r -s`. - Keep non-sensitive fields such as the item name and username separate from secret input. - Avoid generating or logging commands that contain credentials. - Update `SKILL.md` so none of its examples place passwords, tokens, or session keys directly on a command line. - Where automation requires non-interactive input, pass the secret through a protected pipe or permission-restricted temporary mechanism and ensure it is never written to logs. - Clear temporary shell variables when they are no longer required, while recognizing that this does not remediate prior argument-vector exposure. ]]>
