2024-04-11 14:23:07 +00:00
|
|
|
id: iam-mfa-enable
|
|
|
|
info:
|
|
|
|
name: MFA not enabled for AWS IAM Console User
|
|
|
|
author: princechaddha
|
|
|
|
severity: high
|
|
|
|
description: |
|
|
|
|
Verifies that Multi-Factor Authentication (MFA) is enabled for all IAM users with console access in AWS
|
|
|
|
reference:
|
|
|
|
- https://docs.aws.amazon.com/cli/latest/reference/iam/list-mfa-devices.html
|
2024-06-07 10:04:29 +00:00
|
|
|
metadata:
|
|
|
|
max-request: 2
|
2024-04-11 14:23:07 +00:00
|
|
|
tags: cloud,devops,aws,amazon,iam,aws-cloud-config
|
|
|
|
|
|
|
|
flow: |
|
|
|
|
code(1)
|
|
|
|
for(let UserName of iterate(template.users)){
|
|
|
|
set("user", UserName)
|
|
|
|
code(2)
|
|
|
|
}
|
|
|
|
|
|
|
|
self-contained: true
|
|
|
|
code:
|
|
|
|
- engine:
|
|
|
|
- sh
|
|
|
|
- bash
|
|
|
|
source: |
|
|
|
|
aws iam list-users --query 'Users[*].UserName'
|
|
|
|
|
|
|
|
extractors:
|
|
|
|
- type: json # type of the extractor
|
|
|
|
internal: true
|
|
|
|
name: users
|
|
|
|
json:
|
|
|
|
- '.[]'
|
|
|
|
|
|
|
|
- engine:
|
|
|
|
- sh
|
|
|
|
- bash
|
|
|
|
source: |
|
|
|
|
aws iam list-mfa-devices --user-name $user --query 'MFADevices'
|
|
|
|
|
|
|
|
matchers:
|
|
|
|
- type: word
|
|
|
|
words:
|
|
|
|
- "[]"
|
|
|
|
|
|
|
|
extractors:
|
|
|
|
- type: dsl
|
|
|
|
dsl:
|
|
|
|
- '"MFA is no enabled for IAM User " + user'
|
2024-06-08 16:02:17 +00:00
|
|
|
# digest: 4a0a004730450221008072a04e0f68ee2345d1bfeee304675bc22468a061fd9fa3fbed31279e399640022057efc7bfe58fc41c86be4cfdc0870e4d998282ff71b6d70a3da557cb67cd2d09:922c64590222798bb761d5b6d8e72950
|