|
1 | 1 | { |
2 | 2 | "Provider": "aws", |
3 | 3 | "CheckID": "secretsmanager_has_restrictive_resource_policy", |
4 | | - "CheckTitle": "Ensure Secrets Manager secrets have restrictive resource-based policies.", |
| 4 | + "CheckTitle": "Secrets Manager secret has a restrictive resource-based policy", |
5 | 5 | "CheckType": [ |
6 | | - "Software and Configuration Checks/AWS Security Best Practices" |
| 6 | + "Software and Configuration Checks/AWS Security Best Practices", |
| 7 | + "Effects/Data Exposure" |
7 | 8 | ], |
8 | 9 | "ServiceName": "secretsmanager", |
9 | 10 | "SubServiceName": "", |
10 | 11 | "ResourceIdTemplate": "arn:aws:secretsmanager:region:account-id:secret:secret-name", |
11 | 12 | "Severity": "high", |
12 | 13 | "ResourceType": "AwsSecretsManagerSecret", |
13 | | - "Description": "This check verifies whether Secrets Manager secrets have resource-based policies that restrict access.", |
14 | | - "Risk": "Secrets without restrictive resource-based policies may be accessed by unauthorized entities, leading to potential data breaches.", |
15 | | - "RelatedUrl": "https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_resource-policies.html", |
| 14 | + "ResourceGroup": "security", |
| 15 | + "Description": "**AWS Secrets Manager secrets** are evaluated for **restrictive resource-based policies**. The policy must include an explicit **Deny** for unauthorized principals, restrict access to the **AWS Organization**, limit each principal to **specific actions** via `NotAction`, and constrain AWS service access with `aws:SourceAccount`.", |
| 16 | + "Risk": "Without a restrictive resource policy, **any IAM principal** in the account—or even **cross-account entities**—can read, modify, or delete the secret, compromising **confidentiality** and **integrity**. Overly broad policies enable **lateral movement** and **privilege escalation** through exposed credentials.", |
| 17 | + "RelatedUrl": "", |
| 18 | + "AdditionalURLs": [ |
| 19 | + "https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_resource-policies.html", |
| 20 | + "https://docs.aws.amazon.com/secretsmanager/latest/userguide/determine-acccess_examine-iam-policies.html" |
| 21 | + ], |
16 | 22 | "Remediation": { |
17 | 23 | "Code": { |
18 | | - "CLI": "", |
19 | | - "NativeIaC": "", |
20 | | - "Other": "", |
21 | | - "Terraform": "" |
| 24 | + "CLI": "aws secretsmanager put-resource-policy --secret-id <example_resource_id> --resource-policy file://policy.json", |
| 25 | + "NativeIaC": "```yaml\nResources:\n <example_resource_name>:\n Type: AWS::SecretsManager::ResourcePolicy\n Properties:\n SecretId: <example_resource_id>\n ResourcePolicy: # Critical: deny-by-default with explicit exceptions\n Version: '2012-10-17'\n Statement:\n - Effect: Deny\n Principal: '*'\n Action: '*'\n Resource: '*'\n Condition:\n StringNotEquals:\n aws:PrincipalArn: <AUTHORIZED_ROLE_ARN>\n```", |
| 26 | + "Other": "1. Open AWS Console > Secrets Manager\n2. Select the secret > Overview tab > Resource permissions > Edit permissions\n3. Add a **Deny** statement for `Principal: *` with `StringNotEquals` condition listing only authorized `aws:PrincipalArn` values\n4. Add a **Deny** statement with `StringNotEquals` on `aws:PrincipalOrgID` to block access from outside your organization\n5. For each authorized principal, add a **Deny** with `NotAction` listing only the specific actions they need\n6. Save the policy", |
| 27 | + "Terraform": "```hcl\nresource \"aws_secretsmanager_secret_policy\" \"<example_resource_name>\" {\n secret_arn = \"<example_resource_id>\"\n policy = jsonencode({ # Critical: deny-by-default with explicit exceptions\n Version = \"2012-10-17\"\n Statement = [\n {\n Effect = \"Deny\"\n Principal = \"*\"\n Action = \"*\"\n Resource = \"*\"\n Condition = {\n StringNotEquals = {\n \"aws:PrincipalArn\" = [\"<AUTHORIZED_ROLE_ARN>\"]\n }\n }\n }\n ]\n })\n}\n```" |
22 | 28 | }, |
23 | 29 | "Recommendation": { |
24 | | - "Text": "Ensure that Secrets Manager policies restrict access to authorized principals only, following the Principle of Least Privilege.", |
25 | | - "Url": "https://docs.aws.amazon.com/secretsmanager/latest/userguide/determine-acccess_examine-iam-policies.html" |
| 30 | + "Text": "Apply **deny-by-default** resource policies to every secret:\n- Deny all principals except explicitly authorized roles via `StringNotEquals` on `aws:PrincipalArn`\n- Deny access from outside the AWS Organization via `aws:PrincipalOrgID`\n- Restrict each authorized principal to **least-privilege actions** using `NotAction`\n- Constrain AWS service access with `aws:SourceAccount`", |
| 31 | + "Url": "https://hub.prowler.com/check/secretsmanager_has_restrictive_resource_policy" |
26 | 32 | } |
27 | 33 | }, |
28 | 34 | "Categories": [ |
29 | | - "access-control" |
| 35 | + "secrets", |
| 36 | + "trust-boundaries" |
30 | 37 | ], |
31 | 38 | "DependsOn": [], |
32 | 39 | "RelatedTo": [], |
33 | | - "Notes": "" |
| 40 | + "Notes": "This check enforces a strict deny-by-default pattern for Secrets Manager resource policies. It validates four layered controls: (1) an explicit Deny for all unauthorized principals, (2) an organization boundary via PrincipalOrgID, (3) per-principal action restrictions via NotAction, and (4) SourceAccount constraints for AWS service principals. Cross-account Allow statements cause the check to fail intentionally to surface expanded trust boundaries for review." |
34 | 41 | } |
0 commit comments