diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-mwaa-post-exploitation/README.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-mwaa-post-exploitation/README.md new file mode 100644 index 000000000..a8bc6dfd8 --- /dev/null +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-mwaa-post-exploitation/README.md @@ -0,0 +1,42 @@ +# AWS MWAA 执行角色账户通配符漏洞 + +## 漏洞 + +MWAA 的执行角色(Airflow 工作进程用来访问 AWS 资源的 IAM 角色)需要以下强制性策略才能正常工作: +```json +{ +"Effect": "Allow", +"Action": [ +"sqs:ChangeMessageVisibility", +"sqs:DeleteMessage", +"sqs:GetQueueAttributes", +"sqs:GetQueueUrl", +"sqs:ReceiveMessage", +"sqs:SendMessage" +], +"Resource": "arn:aws:sqs:us-east-1:*:airflow-celery-*" +} +``` +The wildcard (`*`) in the account ID position allows the role to interact with **any SQS queue in any AWS account** that starts with `airflow-celery-`. This is required because AWS provisions MWAA's internal queues in a separate AWS-managed account. There is no restriction on making queues with the `airflow-celery-` prefix. + +**无法修复:** 在部署前移除通配符会完全破坏 MWAA —— 调度器无法为 workers 排队任务。 + +Documentation Verifying Vuln and Acknowledging Vectorr: [AWS Documentation](https://docs.aws.amazon.com/mwaa/latest/userguide/mwaa-create-role.html) + +## 利用 + +所有 Airflow DAGs 使用执行角色的权限运行。DAGs 是可以执行任意代码的 Python 脚本 —— 它们可以使用 `yum` 或 `curl` 安装工具、下载恶意脚本,或导入任意 Python 库。DAGs 会从指定的 S3 文件夹拉取并按计划自动运行,攻击者所需要的仅是能够对该 bucket 路径进行 PUT。 + +任何能够编写 DAGs 的人(通常是 MWAA 环境中的大多数用户)都可以滥用此权限: + +1. **数据外泄**:在外部账户创建名为 `airflow-celery-exfil` 的队列,编写一个 DAG 使用 `boto3` 将敏感数据发送到该队列 +2. **命令与控制**:从外部队列轮询命令,执行并返回结果——通过 SQS APIs 创建持续的后门 +3. **跨账户攻击**:如果其他组织的队列遵循该命名模式,则可以向其注入恶意消息 + +所有攻击都绕过网络控制,因为它们使用 AWS APIs,而不是直接的互联网连接。 + +## 影响 + +这是 MWAA 的一个架构缺陷,无法通过 IAM 解决。每个按照 AWS 文档部署的 MWAA 实例都存在此漏洞。 + +**绕过网络控制:** 即使在没有互联网访问的私有 VPC 中,这些攻击也能生效。SQS API 调用使用 AWS 的内部网络和 VPC 端点,完全绕过传统的网络安全控制、防火墙和出口监控。组织无法通过网络层面的控制检测或阻止这一数据外泄通道。