Critical Vulnerability: AWS Credential Disclosure
blog.trustlook.com
blog.trustlook.com
2) I would be curious what the backends were in these instances. With the growth of the BaaS-model for app development, I think we're going to see a lot more "offshoring" of these security things, where keys are thrown in the front-end app. "I do it with firebase, why not twilio or aws?"
Guy I was consulting for was famous designer who needed help with web project he talked his way into. Can't be arrogant though, he'd probably laugh at my font, color and layout choices as equally naive/catastrophic.
It's pretty awesome. We're porting all of our code to use this, so we can open source most of our code freely and not have to necessary find ourselves working around security hurdles like this one -- though I'm not sure how it would've helped in this particular use case.
Is it because it's tightly integrated with IAM? If that's the case, does that mean you guys use a cookbook that tightly couples system users with IAM roles?
He was employed previously at Opscode, now Chef Inc.
According to their "About Us" page, however, they are "a global leader in next-generation mobile security solutions." That's pretty remarkable to me considering the company was "founded in 2013" -- not bad for a year or so's work.
But I suppose that's easy to do when your "team consists of security industry veterans" (that shall go unnamed, it seems).
Maybe next week they'll reveal how my home is vulnerable to being broken into by a burglar armed with a battering ram.
I read about a similar one a few months ago. If I were to search for credentials, I should just search through bitbucket, google code and github. There are tons of passwords committed and many are probably still usable...
https://news.ycombinator.com/item?id=7491272
it also predates this blog post
Whether credentials are for their AWS account, or Rackspace account, or Azure account, or their personal banking account, makes no difference, it is not “AWS vulnerability” or “Rackspace vulnerability”, or whatever, it is just a big, big, rookie mistake made by the developer.
Amazon themselves check random apps on the Play Store to make sure you don't embed your cretendial in your code.
In this case, some kind of creds need to go into the app, right?
So the best practise is simply to make those some creds which: 1) have limited privileges (e.g. just access one S3 bucket) and 2) can be centrally revoked (requiring app update for everyone?)
I've read the link on the amazon Token Vending Machine approach, but I still don't understand why that is better.
If I have the embedded creds to get a token from the TVM, and that token allows me to access an S3 bucket, how is that more secure from using limited IAM creds which just allow direct access to the bucket?
In both cases:
- the creds can be revoked centrally
- possession of the embedded creds allows access to the S3 bucket (either directly, or by fetching a token first)
In terms of comparing the two approaches, I can see that if you are granting different creds based on a user auth, an STS is useful to grant temporary creds limited to a subset.
I'll need to look up the details of how much more fine-grained the STS tokens are than the IAM creds to see how much difference there is in the anonymous case.
I'm a heavy AWS user but not too familiar with S3 keys, couldn't the keys be generated and isolated per user?
Who actually does this? Personally I fear most devs are not properly creating several groups and users and permissioning them to the bare minimum depending on the app/dev's minimum needs. Then again, AWS's tools don't help as doing X with AWS CLI might really require permission X, Y and Z, something you don't want to discover in production.
This will let you take a pre-authorized token and make these same requests. No one should be sharing S3 Secrets even if it isn't hardcoded like the implementations trustlook found.
Here's an example of a signed request:
GET foo HTTP/1.1\r\n Host: myawsserver.amazonaws.com\r\n Date: Mon, 7 Apr 2014 15:26:45 EDT\r\n Range: bytes=0-10\r\n" Authorization: AWS AKIAOSF0DNN7EXAMPLE:UC901LzExamplebsGIQdEBeW+tt4=\r\n\r\n
In the above example a request that gets the first 11 bytes of file foo, the "UC901LzExamplebsGIQdEBeW+tt4=" is generated by using your secret key to sign a string, HMAC_S3Secret(string_to_sign).
There are many tools on Amazon, like boto and S3cUrl which help developers learn how to write S3 requests into their code. The problem is that they abstract the signing a lot.
It's possible, and probably a better idea, to pre-sign a token for a specific request either by generating on the server side on the fly, or creating a pool of valid request tokens.
The difficulty is that Amazon's documentation isn't very good if you're doing something like trying to limit file access to specific byte portions of a file, or limit access times.
I found that valid tokens last for 15 minutes from the time they specify in the signature. Anyways, hope this helps.
Being silly with you credentials can hurt you, regardless of the platform or using a compiled or interpreted environment.
This isnt as much a "vulnerability" as it is a complete miss understanding of security and the technology they are using. Everything on the client side should be assumed as obtainable.
There are so many things wrong with that picture.
Interaction with AWS should be wrapped in an app service. So the keys will be on your server. Your web sites or apps talk with that service, not the underlying implementation behind it (i.e. AWS). The API exposed by your app service should be secure by default.
Sometimes some of those apps start as web sites, and they keep a lot of their logic in their controllers, even views. So when time comes to port this to a native phone app for ex., database logins, secret keys and other private implementation details "naturally" end up in application code, since an app consists of the native code version of said controllers and views.
This could've been easily avoided if you automatically split things in secure services from the very start.
Direct device->AWS use can make a lot of scaling issues very simple without needing a middleman service on every request. However this does not obviate the need for a federation brokering-type service that auths the device, calls AWS to get a time-limited token with permissions scoped just so, and hands that back to the client.
AWS provides Amazon/Google/FB web identity federation for just this use case: http://aws.amazon.com/iam/details/manage-federation/.
And I'm sure it does wonders for locking in clients to AWS APIs ;)
As for scalability, there's no inherent scalability issue with middlemen services. There's potentially some added lag (not necessarily), but a pure middleman service (with maybe a bit of caching) is an "embarrassingly parallel" workload. If it gets slow, you just add more servers. And they could be Amazon EC2 servers, nothing bad about that! :)