T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/run_inspection.py:801
- Finding
- Database and SSH credentials are exposed through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:170-312`; `scripts/run_inspection.py:801-820, 908-923` **Vulnerability Type**: Sensitive credentials in process arguments **Risk Level**: High ### Vulnerable Code The Skill instructs the Agent to place database passwords directly on the command line: ```bash python run_inspection.py \ --type mysql \ --host <database-IP> \ --port 3306 \ --user <username> \ --password <password> \ --label "<database-label>" \ --inspector "<inspector-name>" ``` The dispatcher also accepts database and SSH credentials as ordinary command-line arguments: ```python parser.add_argument('--user', help='Database username') parser.add_argument('--password', help='Database password') parser.add_argument('--ssh-user', default=None, help='SSH username (optional)') parser.add_argument('--ssh-password', default=None, help='SSH password (optional)') parser.add_argument('--ssh-key', default=None, help='SSH private-key path (optional, alternative to password)') ``` The parsed values are then retained in process memory: ```python db_info = { 'label': args.label, 'host': args.host, 'port': args.port, 'user': args.user, 'password': args.password, } if args.ssh_host: ssh_info = { 'ssh_host': args.ssh_host, 'ssh_port': args.ssh_port, 'ssh_user': args.ssh_user, 'ssh_password': args.ssh_password or '', 'ssh_key_file': args.ssh_key or '', } ``` ### Technical Analysis On common operating systems, process arguments are not a secure secret-delivery mechanism. Depending on the platform and host configuration, they may be exposed through: - Process-listing utilities such as `ps`; - `/proc/<pid>/cmdline` on Linux; - Shell history; - Process accounting or endpoint monitoring; - Agent execution transcripts and orchestration logs; - Error reports that capture the invoked command. The same problem ...[truncated 1421 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove `--password` and `--ssh-password` from the recommended invocation flow. 2. Read passwords interactively with `getpass.getpass()` when attached to a terminal. 3. For automated operation, accept secrets through: - A protected file descriptor; - Standard input with explicit non-logging handling; - An operating-system credential store; - A secret manager; - A short-lived credential token. 4. If environment variables must be supported for compatibility, document that they may still be visible to same-user processes and must not be logged. 5. Ensure Agent integrations pass secrets through a dedicated secret field rather than embedding them in an `execute_command` string. 6. Redact arguments named `password`, `ssh-password`, `token`, and `api-key` in execution logs and exception telemetry. 7. Prefer short-lived, read-only database accounts created specifically for inspection. ]]>
