T09 · Insecure Skill Coding Practices
- Location
SKILL.md:55- Finding
API Credential Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:55-59
Vulnerability Type: API credential exposure through process arguments
Risk Level: MediumThe documented usage instructs users to expand the MiniMax API key directly into a command-line argument:
bash python3 scripts/minimax_image_create.py \ --api-key $MINIMAX_API_KEY \ --model image-01 \ --prompt "一只可爱的橘猫" \ --aspect-ratio 16:9The script explicitly supports receiving the credential through that argument at
scripts/minimax_image_create.py:232-237:python parser.add_argument( "--api-key", type=str, default=os.environ.get("MINIMAX_API_KEY"), help="MiniMax API Key (或设置环境变量 MINIMAX_API_KEY)" )Technical Analysis
When the documented command is executed, the shell expands
$MINIMAX_API_KEYbefore starting Python. The resulting secret can therefore appear in the process argument vector. Depending on operating-system configuration and local monitoring controls, command-line arguments may be observable through process inspection utilities,/procinterfaces, audit systems, crash diagnostics, or endpoint telemetry.Sending the API key to
https://api.minimaxi.com/v1/image_generationas a Bearer token is necessary for the declared image-generation functionality. The vulnerability is not the authenticated network request itself; it is the unnecessary command-line exposure before the credential reaches the API client. The implementation already supports loading the credential fromMINIMAX_API_KEY, so passing it as an argument is not required.Attack Path
- A user exports a valid MiniMax API key and follows the documented command.
- The shell expands
$MINIMAX_API_KEYinto the Python process argument list. - A malicious or compromised local process, process-monitoring service, or telemetry collector records the argument list while the command is running.
- The attacker extracts the Bear ...[truncated 727 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
--api-key $MINIMAX_API_KEYfrom every command example. Document invocation without the credential argument:bash export MINIMAX_API_KEY="your-api-key" python3 scripts/minimax_image_create.py \ --model image-01 \ --prompt "a requested image" \ --aspect-ratio 16:9 - Prefer removing the
--api-keyoption entirely and accept the secret only throughMINIMAX_API_KEYor a protected secret-management integration. - If an explicit input mechanism is required, read the credential from protected standard input without echoing it rather than placing it in the argument vector.
- Ensure errors and diagnostic logging never include request headers or the complete API key.
- Advise users who previously used the documented argument form to review process telemetry exposure and rotate potentially disclosed keys.
- Remove
