News for hackers. Stuff that matters.
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.