IAM user policy without MFA 이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우
언제든지 연락주시기 바랍니다. Id: terraform-aws-iam-user-policy-without-mfa
Cloud Provider: AWS
Platform: Terraform
Severity: Low
Category: Insecure Configurations
Learn More Description This check verifies that the AWS root user is required to authenticate using Multi-Factor Authentication (MFA). If the root user is not protected with MFA, as in a policy lacking a condition on "aws:MultiFactorAuthPresent", unauthorized users with access to the root credentials could compromise the entire AWS account. Enforcing MFA by adding a policy condition, such as the following, significantly reduces the risk of credential theft, unauthorized privilege escalation, and account takeovers.
"Condition": {
"BoolIfExists": {
"aws:MultiFactorAuthPresent": "true"
}
}
Compliant Code Examples resource "aws_iam_user" "negative1" {
name = "root"
path = "/system/"
tags = {
tag - key = "tag-value"
}
}
resource "aws_iam_access_key" "negative2" {
user = aws_iam_user . lb . name
}
resource "aws_iam_user_policy" "negative3" {
name = "test"
user = aws_iam_user . lb . name
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"BoolIfExists": {
"aws:MultiFactorAuthPresent" : "true"
}
}
}
]
}
EOF
}
resource "aws_iam_user_policy" "negative4" {
name = "test"
user = aws_iam_user . lb . name
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::mfa/111122223333:root"
},
"Action": "sts:AssumeRole"
}
]
}
EOF
}
Non-Compliant Code Examples resource "aws_iam_user_policy" "mfa_false" {
name = "test-mfa-false"
user = aws_iam_user . lb . name
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"BoolIfExists": {
"aws:MultiFactorAuthPresent": "false"
}
}
}
]
}
EOF
}
resource "aws_iam_user_policy" "wildcard_principal" {
name = "test-wildcard"
user = aws_iam_user . lb . name
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "sts:AssumeRole"
}
]
}
EOF
}
resource "aws_iam_user" "positive1" {
name = "root"
path = "/system/"
tags = {
tag - key = "tag-value"
}
}
resource "aws_iam_access_key" "positive2" {
user = aws_iam_user . lb . name
}
resource "aws_iam_user_policy" "positive3" {
name = "test"
user = aws_iam_user . lb . name
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:root"
},
"Action": "sts:AssumeRole"
}
]
}
EOF
}