T09 · Insecure Skill Coding Practices
- Location
scripts/reverse_prompt_file.py:26- Finding
API Key Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/reverse_prompt_file.py, lines 26 and 32
Vulnerability Type: Credential exposure through process arguments and shell history
Risk Level: MediumVulnerable Code
python parser.add_argument("--api-key", help="NanoPhoto API key. Defaults to NANOPHOTO_API_KEY env var.")python api_key = args.api_key or __import__("os").environ.get("NANOPHOTO_API_KEY")Technical Analysis
The upload helper accepts the NanoPhoto API key through the
--api-keycommand-line option. Secrets passed as command-line arguments can be exposed through shell history, process inspection, endpoint telemetry, audit logs, or diagnostic tooling.Although the Skill documentation recommends secure environment-variable configuration, the executable interface explicitly supports this less secure credential-delivery method. An attacker still requires access to process information, command history, or collected telemetry; this is not a remote credential disclosure by itself.
The credential is legitimately needed to authenticate with the fixed NanoPhoto HTTPS endpoint. The vulnerability concerns how it may be supplied locally, not its authorized transmission in the
Authorizationheader.Attack Path
-
A user invokes the helper with a command such as:
bash python3 scripts/reverse_prompt_file.py video.mp4 --api-key SECRET_VALUE -
The command and API key are retained in shell history, exposed temporarily through the process argument vector, or captured by local monitoring and telemetry.
-
An attacker with access to that information retrieves the API key.
-
The attacker uses the key to authenticate unauthorized requests to the NanoPhoto API.
Impact Assessment
Successful exploitation may allow unauthorized use of the victim's NanoPhoto service identity, consumption of account credits, and API activity attributed to the victim. This issue does not grant operating-system privilege escalatio ...[truncated 377 chars]
-
- Remediation
View remediation
Remediation Suggestions
- Remove the
--api-keycommand-line option and requireNANOPHOTO_API_KEYto be supplied through the platform's protected Skill configuration or another secret-management mechanism. - If interactive credential entry is required, use
getpass.getpass()so the key is not echoed or included in the process argument vector. - Update help text and documentation to prohibit placing credentials directly in commands.
- Ensure application and infrastructure logs redact the
Authorizationheader and any API-key values. - Advise users who previously passed keys through
--api-keyto clear affected shell history where appropriate and rotate potentially exposed credentials.
- Remove the
