For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/terraform-aws-user-with-privilege-escalation-by-actions-iam-passrole-and-glue-createdevendpoint.md.
A documentation index is available at /llms.txt.
Granting an IAM user permissions for both glue:CreateDevEndpoint and iam:PassRole actions with the Resource set to "*" allows that user to create a Glue development endpoint and attach any role in the account, including those with elevated privileges. This misconfiguration enables privilege escalation, meaning the user could effectively gain administrator-level access or perform unauthorized actions across the AWS environment. To prevent this, restrict the actions and resources in IAM policies and avoid using wildcard "*" permissions, as in the secure example below:
resource"aws_iam_user""cosmic"{name="cosmic"}resource"aws_iam_user_policy""test_inline_policy"{name="test_inline_policy"user=aws_iam_user.cosmic.namepolicy= jsonencode({Version="2012-10-17"Statement=[{Action=["glue:CreateDevEndpoint",]Effect="Allow"Resource="*"},]})}resource"aws_iam_policy_attachment""test-attach"{name="test-attachment"users=[aws_iam_user.cosmic.name]roles=[aws_iam_role.role.name]groups=[aws_iam_group.group.name]policy_arn=aws_iam_policy.policy.arn}resource"aws_iam_policy""policy"{name="test-policy"description="A test policy"policy= jsonencode({Version="2012-10-17"Statement=[{Action=["iam:PassRole",]Effect="Allow"Resource="*"},]})}
1
2
rulesets:- Terraform / AWS # Rules to enforce / AWS.
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.