Skip to content
Info disclosure Write-up Beginner

Zero Infra Cloud Exploitation Hijacking Googles Gemini Via Public Api Keys

Google API keys that were designed to be public for Maps and Firebase silently gained access to Gemini AI endpoints when the Generative Language API was enabled in a project. An attacker could copy such a key from public source code and use it to query Gemini, potentially causing financial loss, data theft, or service disruption.

Sohan Kanna Follow

Published on infosecwriteups.com

If I asked you right now where you store your API keys, your first answer would probably be: “Securely in environment variables, obviously.”

Sohan Kanna, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely insecure defaults: new API keys are unrestricted by default and the same key format is used for both public identification and sensitive authentication, so enabling a new API silently grants existing public keys access to it.

Impact

Attackers could run up large bills, download private files uploaded to Gemini, or exhaust quotas to disrupt services; the text does not mention any defence that limited the exploit.

What the attacker needed

Generative Language API enabled in a GCP project; An unrestricted API key present in public code; No authentication beyond the API key

The fix

Google has acknowledged the issue and is working on a roadmap to fix it, planning to enforce scoped defaults for new keys and block leaked keys; developers should also audit, restrict, and rotate exposed keys.

How it was found

  1. Visit a public website and view its page source to find an API key.
  2. Copy the key and run a terminal command to query the Gemini files endpoint.
  3. Observe a 200 OK response instead of being blocked.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

An API key is like a password that lets software talk to a service. Google told developers it was safe to put certain keys in public website code because they were only used for billing, not for secret access. But when a new AI service was turned on, those same public keys suddenly allowed anyone to use the AI, which could cost the owner money or expose private data.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by Sohan Kanna

View all

9 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.