AWS - GuardDuty Enum
Reading time: 11 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** पर फॉलो करें।**
- हैकिंग ट्रिक्स साझा करें, PRs को HackTricks और HackTricks Cloud गिटहब रिपोजिटरी में सबमिट करके।
GuardDuty
According to the docs: GuardDuty मशीन लर्निंग, विसंगति पहचान, नेटवर्क निगरानी, और दुर्भावनापूर्ण फ़ाइल खोज को जोड़ता है, जो AWS और उद्योग के प्रमुख तीसरे पक्ष के स्रोतों का उपयोग करके AWS पर कार्यभार और डेटा की सुरक्षा में मदद करता है। GuardDuty कई AWS डेटा स्रोतों, जैसे AWS CloudTrail इवेंट लॉग, Amazon Virtual Private Cloud (VPC) फ्लो लॉग, Amazon Elastic Kubernetes Service (EKS) ऑडिट और सिस्टम-स्तरीय लॉग, और DNS क्वेरी लॉग के बीच अरबों घटनाओं का विश्लेषण करने में सक्षम है।
Amazon GuardDuty आपके खातों के भीतर असामान्य गतिविधियों की पहचान करता है, गतिविधि की सुरक्षा प्रासंगिकता का विश्लेषण करता है, और जिस संदर्भ में इसे सक्रिय किया गया था, उसे प्रदान करता है। यह एक उत्तरदाता को यह निर्धारित करने की अनुमति देता है कि उन्हें आगे की जांच में समय बिताना चाहिए या नहीं।
अलर्ट GuardDuty कंसोल (90 दिन) और CloudWatch इवेंट्स में दिखाई देते हैं।
warning
जब एक उपयोगकर्ता GuardDuty को निष्क्रिय करता है, तो यह आपके AWS वातावरण की निगरानी करना बंद कर देगा और यह बिल्कुल भी नए निष्कर्ष उत्पन्न नहीं करेगा, और मौजूदा निष्कर्ष खो जाएंगे।
यदि आप इसे केवल रोकते हैं, तो मौजूदा निष्कर्ष बने रहेंगे।
Findings Example
- Reconnaissance: गतिविधि जो एक हमलावर द्वारा पुनः खोज का सुझाव देती है, जैसे असामान्य API गतिविधि, संदिग्ध डेटाबेस लॉगिन प्रयास, intra-VPC पोर्ट स्कैनिंग, असामान्य विफल लॉगिन अनुरोध पैटर्न, या एक ज्ञात बुरे IP से अनब्लॉक पोर्ट प्रॉबिंग।
- Instance compromise: गतिविधि जो एक इंस्टेंस समझौते का संकेत देती है, जैसे क्रिप्टोक्यूरेंसी माइनिंग, बैकडोर कमांड और कंट्रोल (C&C) गतिविधि, डोमेन जनरेशन एल्गोरिदम (DGA) का उपयोग करने वाला मैलवेयर, आउटबाउंड डिनायल ऑफ सर्विस गतिविधि, असामान्य उच्च नेटवर्क ट्रैफ़िक मात्रा, असामान्य नेटवर्क प्रोटोकॉल, ज्ञात दुर्भावनापूर्ण IP के साथ आउटबाउंड इंस्टेंस संचार, एक बाहरी IP पते द्वारा उपयोग किए गए अस्थायी Amazon EC2 क्रेडेंशियल, और DNS का उपयोग करके डेटा निकासी।
- Account compromise: खाता समझौते के संकेतक सामान्य पैटर्न में असामान्य भू-स्थान या एनोनिमाइजिंग प्रॉक्सी से API कॉल, AWS CloudTrail लॉगिंग को निष्क्रिय करने के प्रयास, खाता पासवर्ड नीति को कमजोर करने वाले परिवर्तन, असामान्य इंस्टेंस या बुनियादी ढांचे की लॉन्चिंग, असामान्य क्षेत्र में बुनियादी ढांचे की तैनाती, क्रेडेंशियल चोरी, संदिग्ध डेटाबेस लॉगिन गतिविधि, और ज्ञात दुर्भावनापूर्ण IP पते से API कॉल शामिल हैं।
- Bucket compromise: गतिविधि जो एक बकेट समझौते का संकेत देती है, जैसे क्रेडेंशियल दुरुपयोग का संकेत देने वाले संदिग्ध डेटा एक्सेस पैटर्न, एक दूरस्थ होस्ट से असामान्य Amazon S3 API गतिविधि, ज्ञात दुर्भावनापूर्ण IP पते से अनधिकृत S3 एक्सेस, और एक उपयोगकर्ता द्वारा S3 बकेट में डेटा पुनः प्राप्त करने के लिए API कॉल जो बकेट तक पहुँचने का कोई पूर्व इतिहास नहीं रखता या असामान्य स्थान से सक्रिय किया गया हो। Amazon GuardDuty लगातार AWS CloudTrail S3 डेटा घटनाओं (जैसे GetObject, ListObjects, DeleteObject) की निगरानी और विश्लेषण करता है ताकि आपके सभी Amazon S3 बकेट में संदिग्ध गतिविधि का पता लगाया जा सके।
Finding Information
Finding summary:
- Finding type
- Severity: 7-8.9 High, 4-6.9 Medium, 01-3.9 Low
- Region
- Account ID
- Resource ID
- Time of detection
- Which threat list was used
The body has this information:
- Resource affected
- Action
- Actor: Ip address, port and domain
- Additional Information
All Findings
Access a list of all the GuardDuty findings in: https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-active.html
Multi Accounts
By Invitation
You can invite other accounts to a different AWS GuardDuty account so every account is monitored from the same GuardDuty. The master account must invite the member accounts and then the representative of the member account must accept the invitation.
Via Organization
You can designate any account within the organization to be the GuardDuty delegated administrator. Only the organization management account can designate a delegated administrator.
An account that gets designated as a delegated administrator becomes a GuardDuty administrator account, has GuardDuty enabled automatically in the designated AWS Region, and also has the permission to enable and manage GuardDuty for all of the accounts in the organization within that Region. The other accounts in the organization can be viewed and added as GuardDuty member accounts associated with this delegated administrator account.
Enumeration
# Get Org config
aws guardduty list-organization-admin-accounts #Get Delegated Administrator
aws guardduty describe-organization-configuration --detector-id <id>
# Check external invitations
aws guardduty list-invitations
aws guardduty get-invitations-count
# Detector Information
aws guardduty list-detectors # 1 detector per account with GuardDuty
aws guardduty get-detector --detector-id <id> # Get detector info
aws guardduty get-master-account --detector-id <id>
# Get filters
aws guardduty list-filters --detector-id <id> # Check filters
aws guardduty get-filter --detector-id <id> --filter-name <name>
# Findings
aws guardduty list-findings --detector-id <id> # List findings
aws guardduty get-findings --detector-id <id> --finding-ids <id> # Get details about the finding
aws guardduty get-findings-statistics --detector-id <id> --finding-statistic-types <types>
# Get trusted IP addresses
aws guardduty list-ip-sets --detector-id <id>
aws guardduty get-ip-set --detector-id <id>
# Member accounts of the current AWS GuardDuty master account
aws guardduty list-members --detector-id <id>
aws guardduty get-members --detector-id <id> --account-ids <id>
aws guardduty get-member-detectors --detector-id <id> --account-ids <id>
# Continuously export its findings to an Amazon S3 bucket
aws guardduty list-publishing-destinations --detector-id <id>
# Intelligence sets that you have uploaded to GuardDuty
aws guardduty list-threat-intel-sets --detector-id <id>
aws guardduty get-threat-intel-set --detector-id <id> --threat-intel-set-id <id>
GuardDuty Bypass
General Guidance
आप जिन क्रेडेंशियल्स का उपयोग करने जा रहे हैं, उनके व्यवहार के बारे में जितना संभव हो सके जानकारी प्राप्त करने की कोशिश करें:
- उपयोग के समय
- स्थान
- उपयोगकर्ता एजेंट / सेवाएँ (यह awscli, वेबकंसोल, lambda आदि से उपयोग किया जा सकता है...)
- नियमित रूप से उपयोग की जाने वाली अनुमतियाँ
इस जानकारी के साथ, पहुँच का उपयोग करने के लिए यथासंभव समान परिदृश्य को फिर से बनाएं:
- यदि यह एक उपयोगकर्ता या एक भूमिका है जिसे एक उपयोगकर्ता द्वारा एक्सेस किया गया है, तो इसे समान घंटों में, समान भू-स्थान से (यदि संभव हो तो समान ISP और IP से) उपयोग करने की कोशिश करें
- यदि यह एक सेवा द्वारा उपयोग की जाने वाली भूमिका है, तो उसी क्षेत्र में समान सेवा बनाएं और वहां से समान समय सीमा में इसका उपयोग करें
- हमेशा इस प्रमुख द्वारा उपयोग की गई समान अनुमतियों का उपयोग करने की कोशिश करें
- यदि आपको अन्य अनुमतियों का उपयोग करने या किसी अनुमति का दुरुपयोग करने की आवश्यकता है (उदाहरण के लिए, 1.000.000 cloudtrail लॉग फ़ाइलें डाउनलोड करना) तो इसे धीरे-धीरे और AWS के साथ न्यूनतम इंटरैक्शन के साथ करें (awscli कभी-कभी लिखने से पहले कई पढ़ने वाली APIs को कॉल करता है)
Breaking GuardDuty
guardduty:UpdateDetector
इस अनुमति के साथ आप GuardDuty को निष्क्रिय कर सकते हैं ताकि अलर्ट ट्रिगर न हों।
aws guardduty update-detector --detector-id <detector-id> --no-enable
aws guardduty update-detector --detector-id <detector-id> --data-sources S3Logs={Enable=false}
guardduty:CreateFilter
इस अनुमति वाले हमलावरों के पास खोजों के स्वचालित संग्रह के लिए फ़िल्टर लागू करने की क्षमता होती है:
aws guardduty create-filter --detector-id <detector-id> --name <filter-name> --finding-criteria file:///tmp/criteria.json --action ARCHIVE
iam:PutRolePolicy
, (guardduty:CreateIPSet
|guardduty:UpdateIPSet
)
पिछले विशेषाधिकार वाले हमलावर GuardDuty की विश्वसनीय IP सूची को अपने IP पते को जोड़कर संशोधित कर सकते हैं और अलर्ट उत्पन्न करने से बच सकते हैं।
aws guardduty update-ip-set --detector-id <detector-id> --activate --ip-set-id <ip-set-id> --location https://some-bucket.s3-eu-west-1.amazonaws.com/attacker.csv
guardduty:DeletePublishingDestination
हमलावर अलर्टिंग को रोकने के लिए गंतव्य को हटा सकते हैं:
aws guardduty delete-publishing-destination --detector-id <detector-id> --destination-id <dest-id>
caution
इस प्रकाशन गंतव्य को हटाने से GuardDuty कंसोल के भीतर निष्कर्षों की पीढ़ी या दृश्यता पर कोई प्रभाव नहीं पड़ेगा। GuardDuty आपके AWS वातावरण में घटनाओं का विश्लेषण करना जारी रखेगा, संदिग्ध या अप्रत्याशित व्यवहार की पहचान करेगा, और निष्कर्ष उत्पन्न करेगा।
विशिष्ट निष्कर्ष बायपास उदाहरण
ध्यान दें कि GuardDuty निष्कर्षों की संख्या दर्जनों में है, हालाँकि, Red Teamer के रूप में इनमें से सभी का आप पर प्रभाव नहीं पड़ेगा, और जो बेहतर है, आपके पास इनमें से प्रत्येक का पूरा दस्तावेज़ीकरण है https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-active.html इसलिए कोई कार्रवाई करने से पहले एक नज़र डालें ताकि पकड़े न जाएं।
यहाँ आपके पास विशिष्ट GuardDuty निष्कर्षों के बायपास के कुछ उदाहरण हैं:
PenTest:IAMUser/KaliLinux
GuardDuty सामान्य पेनिट्रेशन परीक्षण उपकरणों से AWS API अनुरोधों का पता लगाता है और PenTest Finding को सक्रिय करता है।
यह उपयोगकर्ता एजेंट नाम द्वारा पता लगाया जाता है जो API अनुरोध में पास किया जाता है।
इसलिए, उपयोगकर्ता एजेंट को संशोधित करना GuardDuty को हमले का पता लगाने से रोकने के लिए संभव है।
इससे बचने के लिए आप botocore
पैकेज में session.py
स्क्रिप्ट से खोज कर सकते हैं और उपयोगकर्ता एजेंट को संशोधित कर सकते हैं, या AWS CLI प्रॉक्सी के रूप में Burp Suite सेट कर सकते हैं और MitM के साथ उपयोगकर्ता-एजेंट बदल सकते हैं या बस Ubuntu, Mac या Windows जैसे OS का उपयोग कर सकते हैं जो इस अलर्ट को सक्रिय होने से रोक देगा।
UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration
EC2 क्रेडेंशियल्स को मेटाडेटा सेवा से निकालना और उन्हें AWS वातावरण के बाहर उपयोग करना UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS
अलर्ट को सक्रिय करता है। इसके विपरीत, आपके EC2 इंस्टेंस से इन क्रेडेंशियल्स का उपयोग करने से UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.InsideAWS
अलर्ट सक्रिय होता है। फिर भी, एक ही खाते के भीतर दूसरे समझौता किए गए EC2 इंस्टेंस पर क्रेडेंशियल्स का उपयोग करना बिना पता चला रहता है, कोई अलर्ट नहीं उठता।
tip
इसलिए, इस अलर्ट को सक्रिय न करने के लिए मशीन के अंदर से निकाले गए क्रेडेंशियल्स का उपयोग करें जहाँ आपने उन्हें पाया।
संदर्भ
- https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-active.html
- https://docs.aws.amazon.com/guardduty/latest/ug/findings_suppression-rule.html
- https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_upload-lists.html
- https://docs.aws.amazon.com/cli/latest/reference/guardduty/delete-publishing-destination.html
- https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-ec2.html#unauthorizedaccess-ec2-torclient
- https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-iam.html#unauthorizedaccess-iam-instancecredentialexfiltrationoutsideaws
- https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-iam.html#unauthorizedaccess-iam-instancecredentialexfiltrationinsideaws
- https://docs.aws.amazon.com/whitepapers/latest/aws-privatelink/what-are-vpc-endpoints.html
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** पर फॉलो करें।**
- हैकिंग ट्रिक्स साझा करें, PRs को HackTricks और HackTricks Cloud गिटहब रिपोजिटरी में सबमिट करके।