logoalt Hacker News

Google API keys weren't secrets, but then Gemini changed the rules

748 pointsby hiisthisthingonyesterday at 7:54 PM151 commentsview on HN

Comments

qudenttoday at 7:16 AM

In Google AI Studio, Google documentation encourages to deploy vibecoded apps with an open proxy that allow equivalent AI billing abuse - giving the impression that the API key were secure because it is behind a proxy. Even an app with 0 AI features exposes dollars-per-query video models unless the key is manually scoped. Vulnerable apps (all apps deployed from AI Studio) are easily found by searching Google, Twitter or Hacker News. https://github.com/qudent/qudent.github.io/blob/master/_post...

show 1 reply
devsdatoday at 4:13 AM

> Leaked key blocking. They are defaulting to blocking API keys that are discovered as leaked and used with the Gemini API.

There are no "leaked" keys if google hasn't been calling them a secret.

They should ideally prevent all keys created before Gemini from accessing Gemini. It would be funny(though not surprising) if their leaked key "discovery" has false positives and starts blocking keys from Gemini.

show 1 reply
oomptytoday at 5:10 AM

Ohh so that's how that happened. I had noticed (purely for research purposes of course) that some of Google's own keys hardcoded into older Android images were useable for Gemini (some instantly ratelimited so presumably used by many other people already but some still usable) until they all got disabled as leaked like two months ago. They also had over time disabled Gemini API access on some of them over them beforehand.

warmedcookietoday at 4:10 AM

What's frustrating is that a lot of these keys were generated a long time ago with a small amount of GCP services that they could connect to. (Ex. Firebase remote config, firestore, etc.)

When Gemini came around, rather than that service being disabled by default for those keys, Gemini was enabled, allowing exploiters to easily utilize these keys (Ex. a "public" key stored in an APK file)

show 1 reply
Havoctoday at 8:56 AM

Someone on the Google subreddit did report getting a 80k bill yesterday from a Gemini key.

I’m very careful with Google and co since they’re so intent on infinite scaling access to your wallet

lastdongtoday at 9:03 AM

This is mind-blowing, and it defies all security common sense. Changing global API keys permissions? Come on! We’re accustomed to seeing issues like this from Redmond but didn’t expect it from Google.

show 2 replies
louison11today at 4:41 AM

This seems so… obvious? How can a company of this size, with its talent and expertise, not have standardized tests or specs preventing such a blatant flaw?

show 6 replies
827atoday at 4:22 AM

Is the implication at the end that Google has not actually fixed this issue yet? This is really bad; a massive oversight, very clearly caused by a rush to get Gemini in customers' hands, and the remediation is in all likelihood going to nuke customer workflows by forcing them to disable keys. Extremely bad look for Google.

vincnetastoday at 7:41 AM

This totally reminds me of SSN use, when initially they were just a number (not secret) to identify a person, and then suddenly people started to use them as a key for authorisation, because someone had a bright idea how to implement things fast/simple/cheap (cheap part comes at expense of others)

show 2 replies
bob1029today at 11:12 AM

What are the chances this isn't intentional to some extent? This wouldn't be the first time we've traded downstream legal trouble for short term gains.

Making AI utilization appear to go up is the only thing that matters right now if you're in the boardroom at one of these companies. Whether or not that utilization was actually intended by the customer is entirely irrelevant. From here, the only remaining concern is mitigating legal issues which google seems to be immune to.

show 1 reply
voidUpdatetoday at 8:40 AM

> This makes sense. These keys were designed as project identifiers for billing, and can be further restricted with (bypassable) controls like HTTP referer allow-listing. They were not designed as authentication credentials.

Can't you just run up a huge bill for a developer by spamming requests with their key? I don't see how this wasn't always an issue?

show 2 replies
klooneytoday at 5:21 AM

> Retroactive Privilege Expansion. You created a Maps key three years ago and embedded it in your website's source code, exactly as Google instructed. Last month, a developer on your team enabled the Gemini API for an internal prototype. Your public Maps key is now a Gemini credential. Anyone who scrapes it can access your uploaded files, cached content, and rack up your AI bill. Nobody told you.

Malpractice/I can't believe they're just rolling forward

show 2 replies
jacquesmtoday at 11:11 AM

Who knew there were downsides to forcefeeding your product to an unwilling audience?

This whole Gemini roll-out has me reminded of the Google '+' days when they thought they were going to die if they didn't do social.

ZiiStoday at 10:06 AM

Unrestricted API keys were always secrets. They are created on a page called "Keys & Credentials". The fact that Google even allows unrestricted keys to be created has been a long standing security problem. The fact their docs encouraged it remains unforgivable.

show 1 reply
evotoday at 4:38 AM

Can’t wait til someone makes a Gemini prompt to find these public keys and launch a copy of itself using them.

vessenestoday at 5:24 AM

Woof. Impedance mismatch outcome from moving fast - the GCP auth model was never designed to work like oAI's API key model; this isn't the only pain point this year, but it's a nasty one. I'm sympathetic, except that dealing with GCP has always been a huge pain in the ass. So I'm a little less sympathetic.

nkrisctoday at 7:54 AM

So even if they fix the issue, it sounds as though you can still shoot itself in the foot by essentially being at to arbitrarily change an existing key from “not a secret” to “is a secret”?

Even if you have a key that you use for maps (not secret) someone could add the generative AI scope to it and make it now necessarily secret (even though it’s probably already publicly available)?

yellow_leadtoday at 7:33 AM

This firm is doing great work, I still refer to this post ("Anyone can Access Deleted and Private Repository Data on GitHub"): https://trufflesecurity.com/blog/anyone-can-access-deleted-a...

Humphreytoday at 5:58 AM

Seems like the kind of bug caused by using Gemini to vibe code the GCP.

show 1 reply
locallosttoday at 6:09 AM

Happened to me recently, I got a warning in Gemini Studio that a key leaked. I was perplexed initially and then realized what had happened. The proper fix is to limit the key to just Maps APIs. Of course even this is not so easy, as there's a long list of APIs with complicated names. It was at least limited to my domain.

gverrillatoday at 9:24 AM

Thousands of engineers. Culture rot.

sandrellotoday at 9:25 AM

Since I've never used them, how could API keys for Firebase or Maps be safe for embedding in client side code?

I mean, I get that authentication to the service is performed via other means, but what's the use of the key then?

I'm guessing it's just a matter of binding service invocations to the GCP Project to be billed, by first making sure that the authenticated principal has rights on that project, in order to protect from exfiltration. That would still be a strange use case for what gets called an "API key".

lukeiodevtoday at 7:59 AM

The key didn’t change. What changed is what it can do.

What used to be a simple project identifier can now trigger expensive API calls once Gemini is enabled.

Since nothing in the old code changes, there’s no obvious moment where someone stops and re-evaluates the risk.

show 1 reply
011101101today at 7:10 AM

Separating & importing keys for gpg in --quick-generate-keys prior to git clone in SSH.

Cargo fuzzing the API over local address server yielding r-w-x permissions.

phantomathkgtoday at 4:48 AM

> 2,863 Live Keys on the Public Internet

It will be more interesting if they scan GitHub code instead. The number terrified me. Though I am not sure how many of that are live.

show 1 reply
the_aruntoday at 4:15 AM

Private data should not be allowed to be accessed using public keys. That is the core problem. It is not about Google API keys are secret or not.

show 1 reply
selridgetoday at 2:39 AM

Great write-up. Hilarious situation where no one (except unwieldiness) is the villain.

dakollitoday at 5:44 AM

Dang, another obvious reason (among many others) you shouldn't be uploading documents to any LLM client (or use them on anything important).

micksmixtoday at 6:25 AM

[dead]

wangzhongwangtoday at 5:59 AM

[dead]

bpodgurskytoday at 4:05 AM

ChatGPT writing a blog post attacking Gemini security flaws. It's their world now, we're just watching how it plays out.

show 2 replies
habosatoday at 4:17 AM

This is true but also not as new as the author claims. There have been various ways to abuse Google API keys in the past (at least to abuse them financially) and it’s always been very confusing for developers.

friendzistoday at 7:49 AM

Explain It Like I'm Five.

From TFA:

> Last month, a developer on your team enabled the Gemini API for an internal prototype. > The result: thousands of API keys that were deployed as benign billing tokens are now live Gemini credentials sitting on the public internet.

Benign, deployed openly without any access restrictions whatsoever, billing tokens can be used to bill for a service under the account it is enabled for. That's the intended behavior, literally. Maps API keys are used to give your users access to Google Maps on your credit card.

What's the problem here? Yes, the defaults could have been stricter, but it's not like it costs anything to create a bunch of internal projects that do not have good-for-billing access keys floating around open internet. People moved fast, deployed LLM generated code, broke things and then blame everyone else but themselves?

show 2 replies