T09 · Insecure Skill Coding Practices
- Location
references/shared/cross_model_verification.md:455- Finding
Google API Key Exposed in Process Arguments
- Content
View full analysis
Vulnerability Details
File Location:
references/shared/cross_model_verification.md:455-457
Vulnerability Type: API credential exposure through command-line arguments
Risk Level: MediumVulnerable Code
bash resp="$(curl -sS -w '\n%{http_code}' \ "https://generativelanguage.googleapis.com/v1beta/models/${ARS_CROSS_MODEL}:generateContent?key=$GOOGLE_AI_API_KEY" \ -H "Content-Type: application/json" \ -d "$(jq -n --arg prompt "$PROMPT" '{Technical Analysis
The documented Gemini transport places
GOOGLE_AI_API_KEYdirectly in the request URL passed tocurl. Consequently, the complete credential-bearing URL may be visible in the process command line while the request is running.Depending on the operating system and runtime configuration, process arguments may be accessible through process-listing tools, process inspection interfaces, monitoring agents, audit logs, crash diagnostics, shell tracing, or command telemetry. URLs may also be recorded by HTTP proxies and diagnostic infrastructure.
The request uses HTTPS and targets Google's documented API host, so the reviewed behavior does not demonstrate deliberate credential exfiltration. The vulnerability is the unnecessary exposure of a secret through observable command metadata.
Attack Path
- A user configures
GOOGLE_AI_API_KEYand enables Gemini cross-model verification. - The runtime executes the documented
curlcommand. - The shell expands the API key into the URL before starting
curl. - A local user, process monitor, telemetry collector, or logging component captures the command-line arguments or full request URL.
- The observer extracts the API key and reuses it against enabled APIs associated with the Google project.
Exploitation requires access to a process-observation or logging surface during execution. The Skill itself does not establish such access.
Impact Assessment
A captured key may permit unauthorized API requests within the restri ...[truncated 532 chars]
- A user configures
- Remediation
View remediation
Remediation Suggestions
-
Keep credentials out of URLs and process arguments. Prefer a provider-supported authorization header or an official SDK whose credential handling does not place secrets in command-line arguments.
-
Use a protected configuration file when header authentication is unavailable. For example, generate a temporary
curlconfiguration file with mode0600, executecurl --config <file>, and securely remove the file immediately afterward. Ensure the temporary directory is private and resistant to symlink attacks. -
Avoid shell tracing around credential-bearing operations. Disable
set -xand ensure command telemetry does not capture expanded secrets. -
Restrict the Google API key. Apply API restrictions, quota limits, billing alerts, and any available application or source restrictions. Use a dedicated key for this Skill rather than a credential shared with unrelated services.
-
Document residual provider constraints. If Google requires query-parameter authentication for this endpoint, explicitly warn users that the URL contains a secret and may appear in process or proxy logs.
-
Rotate potentially exposed credentials. Users who have executed this pattern in environments with process monitoring, shell tracing, or URL logging should revoke and replace the key.
-
