[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6AG8MVZES5MFDS9CG5GAWAZ":3,"skill-same:01M6AG8MVZES5MFDS9CG5GAWAZ":137},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":51,"linkOnly":52,"markdownContent":53,"markdownBody":54,"frontMatter":55,"refName":96,"commitSha":97,"skillDirectory":98,"forksCount":99,"repositoryHtmlUrl":100,"repositoryHomepageUrl":101,"ownerHtmlUrl":102,"ownerBlogUrl":103,"ownerDescription":104,"updatedAt":105,"install":106,"resources":119},"01M6AG8MVZES5MFDS9CG5GAWAZ","securing-aws-iam-permissions","AWS IAM权限安全加固","Hardens AWS IAM configurations to enforce least-privilege access, covering IAM policy scoping, permission boundaries, IAM Access Analyzer integration, and credential rotation strategies. Use when reducing the blast radius of compromised AWS identities, auditing overly permissive IAM policies, or setting up permission boundaries and Access Analyzer findings review across cloud accounts.","加固 AWS IAM 配置以强制实施最小权限访问，涵盖 IAM 策略范围界定、权限边界、IAM Access Analyzer 集成和凭证轮换策略。适用于缩小 AWS 身份失陷后的影响范围、审计过于宽松的 IAM 策略，或跨云账户设置权限边界和 Access Analyzer 发现项审查。","mukul975\u002FAnthropic-Cybersecurity-Skills","mukul975","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F42860185?v=4","01M6ADEQR8T5M4EEG6C67BQCWF","Mahipal","01M6ADJPMYWG1E5GM1FWBE3128",36146,"Apache-2.0",null,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fsecuring-aws-iam-permissions\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BR4MYFKGCC4WCWVJ50KJ2C","安全工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BTFDX7M21YT75733H52N36","身份与访问管理","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"aws","securing aws iam permissions","iam","permissions","change","identity","pr","authentication","cybersecurity","cloud-security","review","policy","least-privilege","t1003","t1078","initial-access","permission-boundaries","radius","api","security","2026-11-10 10:12:30",false,"---\nname: securing-aws-iam-permissions\ndescription: 'Hardens AWS IAM configurations to enforce least-privilege access, covering\n  IAM policy scoping, permission boundaries, IAM Access Analyzer integration, and credential\n  rotation strategies. Use when reducing the blast radius of compromised AWS identities,\n  auditing overly permissive IAM policies, or setting up permission boundaries and\n  Access Analyzer findings review across cloud accounts.\n\n  '\ndomain: cybersecurity\nsubdomain: cloud-security\ntags:\n- aws-iam\n- least-privilege\n- permission-boundaries\n- access-analyzer\n- cloud-identity\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.IR-01\n- ID.AM-08\n- GV.SC-06\n- DE.CM-01\nmitre_attack:\n- T1078.004\n- T1530\n- T1537\n- T1580\n- T1003\nmitre_f3:\n  version: '1.1'\n  tactics:\n  - initial-access\n  - positioning\n  techniques:\n  - id: F1006.001\n    name: 'Account Takeover: Exposed API Key'\n    tactic: initial-access\n    source: f3\n  - id: F1006.002\n    name: 'Account Takeover: Exposed Login Credential'\n    tactic: initial-access\n    source: f3\n  - id: T1550.001\n    name: 'Use Alternate Authentication Material: Application Access Token'\n    tactic: initial-access\n    source: attack\n  - id: T1110.003\n    name: 'Brute Force: Password Spraying'\n    tactic: initial-access\n    source: attack\n  - id: F1005.004\n    name: 'Account Manipulation: Change Account Details'\n    tactic: positioning\n    source: f3\n---\n\n# Securing AWS IAM Permissions\n\n## When to Use\n\n- When onboarding new AWS accounts or workloads that require scoped IAM policies\n- When IAM Access Analyzer reports overly permissive policies or unused permissions\n- When preparing for a compliance audit requiring least privilege evidence (SOC 2, PCI-DSS)\n- When migrating from long-lived access keys to short-lived role-based credentials\n- When remediating findings from AWS Security Hub related to IAM misconfigurations\n\n**Do not use** for Azure AD or Google Cloud IAM configurations, application-level authorization logic, or federated identity provider setup (see managing-cloud-identity-with-okta).\n\n## Prerequisites\n\n- AWS account with administrative access or IAM:FullAccess permissions\n- AWS CLI v2 installed and configured with named profiles\n- AWS CloudTrail enabled for at least 90 days of API activity history\n- Familiarity with JSON-based IAM policy syntax and ARN resource notation\n\n## Workflow\n\n### Step 1: Inventory Existing IAM Entities and Policies\n\nGenerate a comprehensive inventory of all IAM users, roles, groups, and attached policies using the AWS CLI and IAM credential reports. Identify accounts with console access, programmatic access keys, and their last-used timestamps.\n\n```bash\n# Generate IAM credential report\naws iam generate-credential-report\naws iam get-credential-report --query 'Content' --output text | base64 -d > iam-report.csv\n\n# List all IAM roles and their attached policies\naws iam list-roles --query 'Roles[*].[RoleName,Arn,CreateDate]' --output table\n\n# Find users with access keys older than 90 days\naws iam list-users --query 'Users[*].UserName' --output text | while read user; do\n  aws iam list-access-keys --user-name \"$user\" \\\n    --query \"AccessKeyMetadata[?CreateDate\u003C='$(date -d '-90 days' +%Y-%m-%d)'].[UserName,AccessKeyId,Status,CreateDate]\" \\\n    --output table\ndone\n```\n\n### Step 2: Enable and Analyze IAM Access Analyzer Findings\n\nActivate IAM Access Analyzer at the organization or account level to identify resources shared externally and generate least-privilege policy recommendations based on CloudTrail activity.\n\n```bash\n# Create an Access Analyzer for the account\naws accessanalyzer create-analyzer \\\n  --analyzer-name account-analyzer \\\n  --type ACCOUNT\n\n# List active findings for external access\naws accessanalyzer list-findings \\\n  --analyzer-arn arn:aws:access-analyzer:us-east-1:123456789012:analyzer\u002Faccount-analyzer \\\n  --filter '{\"status\": {\"eq\": [\"ACTIVE\"]}}'\n\n# Generate a policy based on CloudTrail activity for a specific role\naws accessanalyzer start-policy-generation \\\n  --policy-generation-details '{\n    \"principalArn\": \"arn:aws:iam::123456789012:role\u002FAppRole\",\n    \"cloudTrailDetails\": {\n      \"trailArn\": \"arn:aws:cloudtrail:us-east-1:123456789012:trail\u002Fmanagement-trail\",\n      \"startTime\": \"2025-01-01T00:00:00Z\",\n      \"endTime\": \"2025-03-01T00:00:00Z\"\n    }\n  }'\n```\n\n### Step 3: Scope Policies to Specific Resources and Conditions\n\nReplace wildcard resource ARNs with specific resource identifiers. Add IAM policy conditions for MFA enforcement, source IP restrictions, and time-based access windows.\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"AllowS3ReadSpecificBucket\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:GetObject\",\n        \"s3:ListBucket\"\n      ],\n      \"Resource\": [\n        \"arn:aws:s3:::production-data-bucket\",\n        \"arn:aws:s3:::production-data-bucket\u002F*\"\n      ],\n      \"Condition\": {\n        \"Bool\": {\"aws:MultiFactorAuthPresent\": \"true\"},\n        \"IpAddress\": {\"aws:SourceIp\": \"10.0.0.0\u002F8\"},\n        \"DateGreaterThan\": {\"aws:CurrentTime\": \"2025-01-01T00:00:00Z\"}\n      }\n    }\n  ]\n}\n```\n\n### Step 4: Implement Permission Boundaries\n\nAttach permission boundaries to IAM roles and users to define the maximum scope of permissions an entity can receive, preventing privilege escalation even if an administrator attaches an overly permissive policy.\n\n```bash\n# Create a permission boundary policy\naws iam create-policy \\\n  --policy-name DeveloperPermissionBoundary \\\n  --policy-document file:\u002F\u002Fdeveloper-boundary.json\n\n# Attach the boundary to an IAM role\naws iam put-role-permissions-boundary \\\n  --role-name DeveloperRole \\\n  --permissions-boundary \"arn:aws:iam::123456789012:policy\u002FDeveloperPermissionBoundary\"\n```\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"AllowCommonServices\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:*\",\n        \"dynamodb:*\",\n        \"lambda:*\",\n        \"logs:*\",\n        \"cloudwatch:*\"\n      ],\n      \"Resource\": \"*\"\n    },\n    {\n      \"Sid\": \"DenyIAMChanges\",\n      \"Effect\": \"Deny\",\n      \"Action\": [\n        \"iam:CreateUser\",\n        \"iam:DeleteUser\",\n        \"iam:CreateRole\",\n        \"iam:DeleteRole\",\n        \"iam:AttachRolePolicy\",\n        \"iam:PutRolePermissionsBoundary\"\n      ],\n      \"Resource\": \"*\"\n    }\n  ]\n}\n```\n\n### Step 5: Enforce MFA and Eliminate Long-Lived Credentials\n\nRequire MFA for all human users accessing the AWS console and CLI. Migrate workloads from IAM user access keys to IAM roles with temporary credentials via STS AssumeRole.\n\n```bash\n# Enforce MFA via SCP at the organization level\naws organizations create-policy \\\n  --name RequireMFA \\\n  --type SERVICE_CONTROL_POLICY \\\n  --content '{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n      {\n        \"Sid\": \"DenyAllExceptMFA\",\n        \"Effect\": \"Deny\",\n        \"NotAction\": [\n          \"iam:CreateVirtualMFADevice\",\n          \"iam:EnableMFADevice\",\n          \"iam:ListMFADevices\",\n          \"iam:ResyncMFADevice\",\n          \"sts:GetSessionToken\"\n        ],\n        \"Resource\": \"*\",\n        \"Condition\": {\n          \"BoolIfExists\": {\"aws:MultiFactorAuthPresent\": \"false\"}\n        }\n      }\n    ]\n  }'\n\n# Deactivate unused access keys\naws iam update-access-key --user-name old-user --access-key-id AKIAEXAMPLE --status Inactive\n```\n\n### Step 6: Automate Continuous IAM Monitoring\n\nDeploy AWS Config rules and Security Hub controls to continuously evaluate IAM posture. Set up EventBridge rules to alert on high-risk IAM changes such as new root access key creation or policy modifications.\n\n```bash\n# Enable AWS Config rule for IAM password policy\naws configservice put-config-rule \\\n  --config-rule '{\n    \"ConfigRuleName\": \"iam-password-policy\",\n    \"Source\": {\n      \"Owner\": \"AWS\",\n      \"SourceIdentifier\": \"IAM_PASSWORD_POLICY\"\n    },\n    \"InputParameters\": \"{\\\"RequireUppercaseCharacters\\\":\\\"true\\\",\\\"RequireLowercaseCharacters\\\":\\\"true\\\",\\\"RequireSymbols\\\":\\\"true\\\",\\\"RequireNumbers\\\":\\\"true\\\",\\\"MinimumPasswordLength\\\":\\\"14\\\",\\\"MaxPasswordAge\\\":\\\"90\\\"}\"\n  }'\n\n# EventBridge rule to detect root account usage\naws events put-rule \\\n  --name DetectRootUsage \\\n  --event-pattern '{\n    \"detail-type\": [\"AWS API Call via CloudTrail\"],\n    \"detail\": {\n      \"userIdentity\": {\"type\": [\"Root\"]}\n    }\n  }'\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Least Privilege | Granting only the minimum permissions required for an identity to perform its function |\n| Permission Boundary | An advanced IAM feature that sets the maximum permissions an entity can have, regardless of attached policies |\n| IAM Access Analyzer | AWS service that uses automated reasoning to identify resources shared externally and generate least-privilege policies from CloudTrail activity |\n| Service Control Policy (SCP) | Organization-level policy that sets permission guardrails across all accounts in an AWS Organization |\n| Assume Role | STS operation that returns temporary security credentials for cross-account or service-to-service access |\n| Credential Report | AWS-generated CSV listing all IAM users, their access keys, MFA status, and last activity timestamps |\n| Policy Condition | Constraints in IAM policies that restrict when and how permissions apply, such as MFA requirements or IP ranges |\n| Identity Federation | Allowing external identity providers to grant temporary AWS access without creating IAM users |\n\n## Tools & Systems\n\n- **AWS IAM Access Analyzer**: Generates least-privilege policies from CloudTrail activity and identifies resources shared with external entities\n- **AWS Config**: Continuously evaluates IAM configuration compliance against managed and custom rules\n- **AWS Security Hub**: Aggregates IAM security findings from Access Analyzer, Config, and third-party tools into a unified dashboard\n- **IAM Policy Simulator**: Tests the effects of IAM policies before deployment by simulating API calls against policy evaluation logic\n- **Prowler**: Open-source AWS security assessment tool that runs over 300 checks including IAM best practices and CIS benchmark controls\n\n## Common Scenarios\n\n### Scenario: Developer Role Over-Provisioned with AdministratorAccess\n\n**Context**: A startup attached the AWS-managed AdministratorAccess policy to all developer roles for speed during early development. A security audit reveals 15 roles with full account access while developers only use S3, Lambda, and DynamoDB.\n\n**Approach**:\n1. Enable IAM Access Analyzer and generate policy recommendations based on 90 days of CloudTrail data for each role\n2. Create scoped policies allowing only the specific S3 buckets, Lambda functions, and DynamoDB tables each team accesses\n3. Attach a permission boundary denying IAM, Organizations, and billing actions\n4. Deploy the new policies in a parallel role with CloudTrail monitoring before replacing the original\n5. Remove AdministratorAccess and rotate all access keys\n\n**Pitfalls**: Replacing policies without a parallel testing period causes service disruptions. Forgetting to scope Lambda:InvokeFunction to specific function ARNs leaves lateral movement paths open.\n\n### Scenario: Rotating Compromised Access Keys Across Multiple Services\n\n**Context**: An access key is found in a public GitHub repository. The key belongs to an IAM user with S3 and EC2 permissions across three AWS accounts.\n\n**Approach**:\n1. Immediately deactivate the compromised key using `aws iam update-access-key --status Inactive`\n2. Review CloudTrail logs for all API calls made with the compromised key in the past 30 days\n3. Create a new access key for the user and update all dependent services and CI\u002FCD pipelines\n4. Delete the compromised key after confirming all services use the new credentials\n5. Migrate the workload to use IAM roles with STS temporary credentials to prevent future key exposure\n\n**Pitfalls**: Deleting the key before deactivating it prevents forensic analysis of which services relied on it. Failing to check all three accounts for unauthorized activity leaves potential backdoors undetected.\n\n## Output Format\n\n```\nIAM Security Assessment Report\n==============================\nAccount ID: 123456789012\nAssessment Date: 2025-02-23\nAnalyzer: IAM Access Analyzer + Prowler v4.3\n\nCRITICAL FINDINGS:\n[C-001] Root account has active access keys\n  - Resource: arn:aws:iam::123456789012:root\n  - Remediation: Delete root access keys, enable MFA on root\n  - CIS Benchmark: 1.4 (Ensure no root account access key exists)\n\n[C-002] IAM user 'deploy-bot' has AdministratorAccess with no MFA\n  - Resource: arn:aws:iam::123456789012:user\u002Fdeploy-bot\n  - Last Activity: 2025-02-20\n  - Remediation: Replace with IAM role, enforce MFA condition\n\nHIGH FINDINGS:\n[H-001] 3 IAM policies use wildcard Resource \"*\" with sensitive actions\n  - Policies: DevPolicy, CIPolicy, LegacyAdminPolicy\n  - Remediation: Scope resources to specific ARNs using Access Analyzer\n\n[H-002] 7 access keys older than 90 days detected\n  - Users: svc-backup, svc-monitoring, dev-alice, dev-bob, ...\n  - Remediation: Rotate keys, migrate to role-based access\n\nSUMMARY:\n  Total Findings: 14\n  Critical: 2 | High: 4 | Medium: 5 | Low: 3\n  Compliance Score: 62% (CIS AWS Foundations Benchmark v3.0)\n```\n","# Securing AWS IAM Permissions\n\n## When to Use\n\n- When onboarding new AWS accounts or workloads that require scoped IAM policies\n- When IAM Access Analyzer reports overly permissive policies or unused permissions\n- When preparing for a compliance audit requiring least privilege evidence (SOC 2, PCI-DSS)\n- When migrating from long-lived access keys to short-lived role-based credentials\n- When remediating findings from AWS Security Hub related to IAM misconfigurations\n\n**Do not use** for Azure AD or Google Cloud IAM configurations, application-level authorization logic, or federated identity provider setup (see managing-cloud-identity-with-okta).\n\n## Prerequisites\n\n- AWS account with administrative access or IAM:FullAccess permissions\n- AWS CLI v2 installed and configured with named profiles\n- AWS CloudTrail enabled for at least 90 days of API activity history\n- Familiarity with JSON-based IAM policy syntax and ARN resource notation\n\n## Workflow\n\n### Step 1: Inventory Existing IAM Entities and Policies\n\nGenerate a comprehensive inventory of all IAM users, roles, groups, and attached policies using the AWS CLI and IAM credential reports. Identify accounts with console access, programmatic access keys, and their last-used timestamps.\n\n```bash\n# Generate IAM credential report\naws iam generate-credential-report\naws iam get-credential-report --query 'Content' --output text | base64 -d > iam-report.csv\n\n# List all IAM roles and their attached policies\naws iam list-roles --query 'Roles[*].[RoleName,Arn,CreateDate]' --output table\n\n# Find users with access keys older than 90 days\naws iam list-users --query 'Users[*].UserName' --output text | while read user; do\n  aws iam list-access-keys --user-name \"$user\" \\\n    --query \"AccessKeyMetadata[?CreateDate\u003C='$(date -d '-90 days' +%Y-%m-%d)'].[UserName,AccessKeyId,Status,CreateDate]\" \\\n    --output table\ndone\n```\n\n### Step 2: Enable and Analyze IAM Access Analyzer Findings\n\nActivate IAM Access Analyzer at the organization or account level to identify resources shared externally and generate least-privilege policy recommendations based on CloudTrail activity.\n\n```bash\n# Create an Access Analyzer for the account\naws accessanalyzer create-analyzer \\\n  --analyzer-name account-analyzer \\\n  --type ACCOUNT\n\n# List active findings for external access\naws accessanalyzer list-findings \\\n  --analyzer-arn arn:aws:access-analyzer:us-east-1:123456789012:analyzer\u002Faccount-analyzer \\\n  --filter '{\"status\": {\"eq\": [\"ACTIVE\"]}}'\n\n# Generate a policy based on CloudTrail activity for a specific role\naws accessanalyzer start-policy-generation \\\n  --policy-generation-details '{\n    \"principalArn\": \"arn:aws:iam::123456789012:role\u002FAppRole\",\n    \"cloudTrailDetails\": {\n      \"trailArn\": \"arn:aws:cloudtrail:us-east-1:123456789012:trail\u002Fmanagement-trail\",\n      \"startTime\": \"2025-01-01T00:00:00Z\",\n      \"endTime\": \"2025-03-01T00:00:00Z\"\n    }\n  }'\n```\n\n### Step 3: Scope Policies to Specific Resources and Conditions\n\nReplace wildcard resource ARNs with specific resource identifiers. Add IAM policy conditions for MFA enforcement, source IP restrictions, and time-based access windows.\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"AllowS3ReadSpecificBucket\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:GetObject\",\n        \"s3:ListBucket\"\n      ],\n      \"Resource\": [\n        \"arn:aws:s3:::production-data-bucket\",\n        \"arn:aws:s3:::production-data-bucket\u002F*\"\n      ],\n      \"Condition\": {\n        \"Bool\": {\"aws:MultiFactorAuthPresent\": \"true\"},\n        \"IpAddress\": {\"aws:SourceIp\": \"10.0.0.0\u002F8\"},\n        \"DateGreaterThan\": {\"aws:CurrentTime\": \"2025-01-01T00:00:00Z\"}\n      }\n    }\n  ]\n}\n```\n\n### Step 4: Implement Permission Boundaries\n\nAttach permission boundaries to IAM roles and users to define the maximum scope of permissions an entity can receive, preventing privilege escalation even if an administrator attaches an overly permissive policy.\n\n```bash\n# Create a permission boundary policy\naws iam create-policy \\\n  --policy-name DeveloperPermissionBoundary \\\n  --policy-document file:\u002F\u002Fdeveloper-boundary.json\n\n# Attach the boundary to an IAM role\naws iam put-role-permissions-boundary \\\n  --role-name DeveloperRole \\\n  --permissions-boundary \"arn:aws:iam::123456789012:policy\u002FDeveloperPermissionBoundary\"\n```\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"AllowCommonServices\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:*\",\n        \"dynamodb:*\",\n        \"lambda:*\",\n        \"logs:*\",\n        \"cloudwatch:*\"\n      ],\n      \"Resource\": \"*\"\n    },\n    {\n      \"Sid\": \"DenyIAMChanges\",\n      \"Effect\": \"Deny\",\n      \"Action\": [\n        \"iam:CreateUser\",\n        \"iam:DeleteUser\",\n        \"iam:CreateRole\",\n        \"iam:DeleteRole\",\n        \"iam:AttachRolePolicy\",\n        \"iam:PutRolePermissionsBoundary\"\n      ],\n      \"Resource\": \"*\"\n    }\n  ]\n}\n```\n\n### Step 5: Enforce MFA and Eliminate Long-Lived Credentials\n\nRequire MFA for all human users accessing the AWS console and CLI. Migrate workloads from IAM user access keys to IAM roles with temporary credentials via STS AssumeRole.\n\n```bash\n# Enforce MFA via SCP at the organization level\naws organizations create-policy \\\n  --name RequireMFA \\\n  --type SERVICE_CONTROL_POLICY \\\n  --content '{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n      {\n        \"Sid\": \"DenyAllExceptMFA\",\n        \"Effect\": \"Deny\",\n        \"NotAction\": [\n          \"iam:CreateVirtualMFADevice\",\n          \"iam:EnableMFADevice\",\n          \"iam:ListMFADevices\",\n          \"iam:ResyncMFADevice\",\n          \"sts:GetSessionToken\"\n        ],\n        \"Resource\": \"*\",\n        \"Condition\": {\n          \"BoolIfExists\": {\"aws:MultiFactorAuthPresent\": \"false\"}\n        }\n      }\n    ]\n  }'\n\n# Deactivate unused access keys\naws iam update-access-key --user-name old-user --access-key-id AKIAEXAMPLE --status Inactive\n```\n\n### Step 6: Automate Continuous IAM Monitoring\n\nDeploy AWS Config rules and Security Hub controls to continuously evaluate IAM posture. Set up EventBridge rules to alert on high-risk IAM changes such as new root access key creation or policy modifications.\n\n```bash\n# Enable AWS Config rule for IAM password policy\naws configservice put-config-rule \\\n  --config-rule '{\n    \"ConfigRuleName\": \"iam-password-policy\",\n    \"Source\": {\n      \"Owner\": \"AWS\",\n      \"SourceIdentifier\": \"IAM_PASSWORD_POLICY\"\n    },\n    \"InputParameters\": \"{\\\"RequireUppercaseCharacters\\\":\\\"true\\\",\\\"RequireLowercaseCharacters\\\":\\\"true\\\",\\\"RequireSymbols\\\":\\\"true\\\",\\\"RequireNumbers\\\":\\\"true\\\",\\\"MinimumPasswordLength\\\":\\\"14\\\",\\\"MaxPasswordAge\\\":\\\"90\\\"}\"\n  }'\n\n# EventBridge rule to detect root account usage\naws events put-rule \\\n  --name DetectRootUsage \\\n  --event-pattern '{\n    \"detail-type\": [\"AWS API Call via CloudTrail\"],\n    \"detail\": {\n      \"userIdentity\": {\"type\": [\"Root\"]}\n    }\n  }'\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Least Privilege | Granting only the minimum permissions required for an identity to perform its function |\n| Permission Boundary | An advanced IAM feature that sets the maximum permissions an entity can have, regardless of attached policies |\n| IAM Access Analyzer | AWS service that uses automated reasoning to identify resources shared externally and generate least-privilege policies from CloudTrail activity |\n| Service Control Policy (SCP) | Organization-level policy that sets permission guardrails across all accounts in an AWS Organization |\n| Assume Role | STS operation that returns temporary security credentials for cross-account or service-to-service access |\n| Credential Report | AWS-generated CSV listing all IAM users, their access keys, MFA status, and last activity timestamps |\n| Policy Condition | Constraints in IAM policies that restrict when and how permissions apply, such as MFA requirements or IP ranges |\n| Identity Federation | Allowing external identity providers to grant temporary AWS access without creating IAM users |\n\n## Tools & Systems\n\n- **AWS IAM Access Analyzer**: Generates least-privilege policies from CloudTrail activity and identifies resources shared with external entities\n- **AWS Config**: Continuously evaluates IAM configuration compliance against managed and custom rules\n- **AWS Security Hub**: Aggregates IAM security findings from Access Analyzer, Config, and third-party tools into a unified dashboard\n- **IAM Policy Simulator**: Tests the effects of IAM policies before deployment by simulating API calls against policy evaluation logic\n- **Prowler**: Open-source AWS security assessment tool that runs over 300 checks including IAM best practices and CIS benchmark controls\n\n## Common Scenarios\n\n### Scenario: Developer Role Over-Provisioned with AdministratorAccess\n\n**Context**: A startup attached the AWS-managed AdministratorAccess policy to all developer roles for speed during early development. A security audit reveals 15 roles with full account access while developers only use S3, Lambda, and DynamoDB.\n\n**Approach**:\n1. Enable IAM Access Analyzer and generate policy recommendations based on 90 days of CloudTrail data for each role\n2. Create scoped policies allowing only the specific S3 buckets, Lambda functions, and DynamoDB tables each team accesses\n3. Attach a permission boundary denying IAM, Organizations, and billing actions\n4. Deploy the new policies in a parallel role with CloudTrail monitoring before replacing the original\n5. Remove AdministratorAccess and rotate all access keys\n\n**Pitfalls**: Replacing policies without a parallel testing period causes service disruptions. Forgetting to scope Lambda:InvokeFunction to specific function ARNs leaves lateral movement paths open.\n\n### Scenario: Rotating Compromised Access Keys Across Multiple Services\n\n**Context**: An access key is found in a public GitHub repository. The key belongs to an IAM user with S3 and EC2 permissions across three AWS accounts.\n\n**Approach**:\n1. Immediately deactivate the compromised key using `aws iam update-access-key --status Inactive`\n2. Review CloudTrail logs for all API calls made with the compromised key in the past 30 days\n3. Create a new access key for the user and update all dependent services and CI\u002FCD pipelines\n4. Delete the compromised key after confirming all services use the new credentials\n5. Migrate the workload to use IAM roles with STS temporary credentials to prevent future key exposure\n\n**Pitfalls**: Deleting the key before deactivating it prevents forensic analysis of which services relied on it. Failing to check all three accounts for unauthorized activity leaves potential backdoors undetected.\n\n## Output Format\n\n```\nIAM Security Assessment Report\n==============================\nAccount ID: 123456789012\nAssessment Date: 2025-02-23\nAnalyzer: IAM Access Analyzer + Prowler v4.3\n\nCRITICAL FINDINGS:\n[C-001] Root account has active access keys\n  - Resource: arn:aws:iam::123456789012:root\n  - Remediation: Delete root access keys, enable MFA on root\n  - CIS Benchmark: 1.4 (Ensure no root account access key exists)\n\n[C-002] IAM user 'deploy-bot' has AdministratorAccess with no MFA\n  - Resource: arn:aws:iam::123456789012:user\u002Fdeploy-bot\n  - Last Activity: 2025-02-20\n  - Remediation: Replace with IAM role, enforce MFA condition\n\nHIGH FINDINGS:\n[H-001] 3 IAM policies use wildcard Resource \"*\" with sensitive actions\n  - Policies: DevPolicy, CIPolicy, LegacyAdminPolicy\n  - Remediation: Scope resources to specific ARNs using Access Analyzer\n\n[H-002] 7 access keys older than 90 days detected\n  - Users: svc-backup, svc-monitoring, dev-alice, dev-bob, ...\n  - Remediation: Rotate keys, migrate to role-based access\n\nSUMMARY:\n  Total Findings: 14\n  Critical: 2 | High: 4 | Medium: 5 | Low: 3\n  Compliance Score: 62% (CIS AWS Foundations Benchmark v3.0)\n```\n",{"name":5,"tags":56,"author":60,"domain":39,"license":16,"version":61,"mitre_f3":62,"nist_csf":84,"subdomain":40,"description":89,"mitre_attack":90},[57,43,47,58,59],"aws-iam","access-analyzer","cloud-identity","mahipal","1.0.0",{"tactics":63,"version":65,"techniques":66},[46,64],"positioning","1.1",[67,71,74,78,81],{"id":68,"name":69,"source":70,"tactic":46},"F1006.001","Account Takeover: Exposed API Key","f3",{"id":72,"name":73,"source":70,"tactic":46},"F1006.002","Account Takeover: Exposed Login Credential",{"id":75,"name":76,"source":77,"tactic":46},"T1550.001","Use Alternate Authentication Material: Application Access Token","attack",{"id":79,"name":80,"source":77,"tactic":46},"T1110.003","Brute Force: Password Spraying",{"id":82,"name":83,"source":70,"tactic":64},"F1005.004","Account Manipulation: Change Account Details",[85,86,87,88],"PR.IR-01","ID.AM-08","GV.SC-06","DE.CM-01","Hardens AWS IAM configurations to enforce least-privilege access, covering IAM policy scoping, permission boundaries, IAM Access Analyzer integration, and credential rotation strategies. Use when reducing the blast radius of compromised AWS identities, auditing overly permissive IAM policies, or setting up permission boundaries and Access Analyzer findings review across cloud accounts.\n",[91,92,93,94,95],"T1078.004","T1530","T1537","T1580","T1003","main","54a798831d2266a3ca61ce68a7acb80b81160d57","skills\u002Fsecuring-aws-iam-permissions",4425,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills","https:\u002F\u002Fmahipal.engineer\u002FAnthropic-Cybersecurity-Skills\u002F","https:\u002F\u002Fgithub.com\u002Fmukul975","Mahipal.engineer","🔐 Cybersecurity | 💻 Dev | 📷 Street Photographer\r\n🎓 MSc | 📚 Research & AI Security","2026-08-31 12:32:44",{"source":9,"skillName":5,"commands":107,"prompt":117,"zipAvailable":118},[108,111,114],{"tool":109,"command":110},"npx","npx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill securing-aws-iam-permissions",{"tool":112,"command":113},"bunx","bunx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill securing-aws-iam-permissions",{"tool":115,"command":116},"pnpm","pnpm dlx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill securing-aws-iam-permissions","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fsecuring-aws-iam-permissions\u002FSKILL.md",true,[120,125,131],{"path":121,"resourceType":121,"resourceTypeDesc":122,"sizeBytes":123,"sourceHtmlUrl":124},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fsecuring-aws-iam-permissions\u002FLICENSE",{"path":126,"resourceType":127,"resourceTypeDesc":128,"sizeBytes":129,"sourceHtmlUrl":130},"references\u002Fapi-reference.md","REFERENCE","参考文档",2325,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fsecuring-aws-iam-permissions\u002Freferences\u002Fapi-reference.md",{"path":132,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":135,"sourceHtmlUrl":136},"scripts\u002Fagent.py","SCRIPT","脚本",7710,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fsecuring-aws-iam-permissions\u002Fscripts\u002Fagent.py",[138,167,195,226,257,288],{"skillNo":139,"name":140,"nameZh":141,"description":142,"descriptionZh":143,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":144,"categories":145,"keywords":150,"publishedAt":51},"01M6AGDM3HJXTKXX15ZZ0ZVCJ3","verifying-build-provenance-with-slsa-sigstore","SLSA 构建来源验证","Verifies artifact signatures and SLSA provenance using Sigstore's cosign (verify, verify-attestation, verify-blob-attestation) and slsa-verifier (verify-artifact), enforcing keyless OIDC builder identity and source repo against SLSA Build levels. Use in CI\u002FCD before deploying artifacts, when consuming third-party attestations, establishing a SLSA Build L3 pipeline, or confirming provenance during incident response or admission control.","使用 Sigstore 的 cosign（verify、verify-attestation、verify-blob-attestation）和 slsa-verifier（verify-artifact）验证工件签名和 SLSA 来源（provenance），强制校验 keyless OIDC 构建者身份和源仓库是否符合 SLSA Build 级别。适用于 CI\u002FCD 中部署工件前、消费第三方证明时、建立 SLSA Build L3 管道，或在事件响应或准入控制期间确认来源的场景。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fverifying-build-provenance-with-slsa-sigstore\u002FSKILL.md",[146,147],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":148,"categoryName":149,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C32Q37WAMK06SGMFC02VFP","软件供应链安全",[151,152,153,154,50,39,155,36,37,156,157,158,159,160,161,162,163,164,165,166],"sigstore","provenance","slsa","verifying build provenance with slsa sigstore","incident response","code","artifacts","ci","supply-chain","pipeline","supply-chain-security","t1195","attestation","code-signing","cosign","keyless",{"skillNo":168,"name":169,"nameZh":170,"description":171,"descriptionZh":172,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":173,"categories":174,"keywords":179,"publishedAt":51},"01M6AGDGBPWYVZ2F11GFKJ4HZ9","validating-tpm-measured-boot-attestation","TPM 测量启动验证","Verifies TPM 2.0 measured-boot integrity and remote attestation with tpm2-tools -- reading PCRs (tpm2_pcrread), replaying the boot event log, generating and checking signed quotes (tpm2_quote\u002Ftpm2_checkquote), and sealing secrets to a PCR policy. Use to confirm a system booted trusted firmware\u002Fkernel for Zero Trust device posture, detect boot-chain tampering via PCR drift, or build a golden-value baseline for fleet attestation.","使用 tpm2-tools 验证 TPM 2.0 测量启动（measured boot）的完整性和远程证明：读取 PCR（tpm2_pcrread）、重放启动事件日志、生成并检查签名报价（tpm2_quote\u002Ftpm2_checkquote），以及将机密封印（seal）到 PCR 策略。适用于确认系统已启动可信固件\u002F内核以实现零信任（Zero Trust）设备状态、通过 PCR 漂移检测启动链篡改，或构建黄金值基线用于机群（fleet）证明。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fvalidating-tpm-measured-boot-attestation\u002FSKILL.md",[175,176],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":177,"categoryName":178,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C89JJEXGGRGHS6XVXDA46K","终端安全加固",[180,163,181,182,50,42,39,37,183,184,185,186,187,188,189,190,191,192,193,194],"boot","TPM","validating tpm measured boot attestation","verification","ZeRO","firmware","Tools","measured-boot","PCR","integrity","secrets","remote-attestation","tpm2-tools","integrity-verification","trusted-computing",{"skillNo":196,"name":197,"nameZh":198,"description":199,"descriptionZh":200,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":201,"categories":202,"keywords":209,"publishedAt":51},"01M6AGDCW0Y4FXZ3362GT1941M","validating-backup-integrity-for-recovery","备份完整性验证","Validates backup integrity through cryptographic hash verification, automated restore testing, corruption detection, and recoverability checks to confirm backups are reliable for disaster recovery and ransomware response. Use before relying on backups for recovery, when building post-backup validation pipelines, auditing backup infrastructure for compliance, or checking immutable\u002Fair-gapped backups for silent corruption or tampering.","通过加密哈希验证、自动化恢复测试、损坏检测和可恢复性检查来验证备份完整性，确认备份对于灾难恢复和勒索软件响应是可靠的。适用于在依赖备份进行恢复之前、构建备份后验证管道、审计备份基础设施以满足合规要求，或检查不可变\u002Fair-gapped（气隙）备份是否存在静默损坏或篡改的场景。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fvalidating-backup-integrity-for-recovery\u002FSKILL.md",[203,206],{"categoryNo":204,"categoryName":205,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD4WETX0HM3SM9QKQ15B","SRE 工程师",{"categoryNo":207,"categoryName":208,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BSSTY86MWS6W5GDQWB1ADQ","备份与灾难恢复",[189,210,211,212,213,39,214,215,183,216,217,218,219,220,221,45,222,223,224,225],"backup","recovery","validating backup integrity for recovery","testing","infrastructure","validation","compliance","hash-verification","incident-response","ransomware","cryptocurrency","detection","t1490","immutable","disaster-recovery","restore-testing",{"skillNo":227,"name":228,"nameZh":229,"description":230,"descriptionZh":231,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":232,"categories":233,"keywords":238,"publishedAt":51},"01M6AGD9GBG2KZ336AE763J3WH","triaging-windows-with-kape","KAPE Windows 取证收集","Runs KAPE (Kroll Artifact Parser and Extractor) to collect targeted forensic artifacts (registry hives, $MFT, event logs, prefetch, browser data) via Targets and parse them with Modules wrapping Eric Zimmerman's EZ Tools (PECmd, MFTECmd, RECmd). Use during early incident containment\u002Ftriage when full disk imaging is impractical but a defensible, parseable Windows artifact set is needed quickly, including at-scale remote collection.","运行 KAPE（Kroll Artifact Parser and Extractor），通过 Targets 收集目标取证工件（注册表配置单元、$MFT、事件日志、prefetch、浏览器数据），并使用封装 Eric Zimmerman 的 EZ Tools（PECmd、MFTECmd、RECmd）的 Modules 进行解析。适用于事件遏制\u002F分诊早期阶段——此时完整磁盘镜像不切实际，但需要快速获得可采信、可解析的 Windows 工件集，包括大规模远程收集。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-windows-with-kape\u002FSKILL.md",[234,235],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":236,"categoryName":237,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C9JZH3GWXPJ6CQG5P7J48Y","数字取证与电子证据分析",[239,240,241,39,242,243,244,245,246,247,248,249,250,251,252,253,186,254,255,256],"windows","kape","triaging windows with kape","registry","browser","logs","windows-forensics","dfir","mft","mftecmd","data","prefetch","eric-zimmerman","digital-forensics","SET","collection","pecmd","artifact-collection",{"skillNo":258,"name":259,"nameZh":260,"description":261,"descriptionZh":262,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":263,"categories":264,"keywords":269,"publishedAt":51},"01M6AGD5PW5J4EVZM958WD74ZQ","triaging-vulnerabilities-with-ssvc-framework","SSVC 漏洞优先级分诊","Triages and prioritizes vulnerabilities with CISA's Stakeholder-Specific Vulnerability Categorization (SSVC) decision tree, weighing exploitation status (via the CISA KEV catalog and FIRST EPSS API), technical impact, automatability, and mission prevalence to output Track\u002FTrack*\u002FAttend\u002FAct decisions. Use when prioritizing vulnerability scan results (OpenVAS, Nessus, Qualys) for remediation planning beyond raw CVSS scores.","使用 CISA 的 Stakeholder-Specific Vulnerability Categorization（SSVC，利益相关方特定漏洞分类）决策树对漏洞进行分诊和优先级排序，权衡利用状态（通过 CISA KEV 目录和 FIRST EPSS API）、技术影响、自动化程度和任务普遍性，输出 Track\u002FTrack*\u002FAttend\u002FAct 决策。适用于对漏洞扫描结果（OpenVAS、Nessus、Qualys）进行优先级排序以制定修复计划，而不局限于原始 CVSS 分数的场景。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-vulnerabilities-with-ssvc-framework\u002FSKILL.md",[265,268],{"categoryNo":266,"categoryName":267,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQV98CYQ7TEW2D1MRQ00TE","安全公告与漏洞管理",{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},[270,271,272,39,273,274,275,276,277,278,279,280,281,282,283,284,49,285,286,287],"vulnerabilities","framework","triaging vulnerabilities with ssvc framework","status","planning","CISA","vulnerability-management","risk-management","nessus","qualys","openvas","cvss","remediation","risk","vulnerability","prioritization","ssvc","decision-tree",{"skillNo":289,"name":290,"nameZh":291,"description":292,"descriptionZh":293,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":294,"categories":295,"keywords":300,"publishedAt":51},"01M6AGD24TTQQM4CXG69E3B9TJ","triaging-security-incident","安全事件初步分诊","Performs initial triage of security incidents using the NIST SP 800-61r3 and SANS PICERL frameworks, classifying incident type, assigning priority by business impact, and routing to the appropriate response team. Use when a SIEM\u002FEDR alert needs human classification, concurrent alerts must be prioritized, or a user report or threat-intel IOC match requires initial incident categorization.","使用 NIST SP 800-61r3 和 SANS PICERL 框架对安全事件进行初步分诊，分类事件类型、按业务影响分配优先级，并路由到相应的响应团队。适用于 SIEM\u002FEDR 告警需要人工分类、并发告警必须确定优先级，或用户报告或威胁情报 IOC 匹配需要初步事件分类的场景。","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-security-incident\u002FSKILL.md",[296,297],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":298,"categoryName":299,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BTHYSJPJ500X64JJ5CH06D","安全事件响应与威胁狩猎",[50,301,39,302,303,304,305,306,307,308,309,45,310,222,311,312,313,314,315,316],"triaging security incident","siem","file","ioc","soc","NIST-800-61","NIST","severity","edr","execution","analysis","classification","severity-classification","incident-triage","SANS-PICERL","SOC-operations"]