T09 · Insecure Skill Coding Practices
- Location
scripts/generate_auth_token.py:36- Finding
Application Secret Exposure Through Command-Line Arguments and Reversible Token Output
- Content
View full analysis
Vulnerability Details
File Locations:
scripts/generate_auth_token.py:36-42scripts/tomoviee_redrawing_client.py:137-140SKILL.md:36-38
Vulnerability Type: Sensitive credential exposure through process arguments and standard output
Risk Level: MediumVulnerable 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_SECRETTechnical 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-32is not independently malicious: it constructs the documented HTTP Basic credential in memory and sends it over HTTPS only toopenapi.wondershare.cc. The vulnerability arises from accepting secrets through process-visible arguments and explicitly printing the reusable credential in the standalone helper.Attack Path
- A user follows the authentication command documented in
SKILL.md. - The application secret is placed in the command ...[truncated 1224 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not accept application secrets as positional command-line arguments.
- Read the secret from a protected secret manager, a narrowly scoped environment variable, or an interactive non-echoing prompt such as
getpass.getpass(). - Do not print the Base64 credential or any reusable Authorization value to standard output.
- Construct the Authorization header only in memory immediately before making the request.
- Update
SKILL.mdto document a secure credential-loading workflow rather than embedding secrets in commands. - Ensure application logs, exceptions, Agent transcripts, and debugging output redact Authorization headers, application secrets, and encoded credentials.
- Configure CI/CD systems to use masked secret variables and prevent command echoing.
- Rotate any application credentials that may previously have appeared in process arguments, shell history, logs, or Agent output.
- Where supported by the provider, replace long-lived Basic credentials with short-lived, scoped access tokens.
