T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/cos-upload.js:28
- Finding
- Cloud credentials exposed through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/cos-upload.js:28-29`; insecure usage is also documented in `SKILL.md:27-32` **Vulnerability Type**: Sensitive credential exposure through process arguments and shell history **Risk Level**: Medium ### Vulnerable Code ```javascript if (arg === '--secret-id' && args[i + 1]) options.secretId = args[++i]; else if (arg === '--secret-key' && args[i + 1]) options.secretKey = args[++i]; ``` The corresponding documented invocation is: ```bash node cos-upload.js /path/to/file.png \ --secret-id AKIDxxx \ --secret-key xxx \ --bucket my-bucket-1250000000 \ --region ap-guangzhou \ --path images/ ``` ### Technical Analysis The script accepts the Tencent Cloud Secret ID and Secret Key directly through command-line arguments. Command-line secrets may be retained in shell history and exposed through operating-system process inspection, audit telemetry, debugging output, or CI/CD execution logs. Tencent Cloud credentials can be long-lived and authorize operations beyond uploading a single file. The precise exposure depends on the execution environment and the permissions assigned to the credentials. ### Attack Path 1. A user follows the documented example and passes Tencent Cloud credentials through `--secret-id` and `--secret-key`. 2. The command is retained in shell history, process metadata, audit records, or automation logs. 3. A local user, administrator, monitoring system operator, or party with access to those records retrieves the credentials. 4. The exposed credentials are used to authenticate to Tencent Cloud APIs. 5. The attacker performs any operation authorized by the credentials' IAM policies. ### Impact Assessment Successful exploitation exposes the Tencent Cloud identity represented by the supplied credentials. The attacker can obtain all privileges granted to that identity, potentially including reading, uploading, replacing, or deleting COS objects and accessing other Tencent Clou ...[truncated 205 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Remove support for passing `SecretId` and `SecretKey` through command-line arguments. - Obtain credentials through Tencent Cloud's standard credential-provider mechanism, a protected configuration file, environment variables, or a dedicated secrets manager. - Prefer short-lived credentials issued through role-based authentication rather than long-lived static keys. - Apply least-privilege IAM policies that restrict the identity to the required bucket, object prefix, and operations. - Update `SKILL.md` to remove the command-line credential example and document the secure authentication method. - Add warnings against including secrets in shell commands, scripts, source control, CI configuration, or logs. - Rotate any credential that has already been passed through an exposed command line or retained in logs. ]]>
