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

MFA requirements in roles can lead to misleading results #116

Open
RyanJarv opened this issue May 6, 2022 · 0 comments
Open

MFA requirements in roles can lead to misleading results #116

RyanJarv opened this issue May 6, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@RyanJarv
Copy link

RyanJarv commented May 6, 2022

Brief Description
IAM roles blocking access without MFA return incorrect results when calling local_check_authorization_handling_mfa. These roles also fail to appear in the output of python ./pmapper.py --profile me query 'preset privesc *'.

IAM Action, Resource, and Condition Being Authorized
The principal needs to be a role with an identity policy enforcing MFA. The specific actions affected are the one's that apply to the MFA conditional in the policy.

IAM Policies Attached to Principal

arn:aws:iam::aws:policy/AdministratorAccess

And a custom policy with the following:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Deny",
            "Action": "*",
            "Resource": "*",
            "Condition": {
                "BoolIfExists": {
                    "aws:MultiFactorAuthPresent": "false"
                }
            }
        }
    ]
}

Expected Behavior
The principalmapper.querying.query_interface.local_check_authorization_handling_mfa function should return (True, True) when passed any action without any explicitly passed condition keys (as it would if the principal was a User). The current behavior is to return (False, False).

Looks like the issue is here:

https://github.com/nccgroup/PMapper/blob/master/principalmapper/querying/query_interface.py#L205

I suspect the idea here is in some cases roles can't have MFA (if attached to EC2), so returning a (True, True) result in that case might be misleading if the calling function isn't taking into account the source.

@RyanJarv RyanJarv added the bug Something isn't working label May 6, 2022
wdahlenburg pushed a commit to wdahlenburg/PMapper that referenced this issue Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant