4.4 KiB
AWS MWAA Execution Role Account Wildcard Vulnerability
{{#include ../../../../banners/hacktricks-training.md}}
कमजोरियाँ
MWAA की execution role (IAM role जो Airflow workers AWS resources तक पहुँचने के लिए उपयोग करते हैं) को कार्य करने के लिए यह अनिवार्य policy चाहिए:
{
"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 account में provision करता है। airflow-celery- prefix वाले queues बनाने पर कोई restriction नहीं है।
Cannot be fixed: प्री-डिप्लॉयमेंट में wildcard हटाने से MWAA पूरी तरह से टूट जाता है - scheduler workers के लिए tasks को queue नहीं कर पाएगा।
कमज़ोरी की पुष्टि करने और वेक्टर को स्वीकार करने वाला दस्तावेज़ीकरण: AWS Documentation
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 पर automatic चलाया जाता है; एक attacker को केवल उस bucket path पर PUT करने की ability चाहिए।
जो कोई भी DAGs लिख सकता है (आम तौर पर MWAA environments में अधिकांश users) इस permission का दुरुपयोग कर सकता है:
-
Data Exfiltration: किसी external account में
airflow-celery-exfilनाम का queue बनाएं, एक DAG लिखें जो sensitive data कोboto3के जरिए वहां भेजे -
Command & Control: external queue से commands poll करें, उन्हें execute करें, परिणाम वापस भेजें - SQS APIs के जरिए persistent backdoor बनाना
-
Cross-Account Attacks: अगर अन्य organizations भी वही naming pattern follow करते हैं तो उनके queues में malicious messages inject करें
ये सभी attacks network controls को बायपास कर देते हैं क्योंकि ये direct internet connections का उपयोग नहीं करते बल्कि AWS APIs का उपयोग करते हैं।
Impact
यह MWAA में एक आर्किटेक्चरल flaw है जिसका कोई IAM-based mitigation मौजूद नहीं है। AWS documentation का पालन करने वाला हर MWAA deployment इस vulnerability से प्रभावित है।
Network Control Bypass: ये attacks private VPCs में भी काम करते हैं जिनमें कोई internet access नहीं है। SQS API calls AWS की internal network और VPC endpoints का उपयोग करते हैं, पारंपरिक network security controls, firewalls, और egress monitoring को पूरी तरह बायपास करते हुए। Organizations network-level controls के जरिए इस data exfiltration path का पता नहीं लगा सकतीं या रोक नहीं सकतीं। {{#include ../../../../banners/hacktricks-training.md}}