T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/run.py:187
- Finding
- API Credential Exposure Through Command-Line Arguments## Vulnerability Details **File Location**: `scripts/run.py:187` **Additional Documentation Location**: `SKILL.md:81`, `SKILL.md:143` **Vulnerability Type**: Insecure credential handling **Risk Level**: Medium ### Vulnerable Code ```python parser.add_argument("--appkey", required=True, help="内部医疗大模型鉴权key(必填)") ``` The documented invocation also instructs users to place the credential directly in the command: ```bash python3 scripts/run.py --input input.json --output output.json --appkey YOUR_KEY ``` ### Technical Analysis The application requires the bearer credential to be supplied as a command-line argument. Command-line arguments may be exposed through: - Operating-system process listings such as `ps`. - Shell history files. - Process monitoring and observability systems. - CI/CD job logs. - Container or workload metadata. - Diagnostic reports that capture process arguments. HTTPS protects the credential while it is transmitted to the API, but it does not mitigate disclosure through local process metadata or command history. ### Attack Path 1. A user follows the documented invocation and passes a valid credential using `--appkey`. 2. The shell records the command in its history, or the operating system exposes it in the process argument list while the program is running. 3. A local user, administrator, monitoring service, or party with access to execution logs reads the argument. 4. The party extracts the credential and submits unauthorized requests to the medical-model API. ### Impact Assessment Exploitation does not directly grant operating-system privileges. It can grant access equivalent to the compromised API credential, including unauthorized consumption of API quota, submission of model requests, and access to any capabilities associated with that credential. The impact is limited by the permissions, expiration, rate limits, and billing scope assigned to the exposed credential.
- Remediation
- ## Remediation Suggestions - Read the credential from a protected environment variable or operating-system secret store rather than a command-line argument. - Support secure standard-input entry, preferably without terminal echo, for interactive execution. - Integrate with the deployment platform's native secret-management mechanism. - Remove the credential-bearing command example from `SKILL.md`. - If `--appkey` must remain for backward compatibility, clearly mark it as deprecated and insecure. - Ensure application and orchestration logs redact authorization credentials. - Use short-lived, narrowly scoped credentials and provide a rotation procedure.
