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

cis_v140_1_16 conflict with foundational_security_iam_1 #277

Closed
Tracked by #281
ecktom opened this issue Sep 9, 2021 · 3 comments · Fixed by #281
Closed
Tracked by #281

cis_v140_1_16 conflict with foundational_security_iam_1 #277

ecktom opened this issue Sep 9, 2021 · 3 comments · Fixed by #281
Assignees
Labels
bug Something isn't working

Comments

@ecktom
Copy link
Contributor

ecktom commented Sep 9, 2021

cis_v140_1_16 and foundational_security_iam_1 are both using https://github.com/turbot/steampipe-mod-aws-compliance/blob/main/query/iam/iam_policy_no_star_star.sql.

While the AWS Foundational Security Best Practices controls indeed are focusing on customer managed policies only The control only checks the customer managed policies that you create. It does not check inline and AWS managed policies. the CIS benchmark considers all attached polices

Audit for CIS 1.16 based on v1.4.0 - 05-28-2021

aws iam list-policies --only-attached --output text
aws iam get-policy-version --policy-arn <policy_arn> --version-id <version>

In output ensure policy should not have any Statement block with "Effect": "Allow" and Action set to "*" and Resource set to "*"

So based on the CIS audit this rule should raise an alert if eg arn:aws:iam::aws:policy/AdministratorAccess is attached

@ecktom ecktom added the bug Something isn't working label Sep 9, 2021
@rajlearner17 rajlearner17 self-assigned this Sep 9, 2021
@e-gineer
Copy link
Contributor

e-gineer commented Sep 9, 2021

Hey @ecktom ... Just wanted to say how much we appreciate these detailed notes and reports!

Please keep them (+ any PRs) coming and we'll be working through them :-)

@rajlearner17
Copy link
Contributor

rajlearner17 commented Sep 15, 2021

@ecktom we should be checking only IAM inline policies (also known as customer managed policies) for foundational_security_iam_1 and for CIS benchmark considers all attached policies, will separate the queries.

We are updating the aws_iam_policy table to address this and further query performance. Here

Further observation, CIS recommends checking the policy attachment, which is missed out in the query

We will now separate the query for

  • foundational_security_iam_1 to check all customer managed policies which are attached
  • cis_v140_1_16 to check all-inclusive policies which are attached.

Let us know

@ecktom
Copy link
Contributor Author

ecktom commented Sep 15, 2021

Hi @rajlearner17, Thanks for jumping in. Separating those queries sound reasonable. You're also right, the "attached" part is currently missing in the query, good catch!

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
3 participants