Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Cookbook for EC2 Instance Metadata Service IMDSV2 configuration (SSRF patch) #122

Merged
merged 3 commits into from
Apr 28, 2020

Conversation

wilkosz
Copy link
Contributor

@wilkosz wilkosz commented Apr 22, 2020

Agenda

Update all service calls to EC2 metadata to use IMDSV2 spec:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html

EC2 metadata service IMDSV1 introduced quite a few vulnerabilities: https://hackerone.com/reports/508459

Fix

  • add proc to retrieve token (could also have been on the client but not used elsewhere)
  • use retrieved token (single hop? -> EC2 Configuration) to call metadata service

Rollout

If this doesn't get rolled out Macroplant may maintain a publicly available version.

@wilkosz wilkosz changed the title SSRF fix for EC2 Metadata service (imdsV2) Fix Cookbook for EC2 Instance Metadata Service IMDSV2 configuration Apr 23, 2020
@wilkosz wilkosz changed the title Fix Cookbook for EC2 Instance Metadata Service IMDSV2 configuration Fix Cookbook for EC2 Instance Metadata Service IMDSV2 configuration (SSRF patch) Apr 23, 2020
@joekiller joekiller merged commit b4c9acc into adamsb6:master Apr 28, 2020
@joekiller
Copy link
Collaborator

Thank you for your contribution. I hope it works!

@joekiller
Copy link
Collaborator

I'll try to push a release soon

@joekiller
Copy link
Collaborator

@wilkosz what was the target platform you tested this on?

the tests seem out of date.

Also did you fix master vs re_2.8? I think re_2.8 is kinda the defacto right now because master got trashed hard and I forked it until I could fix master and alas this project depends on the community to do anything at this period.

https://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os-linux.html

@compuguy
Copy link

You may want to make a note of the re_2.8 branch being stable vs master in the Readme.md @joekiller.

@wilkosz
Copy link
Contributor Author

wilkosz commented Nov 18, 2020

@wilkosz what was the target platform you tested this on?

the tests seem out of date.

Also did you fix master vs re_2.8? I think re_2.8 is kinda the defacto right now because master got trashed hard and I forked it until I could fix master and alas this project depends on the community to do anything at this period.

https://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-os-linux.html

We are currently using this revision on our production builds at macroplant. The big issue we are facing is that all upstream packages are not imdsV2 configured so we have some hacky fixes for our opsworks_ruby startup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants