T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:56
- Finding
- Cloud Credentials Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `SKILL.md`, lines 56–58 **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: Medium ```javascript // Step 3: COS上传 // node skills/ima-skill/knowledge-base/scripts/cos-upload.cjs --file "file" --secret-id "..." --secret-key "..." --token "..." --bucket "..." --region "..." --cos-key "..." --content-type "application/pdf" // Step 4: add_knowledge ``` ### Technical Analysis The documented COS upload workflow instructs users or agents to provide the COS secret ID, secret key, and temporary token directly as command-line arguments. Although the shown values are placeholders rather than embedded credentials, following this pattern with real credentials can expose them through: - Process inspection utilities and system process telemetry - Shell command history - Terminal session recording - CI/CD job output and diagnostic logs - Agent tool-call records or command auditing systems Command-line arguments are generally unsuitable for secrets because they may be readable by other local processes or retained after the upload completes. Exploitation requires access to process metadata, command history, or logs containing the executed command. ### Attack Path 1. A user or agent follows the documented Method B workflow. 2. Valid COS credentials are substituted for `--secret-id`, `--secret-key`, and `--token`. 3. The upload command executes with those credentials present in its argument vector. 4. A local user, monitoring component, logging service, or other party with access to process details, shell history, or execution logs captures the arguments. 5. The exposed credentials are reused against COS before they expire or are revoked. 6. The attacker performs operations permitted by the credentials and their associated cloud policy. ### Impact Assessment Successful exploitation may disclose active cloud credentials. The resulting privileges are limited to those granted to the expos ...[truncated 402 chars]
- Remediation
- ## Remediation Suggestions - Remove secret-bearing command-line options from the documented workflow. - Have `cos-upload.cjs` read credentials from protected environment variables, standard input, or a permission-restricted credential file. - Prefer a cloud credential provider chain or workload identity mechanism that supplies short-lived, least-privilege credentials without exposing them in commands. - If environment variables are used, ensure commands and environment dumps are not logged and that child-process inheritance is restricted where practical. - Prevent the script from printing secrets in errors, debug output, or stack traces. - Configure CI/CD and agent execution systems to redact credential values and disable shell tracing around authentication operations. - Grant the upload identity access only to the required bucket, object prefix, and operations. - Use short-lived credentials and rotate or revoke any credential passed through command-line arguments. - Document secure credential setup separately from the upload invocation, for example: ```bash read -s COS_SECRET_KEY export COS_SECRET_KEY node skills/ima-skill/knowledge-base/scripts/cos-upload.cjs \ --file "file" \ --bucket "bucket" \ --region "region" \ --cos-key "object-key" \ --content-type "application/pdf" unset COS_SECRET_KEY ``` The implementation should retrieve the secret from the protected input or environment rather than accepting it as an argument.
