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

Containers can still access node role #15

Closed
TaiSHiNet opened this issue Oct 2, 2016 · 3 comments
Closed

Containers can still access node role #15

TaiSHiNet opened this issue Oct 2, 2016 · 3 comments

Comments

@TaiSHiNet
Copy link

I've had this roles:

  • worker_role
  • test

When I curl metadata, I receive 'test' as the role I should use. But I can circumvent this by hitting:
curl -s 169.254.169.254/latest/meta-data/iam/security-credentials/worker_role

Which will provide me the temporary credentials for that role. It would be great if we could block those calls, else an attacker could leverage it

@jtblin
Copy link
Owner

jtblin commented Oct 4, 2016

I assume that you have setup the iptables rule correctly? The code doesn't seem to use the role passed in the url at all ( it would probably be better semantically to check and return an error if it isn't the correct role but it should not lead to assuming a role that is not allowed but maybe I'm missing something).

@TaiSHiNet
Copy link
Author

Yeah, without the iptables rule when I curl curl -s 169.254.169.254/latest/meta-data/iam/security-credentials/ I get test as the role I should be assigned

@jtblin
Copy link
Owner

jtblin commented Oct 19, 2016

So looking in the code more, the code is probably just returning the correct role whatever you pass in the url, the url param is just totally ignored, which isn't great but not a security issue. Relevant code:

    remoteIP := parseRemoteAddr(r.RemoteAddr)
    role, err := s.getRole(remoteIP)
    if err != nil {
        http.Error(w, err.Error(), http.StatusNotFound)
        return
    }

The code is just getting the role for the remote IP whatever role is passed in the url. I'll see to change that to return an error instead.

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

No branches or pull requests

2 participants