T09 · Insecure Skill Coding Practices
- Location
scripts/cex_trader_cli.py:195- Finding
Exchange credentials are exposed through command-line arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/cex_trader_cli.py:151-159, 195-199
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: HighVulnerable Code
python def cmd_setup_save(args): params = { "exchange": args.exchange, "apiKey": args.apiKey, "secretKey": args.secretKey, } if args.passphrase: params["passphrase"] = args.passphrase print_result(call_tool("cex-setup-save", params))python s_save = setup_sub.add_parser("save", help="Save API credentials") s_save.add_argument("--exchange", required=True, choices=["okx", "binance"]) s_save.add_argument("--apiKey", required=True, help="API Key") s_save.add_argument("--secretKey", required=True, help="API Secret") s_save.add_argument("--passphrase", help="Passphrase (required for OKX)") s_save.set_defaults(func=cmd_setup_save)Technical Analysis
The setup interface requires exchange API keys, API secrets, and optional OKX passphrases to be supplied directly as command-line arguments. Command-line secrets may be exposed through:
- Shell history files.
- Process inspection utilities while the command is running.
- Terminal session recording.
- Operating-system audit facilities.
- CI/CD job logs and automation wrappers.
- Diagnostic reports that capture process command lines.
The credentials are subsequently placed into a JSON request and sent to the configured MCP server. Although transmitting credentials is part of the declared remote setup workflow, accepting them through command-line flags is not the minimum exposure necessary to implement that workflow.
Attack Path
- A user follows the documented setup pattern and runs the CLI with
--apiKey,--secretKey, and possibly--passphrase. - The shell records the full command, or another local user or monitoring process observes the process command line.
...[truncated 920 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove or deprecate the
--secretKeyand--passphrasecommand-line options. - Read secrets through an interactive hidden prompt using
getpass.getpass()when running in a terminal. - Support protected environment variables or a secret manager for non-interactive automation.
- If file-based input is necessary, require restrictive permissions and avoid retaining the file after use.
- Keep non-secret parameters such as the exchange name as ordinary CLI arguments.
- Ensure request failures, debug output, telemetry, and exception handlers never print credential-bearing payloads.
- Update all documentation so examples do not place secrets directly in shell commands.
- Recommend narrowly scoped, trading-only keys with IP allowlisting and no withdrawal or transfer permissions.
- Remove or deprecate the
