Google API Keys Gain Unauthorized Gemini Access When Service Enabled
Publicly visible Google Cloud API keys, long considered non-sensitive, reportedly gained unauthorized access to Gemini AI endpoints when the generative AI service was enabled on the same cloud project. Security researchers estimate nearly 3,000 such keys are active across websites and public code repositories, potentially exposing private files, cached data, and enabling attackers to incur unauthorized billing costs.
What happened
For over a decade, Google instructed developers to embed API keys directly into client-side HTML and JavaScript for services like Maps and Firebase, stating that API keys were not secrets.
When the Gemini API is enabled on a Google Cloud project, every existing API key in that project automatically gains access to Gemini endpoints with no warning, confirmation dialog, or email notification to the developer.
Security researchers at Truffle Security identified that a key deployed for a Maps service years prior can immediately become a credential capable of accessing Gemini endpoints once the AI service is enabled on the same project.
Reported impact
Nearly 3,000 publicly visible API keys are estimated to be active across websites and public code repositories, including those linked to financial institutions, technology firms, and recruitment platforms.
Attackers can extract exposed API keys from webpage source code and use them to access private files, cached data, and billable inference services through Gemini endpoints, generating unauthorized charges and potentially disrupting services dependent on shared cloud resources.
Index analysis
The vulnerability roots lie in CWE-1188 (Insecure Default Initialization) and CWE-269 (Incorrect Privilege Assignment), where API keys are set to 'Unrestricted' by default, allowing access to every enabled API in the project from creation.
Researchers note that the privilege escalation occurs through the order of events: a developer follows Google's guidelines by placing a Maps key in public JavaScript, then another team member activates the Gemini API on the same project, causing the public key to silently inherit sensitive access.
Governance controls
Google has begun blocking leaked keys from accessing Gemini, tightening default restrictions, and planning user notifications.
However, legacy deployments, especially mobile apps and long-running web services, remain difficult to update immediately.
Classification
Sources and evidence
This record was researched and written by the Index, based on the following original reporting.