How are Amazon S3 credentials encrypted?

Archived from the Transloadit support forum. Originally posted on December 12, 2013; details may be outdated, see our docs for current behavior. Original thread

Hi. I’m just checking out transloadit to see whether it would be suitable for my SaaS app.

On one of your demo pages [1] you say that Amazon S3 credentials are encrypted (because they’re stored in an encrypted template). I’m concerned that the encryption might not be that useful, so I thought if I explained my concerns you might be able to confirm/allay my fears.

[1] https://transloadit.com/demos/s3-store/store-uploaded-files

I’m assuming that your server side code must be able to decrypt the template in order to use it. If that’s right, it must mean the key that’s used to decrypt the template must be available to code that runs on the server. Doesn’t it follow, therefore, that anybody who manages hack your web app (heaven forbid) and manages to execute code on your servers could in theory get hold of the decryption key, decrypt the template, and gain access to my S3 bucket?

If you’ve managed to solve this problem or know of any workarounds I’d love to hear about it, as aside from this concern, transloadit looks to be a great fit for my SaaS app (https://www.agileplannerapp.com).

Cheers,
Graham

Hi Graham,

Our keys are injected into process memory by another system user. This means that if someone was able to exploit the user in our system under which we run our api2, he could still not access the keys. If he tried to change our code to display or send the credentials, he would have to restart the service (not permitted under that user) and access the key files (also not permitted).

If our servers are rooted however, it’s a different story. This is why we use firewalls, protect our keys, and limit our sudo, but you are right, one can never be sure.

This is why we recommend to create AMI policies that only have put and ls permissions on your buckets, and hand those to us. So that if your credentials were stolen and decrypted by a criminal, he still could not do much with it other than add more files to your bucket. Something you could easily detect with code.

I hope this helps to take away some concerns, but you are right, 100% security is something nor we or anyone else could ever be able to offer you. All we can do is make it as hard as possible to for anyone to gain access to your credentials and keys necessary to decrypt them, and if they do manage to acquire them, make them as useless as possible.

Kind regards,
Kevin

Thanks Kevin - it sounds like you’ve taken sensible steps to protect yourselves. And thanks for point out that giving you write-only credentials essentially fixes the biggest risk.

Cheers,
Graham