T09 · Insecure Skill Coding Practices
- Location
scripts/gemini_video_url_analyzer.py:28- Finding
Gemini API Key Exposure Through Command-Line Arguments
- Content
View full analysis
str: api_key = cli_api_key or os.getenv("MAVERICK_GEMINI_API_KEY") or os.getenv("MAVERICK_GOOGLE_API_KEY") if not api_key: ``` ### Technical Analysis The analyzer permits users to provide a Gemini API key through the `--api-key` command-line option. Command-line arguments are commonly visible in shell history, process inspection interfaces, process-monitoring products, diagnostic reports, and automation logs. Although the script also supports environment variables, the availability of the command-line option creates an avoidable secret-disclosure path. Exploitation requires the victim to invoke the script with `--api-key` and the attacker to have access to command history, process metadata, or logs containing the invocation. ### Attack Path 1. A user runs the analyzer with `--api-key `. 2. The command is saved in shell history, captured by an automation log, or temporarily exposed through the operating system's process-listing interface. 3. A local user, monitoring service, log reader, or compromised process obtains the command-line value. 4. The exposed credential is reused to authenticate to the Gemini API. 5. The attacker submits unauthorized requests until the credential is revoked or its quota is exhausted. ### Impact Assessment An attacker who obtains the key can act within the permissions and quota assigned to that Gemini API credential. Potential effects include unauthorized API consumption, quota exhaustion, financial charges, and activity attributed to the legitimate credential ...[truncated 179 chars]- Remediation
View remediation
