T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:91
- Finding
- Session Key Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 91-99 **Vulnerability Type**: Secret exposure through process arguments and shell history **Risk Level**: High ### Vulnerable Code ```bash # Store agent session key (not master key!) op item create \ --vault "Agent-Wallets" \ --category "API Credential" \ --title "trading-bot-session" \ --field "session-key[password]=0xsession..." \ --field "expires=2026-02-15T00:00:00Z" \ --field "spending-cap=1000 USDC" \ --field "allowed-contracts=0xDEX1,0xDEX2" ``` ### Technical Analysis The documented command supplies the wallet session key directly as a command-line argument. Replacing the placeholder with an actual key can expose that key through: - Shell history files. - Terminal session recording and audit logs. - Process inspection utilities while the command is running. - Process accounting or endpoint-monitoring software. - Debug output or copied command transcripts. Although the key is described as a bounded session key rather than a master key, it remains an authentication credential capable of authorizing wallet operations. Storing it securely in 1Password does not prevent disclosure that occurs before the CLI receives and stores it. ### Attack Path 1. An operator follows the documented setup procedure and substitutes a real session key for `0xsession...`. 2. The shell records the command in history, or the operating system exposes its arguments while it executes. 3. An attacker with access to the same account, terminal logs, process telemetry, backups, or other local inspection facilities recovers the session key. 4. The attacker uses the recovered credential before expiration or revocation. 5. The attacker performs transactions permitted by the key's spending cap, contract allowlist, and other delegated policies. ### Impact Assessment Successful exploitation compromises the delegated wallet authority associated with the session key. The attacker could authorize oper ...[truncated 390 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not pass secrets as literal command-line arguments. - Use a supported 1Password input mechanism that obtains secret values from protected standard input, an interactive concealed prompt, or another channel that does not expose them in the process argument list. - If a temporary import or template file is unavoidable: - Create it with permissions restricted to the current user. - Store it on an encrypted or memory-backed filesystem where practical. - Delete it immediately after use. - Ensure it is excluded from source control and backups. - Prevent commands containing sensitive values from being retained in shell history; do not rely on this measure alone because process arguments may remain observable. - Review process accounting, terminal recording, CI logs, and endpoint telemetry to confirm that secret-bearing inputs are not retained. - Rotate any session key that has already been entered using the documented command. - Preserve defense in depth by enforcing short expiration periods, low spending caps, narrowly scoped contract allowlists, monitoring, and rapid revocation. ]]>
