AWS MWAA Execution Role Account Wildcard Vulnerability
Reading time: 3 minutes
tip
AWS 해킹 배우기 및 연습하기:
HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기:
HackTricks Training GCP Red Team Expert (GRTE)
Azure 해킹 배우기 및 연습하기:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks 지원하기
- 구독 계획 확인하기!
- **💬 Discord 그룹 또는 텔레그램 그룹에 참여하거나 Twitter 🐦 @hacktricks_live를 팔로우하세요.
- HackTricks 및 HackTricks Cloud 깃허브 리포지토리에 PR을 제출하여 해킹 트릭을 공유하세요.
취약점
MWAA의 실행 역할(Airflow workers가 AWS 리소스에 접근하기 위해 사용하는 IAM role)은 정상 작동을 위해 다음 필수 정책을 필요로 합니다:
{
"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.
Cannot be fixed: 배포 전에 와일드카드를 제거하면 MWAA가 완전히 작동 불능이 됩니다 — 스케줄러가 워커에 작업을 큐잉할 수 없습니다.
취약점 확인 및 벡터 인정 문서: AWS Documentation
Exploitation
All Airflow DAGs run with the execution role's permissions. DAGs are Python scripts that can execute arbitrary code - they can use yum or curl to install tools, download malicious scripts, or import any Python library. DAGs are pulled from an assigned S3 folder and run on schedule automatically, all an attacker needs is ability to PUT to that bucket path.
DAGs를 작성할 수 있는 누구나(일반적으로 MWAA 환경의 대부분 사용자)는 이 권한을 악용할 수 있습니다:
-
Data Exfiltration: 외부 계정에
airflow-celery-exfil이라는 큐를 생성하고,boto3를 통해 민감한 데이터를 해당 큐로 전송하는 DAG를 작성합니다. -
Command & Control: 외부 큐에서 명령을 폴링해 실행하고 결과를 반환하는 방식으로 SQS API를 통해 지속적인 백도어를 만듭니다.
-
Cross-Account Attacks: 다른 조직의 큐가 동일한 네이밍 패턴을 따르는 경우 그 큐에 악성 메시지를 주입할 수 있습니다.
모든 공격은 직접적인 인터넷 연결이 아닌 AWS APIs를 사용하기 때문에 네트워크 제어를 우회합니다.
Impact
This is an architectural flaw in MWAA with no IAM-based mitigation. Every MWAA deployment following AWS documentation has this vulnerability.
Network Control Bypass: 이 공격들은 인터넷 접근이 없는 private VPC에서도 작동합니다. SQS API 호출은 AWS의 내부 네트워크와 VPC 엔드포인트를 사용하므로 기존의 네트워크 보안 통제, 방화벽, 이그레스 모니터링을 완전히 우회합니다. 조직은 네트워크 수준의 통제로 이 데이터 유출 경로를 탐지하거나 차단할 수 없습니다.
tip
AWS 해킹 배우기 및 연습하기:
HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기:
HackTricks Training GCP Red Team Expert (GRTE)
Azure 해킹 배우기 및 연습하기:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks 지원하기
- 구독 계획 확인하기!
- **💬 Discord 그룹 또는 텔레그램 그룹에 참여하거나 Twitter 🐦 @hacktricks_live를 팔로우하세요.
- HackTricks 및 HackTricks Cloud 깃허브 리포지토리에 PR을 제출하여 해킹 트릭을 공유하세요.
HackTricks Cloud