News for hackers. Stuff that matters.
Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by ed25519FUUU on Wednesday July 22, 2020 @10:49AM (#23917619)
Is it really a pain though? Maybe because I’ve been working with it since the beginning. Bucket ACL with NO permissions, then manage all permissions on an IAM role on the account.

If it’s cross account then allow assuming to other accounts, but no reason to bother with the bucket ACL.

Leave the bucket policy blank and you’ll never have to worry about an open bucket. Better yet make a deny rule to everything but a single role, and you don’t have to worry about rogue roles exposing the bucket.

Perhaps some of the issue is that permission can be managed on both IAM and a bucket policy?

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by somehnguy on Wednesday July 22, 2020 @11:32AM (#23918093)
It is absolutely a pain. I'm using S3 for the first time on a project right now and literally every time I have to do anything in AWS I end up confused and scared that I'm leaving a wide open security vulnerability. The documentation is complete insanity to anyone just trying to accomplish what should be an extremely common use case in a reasonable amount of time.

Before using AWS I was in the 'what morons!' camp whenever some company got breached via leaving things wide open on AWS. Now I'm in the 'ok I understand why its so common' camp.

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by mjayhn on Wednesday July 22, 2020 @12:18PM (#23918607)
You're using S3 for the first time. Twilio has the capability to hire Ops staff that have used S3 for 10+ years. Throw a penny down the street in any major city and you'll hit a DevOps person with AWS experience. It's amazing to me how often I hear a company not set up s3 properly, or not enable budget alerts on AWS, etc. This is all day 1 AWS stuff. If that means taking away the ability for your developers to even create buckets then do so. A lot of you should just focus on development work and stay far away from operations/sec tasks, and that's fine. I'm going to assume most of these buckets aren't even made via code and are manual. That's bad enough.

I understand someone brand new to S3 being in the dark but someone in your PRs approval chain should have enough Ops skill to know to check these things if you're not going to hire an actual Ops person. And no, none of this is hard for anyone who has ever touched S3. Ops teams have known about these issues for over a decade. It's practically a meme at this point.

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by somehnguy on Wednesday July 22, 2020 @12:30PM (#23918740)
I understand what you're saying but you do realize that a huge number of software shops don't have massive teams or even dedicated OPs people right?

The number of heads on my project is ...4. We're it. There is no place or person to just push the work off to. There is no PR approval chain. We regularly meet to sync and discuss plans and thats it.

Until very recently all of our infrastructure was in house, right down the hall from me. I (or whoever was in that day) took care of making sure it was running smoothly.

Cloud is new to us, and there is no budget to hire a guy who manages AWS full time. That is the case at an insanely high percentage of software shops. Heck I would wager most people outside of 'new tech (sorry, I can't think of a better term)' shops are using point & click in the web UI to manage AWS. There is no code in source control that manages our infrastructure. I'm jealous of the people that get to do it all the 'right way' but for many there isn't enough manpower or time in the day to do it.

Now why we're in this position in the first place is another debate about why management thinks we need to go cloud at all. But its reality for many.

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by mjayhn on Wednesday July 22, 2020 @12:49PM (#23918919)
Oh trust me I know totally what you mean, I'm usually the first ops person hired at a startup once they've gotten the budget for one. My goal when I work with devs is to get as much of the infrastructure frustration out of their way as possible (unless they want to help with it) and automate the processes that slow down their code from getting deployed. This usually comes with months of fixing cruft/security issues, etc that could've lead to a "hack" like this when just the devs were running the ship.

I wish MORE small dev teams brought in ops people and didn't wait until they had a staff of 20-30 or whatever it typically winds up being. But I know that's a pipe dream and you're basically losing a developer salary to hire a devops/ops person which isn't the direction they want to go.

edit: typos

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by aldarisbm on Wednesday July 22, 2020 @02:58PM (#23920368)
I totally understand where this is coming from, but even if we factor AWS out. IAM _IS_ difficult to implement, there really isn't a way to make it "simple" while still make it extremely granular. You can't have without the other.
Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by SteveNuts on Wednesday July 22, 2020 @12:38PM (#23918813)
To me this is like buying a high end sports car, and neglecting the maintenance because you never factored in the expensive maintenance, and therefore the true cost of what you're buying.
Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by somehnguy on Wednesday July 22, 2020 @12:44PM (#23918864)
I agree. People do it all the time though.
Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by txcwpalpha on Wednesday July 22, 2020 @12:04PM (#23918435)
The problem with S3 is the exact same problem with everything else in AWS. In their quest to be compatible and attractive to every single possible niche use case of the world's largest companies, they completely forgot the lone developer who just wants to upload a couple files.

You'll even see this in their sales pitches. AWS will spend so much time talking about the most advanced use cases and how they are possible, but if you ask them a simple question about how to run a single bucket that doesn't also involve using all of their ML tools and global accelerator and cloudfront, they'll be blindsided. It's almost as if they consider the common use cases to be "too simple/obvious" and therefor they never bothered to create any documentation or put any thought into it.

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by pantulis on Wednesday July 22, 2020 @12:10PM (#23918522)
Your point is good, but one could suppose Twilio is not a "lone developer".
Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by txcwpalpha on Wednesday July 22, 2020 @12:26PM (#23918693)
Certainly not, and in their layers of defense against this stuff, they should have had processes to train people, audit bucket policies, conduct penetration tests etc, and there's no excuse for them not having caught it before.

But with that said, one of those layers of defense is also using tools that are easy to keep secure so that the vulnerability doesn't appear in the first place. While Twilio isn't "a lone developer", I wouldn't be surprised if the person who did create that bucket on behalf of Twilio was just a lone developer fumbling around in the console. And again, that's no excuse, but it still is an area for improvement.

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by pantulis on Thursday July 23, 2020 @02:53AM (#23924832)
I kind of miss the times when working with the cloud was easier or more straightforward.

Now, as has been stated before, reading any cloud vendor documentation is like reading the Oracle manuals of years ago, not a happy experience.

Granted, these clouds now do things much more powerful and target more difficult enterprise scenarios. One can miss Heroku, and AWS has Elastic Beanstalk for that, but EB gets much more difficult fast.

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by fisherjeff on Wednesday July 22, 2020 @12:47PM (#23918902)
It's gotten better, if you can believe it. Regardless, I've managed to come up with one foolproof method for securing my data: Never put anything important on S3.
Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by jfengel on Wednesday July 22, 2020 @11:01AM (#23917751)
I just started a toy project using S3, and at least to a novice user, it was a confusing, overwhelming array of options and linked pieces. It felt like being hit with a lot of advanced options all at once, with no obvious happy path for common cases.

I'm sure an expert finds it all very natural. Security is always hard and has to be done right the first time. That's a domain that's always going to deter novices, and perhaps the only way forward is to hire an expert to ensure you're doing the right thing.

Still... I've been programming for four decades and it felt a little odd to be quite so out of my depth. It's not the same as anything I've done before, but it felt like it shouldn't have been quite so bewildering.

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by wjossey on Wednesday July 22, 2020 @11:06AM (#23917804)
This is the correct design pattern as of 2020. Roles + STS, and always be stingy when granting a role any permissions, both at the resource or API level.

But, as others have said, the documentation at times is poor at best, and it can be easy to make mistakes.

Some preventives every ops team can take are:

1. Never make manual permission changes in the console. Everything is done via SCM’d code.

2. All permission changes are peer reviewed.

3. Create logical separations of buckets so it’s more obvious what the permissions should be of a bucket. You can go so far as to have separate accounts that are for public uploads, separate accounts for public assets, etc. Avoid granting elevated permissions at a folder level, which is harder to understand as a developer without access to view the ACLs.

Good luck everyone!

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by SV_BubbleTime on Wednesday July 22, 2020 @11:41AM (#23918184)
> Never make manual permission changes in the console. Everything is done via SCM’d code.

The first time I heard “infrastructure as code” I thought it was some dumb new buzz words, but no, it’s good advice. Your cloud formation, serverless, terraform whatever should be stored in GIT a stack replace is how changes should be made.

I consider the console as read-only.

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by nitrogen on Wednesday July 22, 2020 @11:54AM (#23918324)
IMO this is code/console dichotomy is a design flaw in most cloud offerings that will haunt the industry for a long time.

The web console should be just another UI for editing the configuration in source control. As an example of why that's important, a UI can give you a warning and use affordances to guide beginners away from dangerous setups. In the case of S3, a slider for basic access level can use colors and show a list of objects that would become world readable or writable at a given level (for that matter why is world writable even an option?). A giant YAML file looks the same whether it's safe or dangerous.

If you really don't want to use a UI, then maybe abstracting a linting layer that feeds the exact same warnings to the UI as to your CI system and text editor would help.

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by SV_BubbleTime on Wednesday July 22, 2020 @12:29PM (#23918734)
> The web console should be just another UI for editing the configuration in source control.

Should. But isn’t.

So until it is, IaC for production. Console or CLI for development.

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by vangelis on Wednesday July 22, 2020 @11:56AM (#23918353)
I occasionally spin up things in the AWS console so I can describe them through the CLI and then delete them. IaC is great until you have no idea what the code should be.
Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by wjossey on Wednesday July 22, 2020 @12:27PM (#23918707)
Certainly not discouraging this, so thank you for pointing it out.

I do the same, and sometimes I need to do something manually so that I can grok what configurations I need to define in terraform / whatever other tool I'm using. POC'ing is different than a production or even staging service.

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by antoncohen on Wednesday July 22, 2020 @11:29AM (#23918048)
It is way too easy to screw up S3 bucket permissions. I caught it once when a coworker told me they setup a bucket for testing that allowed employees to upload, I checked the permissions and it allowed the world to upload.

It would be much harder make that mistake with Google Cloud Storage, at least in the web console. GCS also supports disabling bucket ACLs permanently at bucket creation time, and that is the option they recommend[1].

AWS does scan and alert for some public bucket issues. But with all the public S3 issues, I think it is clear there needs to be more prominent warnings in the AWS console, the command line, and with tools like Terraform.

[1] https://cloud.google.com/storage/docs/access-control

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by txcwpalpha on Wednesday July 22, 2020 @11:54AM (#23918325)
>GCS also supports disabling bucket ACLs permanently at bucket creation time, and that is the option they recommend[1].

S3 does too. There's an entire page during the creation wizard that is dedicated to blocking any and all public access, even causing the bucket to ignore ACLs or other settings that would otherwise expose the bucket publicly. All public access is disabled by default, and enabling it actually requires the user to actively uncheck 5 different checkboxes, each of which explains that unchecking it will open the bucket up to public access, and then even requires an additional attestation, in a large orange warning box, that says you acknowledge that the options you chose will result in the bucket being public.

I'll be the first person to tell you that AWS is overcomplicated and hard to use, but this isn't that. IAM and bucket policies are a pain to work with, but if you screw up with those, the worse you will do is expose your bucket internally. But exposing a bucket publicly to the internet is an entirely different act, and there's not really any excuse for it other than just not reading the directions.

However, neither this option in S3 nor the option you linked in GCS would have served Twilio's use case. They wanted their bucket to be publicly accessible, just not publicly writable. That's an entirely different access management issue.

Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by meritt on Wednesday July 22, 2020 @01:08PM (#23919158)
I have external partners who provide their own principal and I provision a subset of bucket access at the bucket policy level. Is there a better way to do this that's more manageable? The end users are using software or python code where they need to gain access via [access, secret, bucket, prefix/key].
Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by rafaelturk on Wednesday July 22, 2020 @10:54AM (#23917682)
This looks safe, and most importantly correct setup, but looks like it will not support Twillo use case
Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by throwlogon on Wednesday July 22, 2020 @11:00AM (#23917748)
What you described sounds like a pain.
Re:Twilio: Someone broke into our AWS S3 silo, added 'non-ma... by ed25519FUUU on Wednesday July 22, 2020 @12:34PM (#23918769)
What’s the pain? You literally don’t do anything to the bucket policy. It’s intentionally blank.

You already have a role in AWS that you use. Go into the console and say “this role can do S3 to this bucket” and you’re done.