T09 · Insecure Skill Coding Practices
- Location
- scripts/generate_auth_token.py:36
- Finding
- Application Secret Exposure Through Command-Line Arguments and Reversible Token Output## Vulnerability Details **File Locations**: - `scripts/generate_auth_token.py:36-42` - `scripts/tomoviee_redrawing_client.py:137-140` - `SKILL.md:36-38` **Vulnerability Type**: Sensitive credential exposure through process arguments and standard output **Risk Level**: Medium ### Vulnerable Code `scripts/generate_auth_token.py:36-42`: ```python app_key = sys.argv[1] app_secret = sys.argv[2] token = generate_access_token(app_key, app_secret) print(f"Access Token: {token}") print(f"\nUse in Authorization header as: Basic {token}") ``` `scripts/tomoviee_redrawing_client.py:137-140`: ```python app_key = sys.argv[1] app_secret = sys.argv[2] prompt = sys.argv[3] init_image = sys.argv[4] ``` `SKILL.md:36-38`: ```bash python scripts/generate_auth_token.py YOUR_APP_KEY YOUR_APP_SECRET ``` ### Technical Analysis The documented authentication workflow requires users to provide the application secret as a command-line argument. Command-line arguments may be retained in shell history and exposed through process listings, operating-system auditing, orchestration telemetry, debugging tools, or CI/CD logs. The token helper then prints `base64(app_key:app_secret)` to standard output. Base64 is a reversible encoding and provides no confidentiality. Anyone who obtains the printed token can decode it to recover both credential components or use it directly as an HTTP Basic Authorization value. The Base64 operation inside `scripts/tomoviee_redrawing_client.py:24-32` is not independently malicious: it constructs the documented HTTP Basic credential in memory and sends it over HTTPS only to `openapi.wondershare.cc`. The vulnerability arises from accepting secrets through process-visible arguments and explicitly printing the reusable credential in the standalone helper. ### Attack Path 1. A user follows the authentication command documented in `SKILL.md`. 2. The application secret is placed in the command ...[truncated 1224 chars]
- Remediation
- ## Remediation Suggestions 1. Do not accept application secrets as positional command-line arguments. 2. Read the secret from a protected secret manager, a narrowly scoped environment variable, or an interactive non-echoing prompt such as `getpass.getpass()`. 3. Do not print the Base64 credential or any reusable Authorization value to standard output. 4. Construct the Authorization header only in memory immediately before making the request. 5. Update `SKILL.md` to document a secure credential-loading workflow rather than embedding secrets in commands. 6. Ensure application logs, exceptions, Agent transcripts, and debugging output redact Authorization headers, application secrets, and encoded credentials. 7. Configure CI/CD systems to use masked secret variables and prevent command echoing. 8. Rotate any application credentials that may previously have appeared in process arguments, shell history, logs, or Agent output. 9. Where supported by the provider, replace long-lived Basic credentials with short-lived, scoped access tokens.
