News for hackers. Stuff that matters.
Re:Billion-record stolen Chinese database for sale on breach... by bilekas on Tuesday July 05, 2022 @08:42AM (#31987519)
It's incredibly disappointing actually how often this happens.

I can't count the amount of SO questions I've had to edit from others posting live API Keys for everything from custom services to AWS.

Re:Billion-record stolen Chinese database for sale on breach... by TecoAndJix on Tuesday July 05, 2022 @03:56PM (#31992916)
I wonder if you could make a luhn-like check that would require an additional approval step to post if it comes back positive. Something like "It looks like you may be posting a secret *****. Do you wish to continue?
Re:Billion-record stolen Chinese database for sale on breach... by jewel on Tuesday July 05, 2022 @04:36PM (#31993371)
If vendors agreed to a common prefix on all secret key values then it'd be easy for everyone to add checks, to everything. Something like "_SECRET88_".

Of course, then your secret key checker would need to build that string by concatenating so that it wouldn't set off itself.

Re:Billion-record stolen Chinese database for sale on breach... by zricethezav on Tuesday July 05, 2022 @04:55PM (#31993575)
More and more providers have been adding unique prefixes to their tokens and access keys which makes detection much easier. Ex, GitLab adds `glpat-` to their PAT.

A project I maintain, Gitleaks, can easily detect "unique" secrets and does a pretty good job at detecting "generic" secrets too. In this case, the generic gitleaks rule would have caught the secrets [1]. You can see the full rule definition here [2] and how the rule is constructed here [3].

[1] https://regex101.com/r/CLg9TK/1

[2] https://github.com/zricethezav/gitleaks/blob/master/config/g...

[3] https://github.com/zricethezav/gitleaks/blob/master/cmd/gene...

Re:Billion-record stolen Chinese database for sale on breach... by remram on Tuesday July 05, 2022 @10:55PM (#31996200)
RFC 8959 registered the 'secret-token:' prefix / URI scheme.

https://www.rfc-editor.org/rfc/rfc8959.html

Re:Billion-record stolen Chinese database for sale on breach... by pitched on Tuesday July 05, 2022 @04:58PM (#31993607)
How about scanning for any string with high entropy? Might be easier to get buy-in if we don’t all have to bike-shed over what the prefix is.
Re:Billion-record stolen Chinese database for sale on breach... by CoffeeOnWrite on Tuesday July 05, 2022 @06:17PM (#31994454)
That’s helpful but the token prefixes are also helpful. You might be interested in GitHub’s reasoning at https://github.blog/2021-04-05-behind-githubs-new-authentica...
Re:Billion-record stolen Chinese database for sale on breach... by segudev on Wednesday July 06, 2022 @11:40AM (#32002572)
Unfortunately, it's not as simple as that. Lots of secrets are "generic" (think of a DB user/password combination), meaning that you need to take into account the surrounding source code context to be able to determine if they are a "real" secret.

Here is a full explanation if you are interested: https://blog.gitguardian.com/why-detecting-generic-credentia...

Re:Billion-record stolen Chinese database for sale on breach... by bilekas on Tuesday July 05, 2022 @04:09PM (#31993064)
I was thinking about that too, but it's actually tricky, even the example given, they use the var `accessId` but you could filter for all that, even the standard ones, but you couldn't have enough confidence in it so that if someone did post with a typo or even a random var name, they would think "Okay, no warning so must be okay".

Something like giving false confidence to the user. Not the best idea.

Re:Billion-record stolen Chinese database for sale on breach... by segudev on Wednesday July 06, 2022 @11:33AM (#32002475)
Indeed, last year we detected on average 84 AWS IAM creds for every 10k commits pushed to GitHub

https://res.cloudinary.com/da8kiytlc/image/upload/v164614852...

Re:Billion-record stolen Chinese database for sale on breach... by swimfar on Tuesday July 05, 2022 @09:25AM (#31987938)
When you do this is there a way to completely get rid of the information? Usually you can go back an look at the edit history to see the original post.
Re:Billion-record stolen Chinese database for sale on breach... by capableweb on Tuesday July 05, 2022 @02:44PM (#31992112)
Wouldn't matter. Tons of bots are scraping every inch of the internet all the time, and if something been online for five seconds, it has been cached/stored somewhere. Always assume that anything you've put up on the internet, can forever be accessed by someone.

The only thing you can do is rotating the token/secret.

Re:Billion-record stolen Chinese database for sale on breach... by teddyh on Tuesday July 05, 2022 @04:11PM (#31993073)
Re:Billion-record stolen Chinese database for sale on breach... by bilekas on Tuesday July 05, 2022 @10:25AM (#31988543)
Yeah mods can clear the review history - for this very reason!

But as mentioned below - Still advised to change your keys for obvious reasons

Re:Billion-record stolen Chinese database for sale on breach... by aembleton on Tuesday July 05, 2022 @10:22AM (#31988499)
Change the keys.