Google API Key Misconfigurations Lead to Silent Data Exposure via Gemini

Security researchers at Truffle Security have uncovered a critical flaw in Google’s API key system. Legacy public-facing Google API keys can quietly access sensitive Gemini AI endpoints without developer warnings. This exposes private files, cached data, and billable AI usage to attackers.

The Hidden Upgrade Risk

For years, Google advised developers to embed API keys in client-side code for services like Google Maps and Calendar.

These keys acted as harmless project identifiers for billing, safe to expose publicly. But enabling the Generative Language API on an existing project silently upgrades these keys into powerful credentials.

thousands of API keys that were deployed as benign billing tokens are now live Gemini credentials sitting on the public internet. ( Source: Truffle Security)
thousands of API keys that were deployed as benign billing tokens are now live Gemini credentials sitting on the public internet. ( Source: Truffle Security)

Truffle Security reports thousands of such keys now linger on the public internet as live Gemini access tokens. The root cause? Google’s insecure defaults.

New API keys start “unrestricted,” granting access to every enabled API in the project. With no separation between public billing IDs and secret auth tokens, privilege escalation is inevitable.

Simple Exploitation Path

Attackers scrape public GitHub repos or websites for exposed keys common in front-end code. They then send direct requests to Gemini endpoints. No alerts trigger.

Results? Attackers steal private datasets, read cached contexts, and run costly AI queries, racking up bills in thousands of dollars.

Example Google API key in front-end source code used for Google Maps, but also can access Gemini ( Source: Truffle Security)
Example Google API key in front-end source code used for Google Maps, but also can access Gemini ( Source: Truffle Security)

Truffle’s research shows even Google’s own keys were vulnerable until recent fixes.

FeatureLegacy Public API KeysUpgraded Gemini Keys
Primary PurposePublic project ID and billingSensitive auth and data access
Deployment LocationClient-side HTML/JSSecure backends only
Exposure RiskLow; harmless if leakedHigh; leaks private AI data
Default ConfigUnrestricted across project APIsUnrestricted; needs manual limits

Google now defaults new AI Studio keys to Gemini-only access and blocks known leaked credentials. But legacy projects remain at risk.

  • Audit Google Cloud dashboards for Generative Language API enablement.
  • Scan for unrestricted public keys using tools like TruffleHog.
  • Rotate all client-side keys immediately.
  • Enforce key scoping and service accounts for AI APIs.
  • Integrate code scanners in CI/CD to detect exposures.

This flaw underscores the perils of layering AI on outdated cloud designs. Developers must treat all API keys as secrets now. Organizations ignoring audits face data theft and surprise costs.

Follow us on Google News, LinkedIn and X to Get More Instant Updates. Set Cyberpress as a Preferred Source in Google

AnuPriya
AnuPriya
Any Priya is a cybersecurity reporter at Cyber Press, specializing in cyber attacks, dark web monitoring, data breaches, vulnerabilities, and malware. She delivers in-depth analysis on emerging threats and digital security trends.

Trending News

Related Stories