-
Notifications
You must be signed in to change notification settings - Fork 173
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
Role Trust Relationship for AWS services not reported #89
Comments
Hi there! I'm gonna try splitting up the asks here, lemme know if I've missed anything. Issue 1:Currently PMapper's library code supports letting you pass a service to check if they are allowed to assume a role. This is thru the PMapper/principalmapper/graphing/lambda_edges.py Lines 85 to 92 in 722efec
Right now there isn't a way to check from the command line if a service can call an action/etc. We should probably add that in the future to handle a type of risk involving checks against One more note: right now, the candidates = [x for x in graph.nodes where x.is_admin and x.searchable_name().starts_with('role/')]
for candidate in candidates:
# inspect trust doc here Issue 2:The way PMapper works, if there's a "chain" of access, we don't create an edge from the first node in the chain to the final node. In other words, if there's a situation like this:
We don't add edges from user1 to role2/role3/etc. That's because user1 doesn't directly have access to the roles down the chain. However, in any case, PMapper will should correctly handle these types of chains when calling |
Thanks for your detailed reply! For issue 1, I just took a deeper look at "analysis", the output produced by it is pretty much what I was looking for. To better explain what I was suggesting: can we include the output of "analysis" for the roles that have admin policies and can be assumed by other AWS services in "visualize" with the arrows? In other words, it would a box with for example "EC2" that has an arrow towards the role in blue named "EC2_admin_role". That way, we can inform the security team that the service EC2 has a role which is too powerful (and can be abused via the command line within EC2). For issue 2, I will try to clarify things a bit more. Can the tool, again through "visualize", let us know which roles having an admin policy attached, can be "assumed" by other users/roles in the same or other accounts (without necessarily telling us which ones specifically)? During an audit, this should be a red flag, as someone can for example assume Role 1, then assume Role 2, only to assume Role 1 again, and so on, to make it much harder to trace the STS tokens produced. One easy way to find the roles which can be assumed by other roles or users would be filtering the ones with the following trust relationship: "Statement": [ and making a list of them in "visualize" with a different color box :) Thanks again |
Issue 1Okay, I see what you're looking for. I think we could possibly add a Issue 2In visualization, the admin nodes in an account are colored blue. Non-admins are colored white. Non-admins that have a way to gain access to an admin are colored red. At least within the account, you should see if someone can assume an admin role. In terms of visualizing if an admin role can potentially be assumed from outside the account, we don't have anything in place for that yet. We could implement a new color (yellow? orange?) to denote that pattern (such as when someone sets up an OrganizationsAccountAccessRole). |
Issue 1: Exactly, something like visualize --with-services (or even including it by default) would be amazing. I am still not clear how would the preset query work? Issue 2: Yep, I did notice the Red, blue, and white boxes. I guess what I was thinking if 2 blue boxes can be "assumed" by one or the other, we could include an arrow between them. So that for example, it would look like a red box --> blue box --> another blue box :) Exactly, a yellow or orange would mean a different account_ID can assume any of the existing blue boxes w/ an admin policy attached. Naturally, a yellow/orange box was a blue box, but turned yellow/orange since it has an "external" link. |
Issue 1The Issue 2Since all the admins can access any user/role in the account, we avoid storing those edges and displaying those edges in visualizations because it creates a ton of output and clutters the visualization. I think for externally-accessible roles (accounts), we can do:
|
100% agree for both points! Thank you |
v1.1.4 is out and addresses Issue 1. Keeping this open and aim to do "yellow/orange" coloring for externally-accessible roles. |
Fixed the h2 size on mobile
First, thank you for the tool and what it offers so far. I really think that it has a great potential.
Issue1: For testing purposes, I created a Role which has an admin policy attached to it. In the trust relationship of that role, I allowed an AWS service to assume that role, for example:
"Principal": { "Service": "lambda.amazonaws.com" },
"Action": "sts:AssumeRole"
It would be very useful if PMapper would be able to find and list the AWS services which can assume a role with admin privileges.
Issue2: If a user can assume Role1, and through it, assume Role2 (and obtain STS tokens for the permissions of role2), it would be something MPapper should be able to point out. Role2 would have to have a trust relationship similar to the following:
"Principal": { "AWS": "arn:aws:iam::123456789000:root" }
Which means: Any IAM user/role in the account can assume this role, as long as their permission allows it. In this case, Role1 (with an admin policy) can actually assume Role2, since the trust relationship of Role2 allows it, in combination of the permissions of Role1 to assume the role.
When doing an account audit, these 2 issues will greatly help get a better overall picture of excessive privileges assigned to users, roles, and services.
Thank you!
The text was updated successfully, but these errors were encountered: