Secrets Manager with vulnerable policy
이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우
언제든지 연락주시기 바랍니다.Id: fa00ce45-386d-4718-8392-fb485e1f3c5b
Cloud Provider: AWS
Platform: Terraform
Severity: High
Category: Access Control
Learn More
Description
AWS Secrets Manager policies with wildcards in Principal or Action fields create significant security risks by potentially granting excessive permissions to unintended entities. When * is used in the Principal field, any AWS identity can access your secrets, and when used in the Action field, it allows all possible operations on those secrets. This overly permissive access violates the principle of least privilege and could lead to unauthorized access or manipulation of sensitive information. Instead of using wildcards, specify exact identities and permissions, as shown in the secure example: "Principal": {"AWS": "arn:aws:iam::var.account_id:saml-provider/var.provider_name"} and "Action": "secretsmanager:GetSecretValue".
Compliant Code Examples
resource "aws_secretsmanager_secret" "example2" {
name = "example"
}
resource "aws_secretsmanager_secret_policy" "example2" {
secret_arn = aws_secretsmanager_secret.example2.arn
policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "EnableAllPermissions",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::var.account_id:saml-provider/var.provider_name"
},
"Action": "secretsmanager:GetSecretValue",
"Resource": "*"
}
]
}
POLICY
}
Non-Compliant Code Examples
provider "aws" {
region = "us-east-1"
}
resource "aws_secretsmanager_secret" "not_secure_policy" {
name = "not_secure_secret"
}
resource "aws_secretsmanager_secret_policy" "example" {
secret_arn = aws_secretsmanager_secret.not_secure_policy.arn
policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "EnableAllPermissions",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "secretsmanager:*",
"Resource": "*"
}
]
}
POLICY
}