T09 · Insecure Skill Coding Practices
Warning
- Location
- alibaba_super_resolve.py:288
- Finding
- Alibaba Cloud Access Key Secret Accepted Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `alibaba_super_resolve.py:288-289` **Vulnerability Type**: Credential exposure through process arguments **Risk Level**: Medium ### Vulnerable Code ```python parser.add_argument('--access-key-id', help='Alibaba Cloud Access Key ID (overrides env)') parser.add_argument('--access-key-secret', help='Alibaba Cloud Access Key Secret (overrides env)') ``` ### Technical Analysis The CLI accepts an Alibaba Cloud Access Key Secret directly through `--access-key-secret`. Command-line arguments are not an appropriate secret-transport mechanism because they may be exposed through: - Shell history files. - Process listings and process-inspection interfaces. - Endpoint monitoring and process telemetry. - CI/CD build logs. - Wrapper scripts or command-execution logs. - Diagnostic reports that capture process arguments. Although the application also supports environment variables, the command-line option creates a less secure alternative that can expose a long-lived cloud credential outside the intended process. ### Attack Path 1. A user starts the tool with `--access-key-id` and `--access-key-secret`. 2. The operating system, shell, monitoring agent, or automation environment records or exposes the process command line. 3. A local user, log reader, monitoring-system operator, or attacker with access to the captured data obtains the secret. 4. The attacker uses the Access Key ID and Access Key Secret to authenticate to Alibaba Cloud. 5. The attacker performs any operations allowed by the permissions assigned to that credential. ### Impact Assessment Successful exploitation discloses an Alibaba Cloud credential. The resulting privileges are limited by the RAM policies attached to the exposed access key, but could include use of paid video-processing APIs and access to other Alibaba Cloud resources if the credential has broader permissions. Potential consequences include unauthorized API usage, financial cost, acc ...[truncated 110 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the `--access-key-secret` command-line option. 2. Prefer Alibaba Cloud's standard credential-provider chain or a dedicated credential configuration file with restrictive filesystem permissions. 3. Continue supporting environment variables only where required, while ensuring they are not logged. 4. If interactive entry is needed, use `getpass.getpass()` so the secret is not echoed or added to shell history. 5. Use short-lived Security Token Service credentials instead of long-lived access keys where possible. 6. Apply least-privilege RAM policies to the credential used by this tool. 7. Ensure logging, exception handling, and diagnostics never serialize credentials. 8. Document credential rotation procedures and rotate any key previously supplied on a command line in a logged or shared environment. ]]>
