-
Notifications
You must be signed in to change notification settings - Fork 209
Description
It appears that the checks for Infrastructure Modification report actions even when conditions apply - while, on the other hand, the checks for e.g. Data Exfiltration and Privilege Escalation do not flag actions when conditions apply.
This causes false negatives when we have a policy that, for example, allows ec2.RunInstances but includes a condition that ec2:Owner must be a certain account; such a policy has been crafted deliberately, but Cloudsplaining still flags it as allowing Infrastructure Modification.
To reproduce, consider this policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ec2:RunInstances"
],
"Condition": {
"StringEquals": {
"ec2:Owner": "ValidOwnerId"
}
},
"Resource": "*",
"Effect": "Allow"
},
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Condition": {
"StringEquals": {
"ec2:Owner": "ValidOwnerId"
}
},
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "glue:updatedevendpoint",
"Condition": {
"StringEquals": {
"ec2:Owner": "ValidOwnerId"
}
},
"Resource": "*"
}
]
}If we remove those Condition blocks, Cloudsplaining identifies 3 issues:

After adding the Conditions, Data Exfiltration and Privilege Escalation disappear, but Infrastructure Modification remains:

Expected Behaviour: The presence of Conditions causes Cloudsplaining to suppress Infrastructure Modification warnings.
Actual Behaviour: Cloudsplaining reports Infrastructure Modification even though Conditions exist on the policy.