Translated ['src/pentesting-cloud/aws-security/aws-post-exploitation/aws

This commit is contained in:
Translator
2025-10-23 21:53:23 +00:00
parent 3c6bac7dbd
commit 9bf761d863

View File

@@ -0,0 +1,44 @@
# AWS MWAA Execution Role Account Wildcard भेद्यता
## भेद्यता
MWAA का execution role (वह IAM role जिसे Airflow workers AWS resources तक पहुँचने के लिए उपयोग करते हैं) को काम करने के लिए यह अनिवार्य नीति चाहिए:
```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-`. यह आवश्यक है क्योंकि AWS MWAA के internal queues को एक अलग AWS-managed खाते में provision करता है। `airflow-celery-` prefix वाले queues बनाने पर कोई प्रतिबन्ध नहीं है।
**Cannot be fixed:** pre-deployment में wildcard हटाने से MWAA पूरी तरह टूट जाएगा — scheduler वर्कर्स के लिए tasks को queue नहीं कर पाएगा।
Documentation Verifying Vuln and Acknowledging Vectorr: [AWS Documentation](https://docs.aws.amazon.com/mwaa/latest/userguide/mwaa-create-role.html)
## Exploitation
All Airflow DAGs run with the execution role's permissions. DAGs Python scripts हैं जो arbitrary code execute कर सकते हैं - वे `yum` या `curl` का उपयोग करके tools install कर सकते हैं, malicious scripts डाउनलोड कर सकते हैं, या कोई भी Python library import कर सकते हैं। DAGs को assigned S3 folder से pull किया जाता है और schedule पर automatically चलाया जाता है; एक attacker को केवल उस bucket path पर PUT करने की क्षमता चाहिए।
Anyone who can write DAGs (typically most users in MWAA environments) can abuse this permission:
1. **Data Exfiltration**: external account में `airflow-celery-exfil` नाम का queue बनाएं, और एक DAG लिखें जो `boto3` के माध्यम से संवेदनशील डेटा उसे भेजे।
2. **Command & Control**: एक external queue से commands poll करें, उन्हें execute करें, परिणाम वापस भेजें — SQS APIs के माध्यम से एक persistent backdoor बनाते हुए।
3. **Cross-Account Attacks**: यदि अन्य organizations के queues naming pattern का पालन करते हैं तो उनमें malicious messages inject करें।
ये सभी attacks network controls को bypass कर देते हैं क्योंकि ये सीधे इंटरनेट कनेक्शनों का उपयोग नहीं करते बल्कि AWS APIs का उपयोग करते हैं।
## Impact
यह MWAA में एक architectural flaw है जिसका कोई IAM-आधारित mitigation नहीं है। AWS documentation का पालन करने वाला हर MWAA deployment इस vulnerability से प्रभावित है।
**Network Control Bypass:** ये attacks private VPCs में भी काम करते हैं जिनमें कोई इंटरनेट access नहीं है। SQS API calls AWS के internal network और VPC endpoints का उपयोग करते हैं, पारंपरिक network security controls, firewalls, और egress monitoring को पूरी तरह bypass करते हुए। Organizations network-level controls के जरिए इस data exfiltration path का पता नहीं लगा सकते या ब्लॉक नहीं कर सकते।