T09 · Insecure Skill Coding Practices
- Location
scripts/enterprise_abnormal.py:281- Finding
API Key Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/enterprise_abnormal.py:281-283
Additional Location:SKILL.md:33
Vulnerability Type: API credential exposure through process arguments and shell history
Risk Level: MediumVulnerable Code
python if args[i] == "--key" and i + 1 < len(args): cli_key = args[i + 1] i += 2The documentation explicitly promotes this credential-passing mechanism:
bash python scripts/enterprise_abnormal.py --key YOUR_APP_KEY --name ENTERPRISE_NAMETechnical Analysis
The Skill accepts the Juhe API credential directly through the
--keycommand-line argument. Command-line arguments are not an appropriate secret-transport mechanism because they may be exposed through:- Shell history files.
- Process inspection tools while the command is running.
- Process accounting and endpoint-monitoring systems.
- Terminal session recordings.
- CI/CD, orchestration, or automation logs that record invoked commands.
- Diagnostic output that captures process arguments.
The network transmission itself is consistent with the declared functionality: the key and requested enterprise identifier are sent over HTTPS to the documented Juhe endpoint. The security issue is the optional local credential-ingestion method, not the required API request.
Attack Path
- A user follows the documented example and invokes the script with
--key. - The API key becomes part of the process command line and may also be stored in shell history or automation logs.
- A local user, monitoring service, log reader, or other party with access to those records obtains the key.
- The party submits requests directly to the Juhe API using the compromised credential.
- The unauthorized requests consume the victim's paid quota and are attributed to the victim's Juhe account.
Exploitation requires access to process metadata, command history, terminal recordings ...[truncated 932 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove support for the
--keycommand-line option and remove all examples that place credentials in command arguments. - Continue supporting the dedicated
JUHE_ENTERPRISE_ABNORMAL_KEYenvironment variable, while ensuring deployment systems inject it through protected secret-management facilities rather than logging it. - For interactive use, accept the key through a hidden prompt such as Python's
getpass.getpass()so that it is not echoed or recorded in shell history. - Prefer an operating-system credential store or managed secret service for long-lived installations.
- If
.envsupport remains available:- Add
scripts/.envand equivalent secret files to.gitignore. - Validate that the file is not committed to source control.
- Require restrictive permissions, such as owner read/write only.
- Warn or refuse to load the file when permissions allow access by other users.
- Add
- Update
SKILL.mdto describe only protected credential-delivery mechanisms. - Rotate any API key previously passed through command-line arguments if shell histories, logs, or process-monitoring records may have captured it.
- Remove support for the
