News for hackers. Stuff that matters.
Re:Billion-record stolen Chinese database for sale on breach... by tpaksoy on Tuesday July 05, 2022 @08:16AM (#31987287)
Apparently there was a "blogpost" of a developer showing of their code, where they accidentally leaked access tokens in a piece of commented code: https://archive.ph/mP3bh

This is completely unverified though, so take it with a grain of salt.

Re:Billion-record stolen Chinese database for sale on breach... by zricethezav on Tuesday July 05, 2022 @04:30PM (#31993306)
Assuming this unverified version of the story is true, the danger of accidentally leaking credentials in code is enormous and one of the reasons I continue to maintain and develop gitleaks. Those credentials[1] would have been caught by the gitleaks' generic rule [2]

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

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

Re:Billion-record stolen Chinese database for sale on breach... by anitil on Tuesday July 05, 2022 @07:46PM (#31995142)
Fantastic tool. We all know that _we_ wouldn't leak keys, but we have all been the person to 'rm -rf /' or 'delete * from prod where 1=1;', so it's just a matter of time.

Is there a plugin that streamers could use to blur suspected keys on stream? Would that be something interesting to work on do you think? (I'm not a streamer but it sounds fun)

Re:Billion-record stolen Chinese database for sale on breach... by corobo on Wednesday July 06, 2022 @08:18AM (#31999746)
When I was looking into the streaming side of things I set up an overlay image which could be toggled with a hotkey to hide my screen (it actually also hid my desktop scene too in case the image didn't load or whatever)

My main precaution though was separating dev/prod and never looking at prod stuff online. Worst case someone could spin up some guff in my dev/test account until I can cycle the credentials

In my case the separation also included a different system user on my computer for stream work. Possibly overkill but why risk it when the costs are so low?

I can't see myself trusting a key blurring app if I'm honest. Rather fix the issue earlier in the process than rely on something that would probably break on edge cases (word wrap enabled? Here's the key but it's in two parts, that sort of thing)

Re:Billion-record stolen Chinese database for sale on breach... by anitil on Thursday July 07, 2022 @09:14PM (#32021832)
I agree I'd probably not trust it either, I'd be tempted to buy a completely seperate machine just out of paranoia
Re:Billion-record stolen Chinese database for sale on breach... by jazzyjackson on Wednesday July 06, 2022 @03:59AM (#31998051)
I think it would be a good tool to have, I had to contact a conference organizer once who switched tabs while sharing her screen in a recording and revealed a note in Google Keep that read "LastPass master password" xD
Re:Billion-record stolen Chinese database for sale on breach... by asdff on Tuesday July 05, 2022 @07:04PM (#31994822)
It doesn't help that so many tools are like "give me your secret key in plain text in the config file" without at least offering a link to a webpage on the github of how you could secure your keys and use this software
Re:Billion-record stolen Chinese database for sale on breach... by zricethezav on Tuesday July 05, 2022 @07:23PM (#31994968)
hardcoded creds in example documentation... T_T

Use vault, env vars, GitHub/GitLab secrets, anything but string literals!!!

Re:Billion-record stolen Chinese database for sale on breach... by maccard on Wednesday July 06, 2022 @03:47AM (#31997969)
Vault is not just a drop in and go system - setting up a vault instance is an ordeal in and of itself, and the pricing for vault on hashicorp cloud is incredibly expensive. The problem with the other options is that you have to get the secrets into environment variables, or out of github/lab secrets and into your application. To use most of the services like AWS secrets manager, vault, etc, it will cost you more to manage secrets than it will to host the app on a small DO droplet for example.
Re:Billion-record stolen Chinese database for sale on breach... by pinglin on Wednesday July 06, 2022 @06:27AM (#31998998)
Self-hosted Vault within a minimum Kubernetes cluster in GCP costs us roughly $35 a month. Maintenance effort can be neglected if not scaling. Vault has its learning curve there but I think it's totally worth it, given its secret management and API-first features integrated with many other DevOps tools.
Re:Billion-record stolen Chinese database for sale on breach... by maccard on Wednesday July 06, 2022 @08:23AM (#31999791)
$35/month is more than a small team will pay on source control.
Re:Billion-record stolen Chinese database for sale on breach... by danenania on Wednesday July 06, 2022 @04:00AM (#31998053)
If anyone’s looking for something more secure than vanilla env vars but simpler than Vault, you could check out EnvKey[1]. Disclaimer: I’m the founder.

It’s end-to-end encrypted, cloud or self-hosted, and very quick to integrate.

1 - https://envkey.com

Re:Billion-record stolen Chinese database for sale on breach... by trhway on Wednesday July 06, 2022 @12:47AM (#31996839)
It feels like just only yesterday secrets in env vars were considered faux pas :)
Re:Billion-record stolen Chinese database for sale on breach... by alias_neo on Tuesday July 05, 2022 @06:39PM (#31994624)
How were the words selected for the regex? It's interesting that "pass" is not there and breaks detection in your first link, but I assume they were chosen based on the statistics?

Is it covered by a different rule perhaps?

Re:Billion-record stolen Chinese database for sale on breach... by zricethezav on Tuesday July 05, 2022 @07:21PM (#31994955)
`pass` by itself might introduce false positives. `passwd` and `password` are common and more likely to be in the ROI of a secret. That said, I'm not opposed to `pass` by itself. I'll have to think about this one...

> but I assume they were chosen based on the statistics?

Nope, not statistics. Identifiers and keywords are chosen based on what I see out in the wild being a software engineer.

Re:Billion-record stolen Chinese database for sale on breach... by haasted on Tuesday July 05, 2022 @08:21AM (#31987332)
Re:Billion-record stolen Chinese database for sale on breach... by 72736379 on Tuesday July 05, 2022 @08:30AM (#31987409)
This is less a confirmation but more of a "piggybacking".
Re:Billion-record stolen Chinese database for sale on breach... by manuel4sk on Wednesday July 06, 2022 @04:16AM (#31998145)
I don't know this guy, but how can he confirm this? does he possess any inner information? why I got the feeling that he is so eager to put a conclusion on this when it is still open for debate at this stage.
Re:Billion-record stolen Chinese database for sale on breach... by haasted on Wednesday July 06, 2022 @04:40AM (#31998325)
Binance is the largest cryptocurrency trading platform globally.

According to this tweet [0] they have a "threat intelligence" department that continually monitors for potential issues. It makes sense that they would be on the lookout for leaks of this nature, as they are highly dependent on correctly verifying and identifying their customers.

[0] https://twitter.com/cz_binance/status/1543700689611792386

Re:Billion-record stolen Chinese database for sale on breach... by throwaway787544 on Tuesday July 05, 2022 @08:28AM (#31987391)
Starting today, this will be known as "Shanghai'd credentials" and be reason #1 why we use ephemeral credentials (e.g. AWS STS/SSO) rather than static credentials (e.g. IAM Users)
Re:Billion-record stolen Chinese database for sale on breach... by compumike on Tuesday July 05, 2022 @08:58AM (#31987661)
Doesn't the client still need to know a long-lived secret (or a long-lived refresh token) in order to generate the ephemeral credentials?
Re:Billion-record stolen Chinese database for sale on breach... by kbenson on Tuesday July 05, 2022 @03:31PM (#31992647)
One of the major benefits of ephemeral tokens is that they become less attractive to put into the code, and more attractive to put in a config file/vault that's easier to update and keep secret. This in itself is useful because it makes it less likely that it will be in some source file someone shows, or pushed to some remote repo that at some point has permissions allowed so people can see it.
Re:Billion-record stolen Chinese database for sale on breach... by steelaz on Tuesday July 05, 2022 @09:28AM (#31987977)
We got rid of all IAM users used by applications and moved to role-based access. Nowhere in the application do you need to enter AWS credentials. AWS SDK will attempt to discover short-lived credentials for you and will assume the role specified at the infrastructure layer, e.g. in a task definition.
Re:Billion-record stolen Chinese database for sale on breach... by LilBytes on Tuesday July 05, 2022 @08:47PM (#31995529)
same here, but we still have IAM Users for service accounts. E.g. some customers have on premise infra that needs to talk to our services of infrastructure.

Do you know a way where RBAC can be used for the above?

For us, we're using long lived credentials in this space using IAM Users but with very tightly controlled authorisations.

Re:Billion-record stolen Chinese database for sale on breach... by steelaz on Thursday July 14, 2022 @04:51PM (#32101301)
"IAM Roles Anywhere" was announced just a couple of weeks ago. It might be applicable to your case.

https://aws.amazon.com/about-aws/whats-new/2022/07/aws-ident...

Re:Billion-record stolen Chinese database for sale on breach... by jffry on Tuesday July 05, 2022 @04:34PM (#31993338)
For my dev machine's interactions with AWS, I use https://github.com/99designs/aws-vault

You add the long lived IAM user API key/secret to it and it stores it in a password protected storage (MacOS keychain or similar).

Then you invoke aws-vault with an IAM role and command, and it will handle obtaining short-lived credentials scoped to that role (including TOTP 2-factor code auth), and then run the command with those temporary credentials as env vars.

With the right AWS permissions on your user, it can also automatically rotate the IAM user API keys for you.

Re:Billion-record stolen Chinese database for sale on breach... by rad_gruchalski on Tuesday July 05, 2022 @06:17PM (#31994456)
I like your approach. So far I used profiles extensively. AWS_PROFILE is your friend. No idea why AWS doesn't heavily promote this everywhere they can.
Re:Billion-record stolen Chinese database for sale on breach... by flyt on Tuesday July 05, 2022 @07:29PM (#31995006)
AWS best practices is to use AWS SSO, which accomplishes this same effect but without any long-lived local credentials. It works really well.
Re:Billion-record stolen Chinese database for sale on breach... by LilBytes on Tuesday July 05, 2022 @08:45PM (#31995517)
Depending on your IdP there's a few tools in addition to AWS CLI v2 that works well in this space.

aws-vault is one of them, though out of support now, aws-okta [1] is another.

[1] https://github.com/segmentio/aws-okta

Re:Billion-record stolen Chinese database for sale on breach... by nijave on Tuesday July 05, 2022 @11:10PM (#31996258)
Used to use that a few years ago and it worked pretty well--you can also set it as a credential helper in your AWS config.

Just an FYI it's no longer supported and it looks like the fork has gone stagnant, too.

Re:Billion-record stolen Chinese database for sale on breach... by arjvik on Tuesday July 05, 2022 @07:25PM (#31994987)
> No idea why AWS doesn't heavily promote this everywhere they can.

Not Invented Here

Re:Billion-record stolen Chinese database for sale on breach... by moduspol on Tuesday July 05, 2022 @08:33PM (#31995436)
AWS SSO solves it better, and for any number of AWS accounts.

I still use aws-vault, though, when I'm not in a position to set up AWS SSO.

Re:Billion-record stolen Chinese database for sale on breach... by toomuchtodo on Tuesday July 05, 2022 @09:04AM (#31987714)
It can either use a secret injected into an env var to bootstrap rotating ephemeral/refresh tokens or use a role provided by the environment (which can also provide short lived tokens), depending on your runtime environment and use case (on prem, cloud, k8s, etc).

Static, long lived secrets with limited governance that have no conditional access guards are weapons of mass self destruction.

Re:Billion-record stolen Chinese database for sale on breach... by robonerd on Tuesday July 05, 2022 @03:28PM (#31992615)
Keeping secrets in environmental variables has always seemed dodgy to me. Unless specifically cleared, they get inherited by all child processes. Maybe there are never any child processes in your application, or that could be desired behavior in some circumstances, but generally it seems like asking for trouble.
Re:Billion-record stolen Chinese database for sale on breach... by toomuchtodo on Tuesday July 05, 2022 @03:42PM (#31992755)
Its safety is proportional to your isolation model. Never use env vars for secrets when you’re executing arbitrary code, for example.
Re:Billion-record stolen Chinese database for sale on breach... by RajT88 on Tuesday July 05, 2022 @05:24PM (#31993906)
There's also the reverse issue - if they change after your process is started.

Refreshing an environment variable that has changed is (for me) a line I won't cross. Time to write the app a different way, once that becomes a concern.

Re:Billion-record stolen Chinese database for sale on breach... by FujiApple on Tuesday July 05, 2022 @04:41PM (#31993427)
Yes, but credentials should either be long lived with (very) limited scope _or_ short lived with required scope.

For example, for AWS you can create long lived credentials for users which are scoped to only allow one operation, namely obtaining a short lived token (with the aid of a hardware token such as a Yubikey) with scope to perform other operations.

AWS guide here: https://aws.amazon.com/blogs/security/enhance-programmatic-a...

Re:Billion-record stolen Chinese database for sale on breach... by thedougd on Tuesday July 05, 2022 @03:34PM (#31992676)
You may also setup federated (trusted) relationships. For example, a GitHub Workflow can be trusted to assume an IAM role. In that scenario, there's no long lived secret in scope.

The oidc subject includes the GitHub org, repo, branch, and environment for the IAM assume role policy to match or filter.

Re:Billion-record stolen Chinese database for sale on breach... by throwaway2037 on Tuesday July 05, 2022 @08:36AM (#31987462)
I never heard about "ephemeral credentials" before your post. I have some Googling to do!
Re:Billion-record stolen Chinese database for sale on breach... by toomuchtodo on Tuesday July 05, 2022 @09:20AM (#31987889)
The other term of art is “dynamic secrets.”

https://www.vaultproject.io/use-cases/dynamic-secrets

Re:Billion-record stolen Chinese database for sale on breach... by 0des on Tuesday July 05, 2022 @04:32PM (#31993316)
Good lookin out, thanks for the link
Re:Billion-record stolen Chinese database for sale on breach... by krageon on Tuesday July 05, 2022 @08:51AM (#31987590)
It's essentially an access token with a very short expiry time.
Re:Billion-record stolen Chinese database for sale on breach... by stefan_ on Tuesday July 05, 2022 @05:03PM (#31993658)
This is not at all the takeaway from this. It's "this shitty developer should not have had access to this data in the first place". With a nuance of "this database probably shouldn't exist in this form in one place to begin with".
Re:Billion-record stolen Chinese database for sale on breach... by brianpan on Tuesday July 05, 2022 @11:54PM (#31996517)
Speaking as an Asian American, no, let's not do that.
Re:Billion-record stolen Chinese database for sale on breach... by throwaway787544 on Wednesday July 06, 2022 @12:14AM (#31996639)
Ok; could you suggest an alternate? Would be handy to have a shorthand to refer to the incident
Re:Billion-record stolen Chinese database for sale on breach... by brianpan on Wednesday July 06, 2022 @12:45PM (#32003488)
How you come up with a name is up to you and how you use it. Personally I would go with "July 2022 Shanghai National Police database leak" because I'm not having any conversation where a cute codename would be less confusing.

At work we codename security issues we are working on for Slack channels, etc. We use unrelated names that you could get from a name generator.

Re:Billion-record stolen Chinese database for sale on breach... by shirleyquirk on Wednesday July 06, 2022 @05:09AM (#31998510)
not their job. How about you come up with something catchy?
Re:Billion-record stolen Chinese database for sale on breach... by snovv_crash on Wednesday July 06, 2022 @02:08AM (#31997323)
Shanghai'd is already a phrase that means something else, anyways.
Re:Billion-record stolen Chinese database for sale on breach... by xwolfi on Wednesday July 06, 2022 @01:13AM (#31996958)
Why ?
Re:Billion-record stolen Chinese database for sale on breach... by babelfish on Tuesday July 05, 2022 @05:03PM (#31993659)
Let's not. After the whole "China Virus" shit propagated by the right, I'd prefer if we tried not to associate vulnerabilities with specific people.
Re:Billion-record stolen Chinese database for sale on breach... by markdown on Tuesday July 05, 2022 @05:32PM (#31994006)
Re:Billion-record stolen Chinese database for sale on breach... by malcolmgreaves on Tuesday July 05, 2022 @05:44PM (#31994128)
That's not an argument for continuing to use a word.
Re:Billion-record stolen Chinese database for sale on breach... by markdown on Tuesday July 05, 2022 @05:53PM (#31994213)
It is if the argument to stop using it is some irrelevant point about some other location-based word that was used negatively only recently.

Something got shanghaied isn't a pejorative in the way that Trump acolytes use "China virus".

Re:Billion-record stolen Chinese database for sale on breach... by malcolmgreaves on Tuesday July 05, 2022 @05:57PM (#31994254)
> irrelevant point about some other location-based word that was used negatively only recently.

Are you unaware of the Chinese Exclusion Act of 1882 -- which is exactly around the time that this term was popular and in common use?

Re:Billion-record stolen Chinese database for sale on breach... by markdown on Tuesday July 05, 2022 @06:12PM (#31994408)
The correlation is coincidental. It has nothing to do with that. https://en.wikipedia.org/wiki/Shanghaiing
Re:Billion-record stolen Chinese database for sale on breach... by xfitm3 on Tuesday July 05, 2022 @05:28PM (#31993960)
I don't believe this comment is made in good faith, there is nothing wrong with the "right" and it's senselessly adding fuel to our political division.
Re:Billion-record stolen Chinese database for sale on breach... by malcolmgreaves on Tuesday July 05, 2022 @05:37PM (#31994046)
There is something deeply wrong with the authoritarian politics of the right and its casual use of racism to further political control.

> it's senselessly adding fuel to our political division.

This comment, whether you realize it or not, is coming from a place of extreme social privilege.

Remember that for the majority of people, politics is not a game. It is serious. People lose their rights to live the life they want all the time. Sometimes those politics turn violent and people lose everything.

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.
Re:Billion-record stolen Chinese database for sale on breach... by thrdbndndn on Tuesday July 05, 2022 @04:17PM (#31993149)
The consensus in Chinese community is while this is likely how the token got leaked, this alone isn't enough. To visit private Alibaba Cloud instance you can't just use some random IP. It's isolated from the Internet in certain way.
Re:Billion-record stolen Chinese database for sale on breach... by rfoo on Wednesday July 06, 2022 @03:49AM (#31997984)
And we all know isolations based on network perimeter eventually falls apart, and because it encourages insecure opsec practices like this, people are going to have a big surprise when it happens.
Re:Billion-record stolen Chinese database for sale on breach... by sebazzz on Wednesday July 06, 2022 @01:12PM (#32003904)
Remember when we still used password Windows Authentication and a private shielded network you could only get into with VPN instead of public cloud services with generic access credentials. It still didn't make leaking credentials right, but it was one extra layer of protection.
Re:Billion-record stolen Chinese database for sale on breach... by truthwhisperer on Tuesday July 05, 2022 @04:43PM (#31993443)
poor developer. He may spend this life at a "re-education camp"