Translated ['src/pentesting-cloud/aws-security/aws-services/aws-iam-enum

This commit is contained in:
Translator
2026-02-12 12:51:18 +00:00
parent 241ed7d025
commit 6104540b30
3 changed files with 154 additions and 54 deletions
@@ -17,7 +17,7 @@
aws ses send-email --from sender@example.com --destination file://emails.json --message file://message.json
aws sesv2 send-email --from sender@example.com --destination file://emails.json --message file://message.json
```
अभी परीक्षण शेष है।
अभी परीक्षण करना बाकी है।
### `ses:SendRawEmail`
@@ -29,11 +29,11 @@ aws ses send-raw-email --raw-message file://message.json
### `ses:SendTemplatedEmail`
टेम्पलेट के आधार पर एक ईमेल भेजें।
टेम्पलेट के आधार पर ईमेल भेजें।
```bash
aws ses send-templated-email --source <value> --destination <value> --template <value>
```
अभी परीक्षण करना बाकी है
अभी परीक्षण करना बाकी।
### `ses:SendBulkTemplatedEmail`
@@ -45,13 +45,13 @@ aws ses send-bulk-templated-email --source <value> --template <value>
### `ses:SendBulkEmail`
एक ईमेल कई गंतव्यों पर भेजें।
कई गंतव्यों को एक ईमेल भेजें।
```
aws sesv2 send-bulk-email --default-content <value> --bulk-email-entries <value>
```
### `ses:SendBounce`
प्राप्त ईमेल पर एक **bounce email** भेजें (यह संकेत देता है कि ईमेल प्राप्त नहीं किया जा सक)। यह केवल ईमेल प्राप्त होने के **24h के भीतर** किया जा सकता है।
प्राप्त ईमेल पर **bounce email** भेजें (बताता है कि ईमेल प्राप्त नहीं हो सक)। यह केवल **प्राप्ति के 24h के भीतर** किया जा सकता है।
```bash
aws ses send-bounce --original-message-id <value> --bounce-sender <value> --bounced-recipient-info-list <value>
```
@@ -59,11 +59,23 @@ aws ses send-bounce --original-message-id <value> --bounce-sender <value> --boun
### `ses:SendCustomVerificationEmail`
यह कस्टमाइज़्ड सत्यापन ईमेल भेजेगा। आपको टेम्पलेट ईमेल बनाने की अनुमति भी चाहिए हो सकती है
यह एक अनुकूलित सत्यापन ईमेल भेजेगा। शायद आपको टेम्पलेट ईमेल बनाने की अनुमति भी चाहिए।
```bash
aws ses send-custom-verification-email --email-address <value> --template-name <value>
aws sesv2 send-custom-verification-email --email-address <value> --template-name <value>
```
अभी परीक्षण बाकी है।
## WorkMail pivot to bypass SES sandbox
जब `ses:GetAccount` दिखाता है कि खाता अभी भी SES sandbox में है और `ses:ListIdentities` कोई verified senders नहीं लौटाता, attackers तुरंत भेजने के लिए **pivot to WorkMail** कर सकते हैं (कोई sandbox नहीं और higher default quotas) — orgs बनाकर, domains सत्यापित करके, और mailboxes पंजीकृत करके।
{{#ref}}
../aws-workmail-post-exploitation/README.md
{{#endref}}
## संदर्भ
- [Threat Actors Using AWS WorkMail in Phishing Campaigns](https://www.rapid7.com/blog/post/dr-threat-actors-aws-workmail-phishing-campaigns)
{{#include ../../../../banners/hacktricks-training.md}}
@@ -0,0 +1,76 @@
# AWS - WorkMail Post Exploitation
{{#include ../../../../banners/hacktricks-training.md}}
## Abusing WorkMail to bypass SES sandbox
Even if SES is stuck in the **sandbox** (verified-recipient only, ~200 msgs/24h, 1 msg/s), WorkMail has no equivalent restriction. An attacker with long-term keys can spin up disposable mail infra and start sending immediately:
1. **Create a WorkMail org (region-scoped)**
```bash
aws workmail create-organization --region us-east-1 --alias temp-mail --directory-id <dir-id-if-reusing>
```
2. **Verify attacker-controlled domains** (WorkMail invokes SES APIs as `workmail.amazonaws.com`):
```bash
aws ses verify-domain-identity --domain attacker-domain.com
aws ses verify-domain-dkim --domain attacker-domain.com
```
3. **Provision mailbox users** and register them:
```bash
aws workmail create-user --organization-id <org-id> --name marketing --display-name "Marketing"
aws workmail register-to-work-mail --organization-id <org-id> --entity-id <user-id> --email marketing@attacker-domain.com
```
Notes:
- AWS द्वारा दस्तावेजीकृत डिफ़ॉल्ट **recipient cap**: **100,000 external recipients/day per org** (users के बीच समेकित)।
- डोमेन वेरिफिकेशन गतिविधि CloudTrail में SES के अंतर्गत दिखाई देगी लेकिन **`invokedBy`: `workmail.<region>.amazonaws.com`** के साथ, इसलिए SES वेरिफिकेशन इवेंट्स SES कैंपेन के बजाय WorkMail सेटअप से संबंधित हो सकते हैं।
- WorkMail मेलबॉक्स उपयोगकर्ता IAM उपयोगकर्ताओं से स्वतंत्र **application-layer persistence** बन जाते हैं।
## Sending paths & telemetry gaps
### Web client (WorkMail UI)
- CloudTrail में **`ses:SendRawEmail`** इवेंट्स के रूप में भेजा जाता है।
- `userIdentity.type` = `AWSService`, `invokedBy/sourceIPAddress/userAgent` = `workmail.<region>.amazonaws.com`, इसलिए **वास्तविक client IP छुपा होता है**
- `requestParameters` अभी भी sender को leak करते हैं (`source`, `fromArn`, `sourceArn`, configuration set) ताकि इन्हें newly verified domains/mailboxes के साथ correlate किया जा सके।
### SMTP (stealthiest)
- Endpoint: `smtp.mail.<region>.awsapps.com:465` (SMTP over SSL) मेलबॉक्स पासवर्ड के साथ।
- **No CloudTrail data events** SMTP डिलीवरी के लिए जनरेट नहीं होते, भले ही SES डेटा इवेंट्स एनेबल हों।
- आदर्श डिटेक्शन पॉइंट्स हैं **org/domain/user provisioning** और SES identity ARNs जो बाद के web-sent `SendRawEmail` इवेंट्स में रेफरेंस होते हैं।
<details>
<summary>WorkMail के माध्यम से SMTP भेजने का उदाहरण</summary>
```python
import smtplib
from email.message import EmailMessage
SMTP_SERVER = "smtp.mail.us-east-1.awsapps.com"
SMTP_PORT = 465
EMAIL_ADDRESS = "marketing@attacker-domain.com"
EMAIL_PASSWORD = "SuperSecretPassword!"
target = "victim@example.com" # can be unverified/external
msg = EmailMessage()
msg["Subject"] = "WorkMail SMTP"
msg["From"] = EMAIL_ADDRESS
msg["To"] = target
msg.set_content("Delivered via WorkMail SMTP")
with smtplib.SMTP_SSL(SMTP_SERVER, SMTP_PORT) as smtp:
smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD)
smtp.send_message(msg)
```
</details>
## पहचान संबंधी विचार
- यदि WorkMail अनावश्यक है, तो इसे संगठन स्तर पर **SCPs** (`workmail:*` deny) के माध्यम से ब्लॉक करें।
- प्रोविज़निंग पर अलर्ट रखें: `workmail:CreateOrganization`, `workmail:CreateUser`, `workmail:RegisterToWorkMail`, और SES सत्यापन जिनमें `invokedBy=workmail.amazonaws.com` (`ses:VerifyDomainIdentity`, `ses:VerifyDomainDkim`) शामिल हैं।
- असामान्य **`ses:SendRawEmail`** ईवेंट्स पर नजर रखें जहाँ identity ARNs नए डोमेन को संदर्भित करते हैं और source IP/UA `workmail.<region>.amazonaws.com` के बराबर होता है।
## References
- [Threat Actors Using AWS WorkMail in Phishing Campaigns](https://www.rapid7.com/blog/post/dr-threat-actors-aws-workmail-phishing-campaigns)
- [AWS WorkMail limits](https://docs.aws.amazon.com/workmail/latest/adminguide/limits.html)
{{#include ../../../../banners/hacktricks-training.md}}
@@ -1,20 +1,20 @@
# AWS - IAM, पहचान केंद्र और SSO Enum
# AWS - IAM, Identity Center & SSO एन्यूमरेशन
{{#include ../../../banners/hacktricks-training.md}}
## IAM
आप IAM का **विवरण** यहाँ पा सकते हैं:
आप **IAM का विवरण** यहाँ पा सकते हैं:
{{#ref}}
../aws-basic-information/
{{#endref}}
### Enumeration
### एन्यूमरेशन
मुख्य अनुमतियाँ आवश्यक हैं:
आवश्यक मुख्य अनुमतियाँ:
- `iam:ListPolicies`, `iam:GetPolicy` और `iam:GetPolicyVersion`
- `iam:ListPolicies`, `iam:GetPolicy` and `iam:GetPolicyVersion`
- `iam:ListRoles`
- `iam:ListUsers`
- `iam:ListGroups`
@@ -22,9 +22,9 @@
- `iam:ListAttachedUserPolicies`
- `iam:ListAttachedRolePolicies`
- `iam:ListAttachedGroupPolicies`
- `iam:ListUserPolicies` और `iam:GetUserPolicy`
- `iam:ListGroupPolicies` और `iam:GetGroupPolicy`
- `iam:ListRolePolicies` और `iam:GetRolePolicy`
- `iam:ListUserPolicies` and `iam:GetUserPolicy`
- `iam:ListGroupPolicies` and `iam:GetGroupPolicy`
- `iam:ListRolePolicies` and `iam:GetRolePolicy`
```bash
# All IAMs
## Retrieves information about all IAM users, groups, roles, and policies
@@ -88,37 +88,49 @@ aws iam get-account-password-policy
aws iam list-mfa-devices
aws iam list-virtual-mfa-devices
```
### Stealth permission confirmation — जानबूझकर विफलताओं के माध्यम से
जब `List*` या simulator APIs ब्लॉक हों, तो आप पूर्वानुमेय validation त्रुटियों को जबरदस्ती उत्पन्न करके **परिवर्तनकारी अनुमतियाँ बिना स्थायी संसाधन बनाए पुष्टि कर सकते हैं।** AWS इन त्रुटियों को वापस करने से पहले IAM का मूल्यांकन करता है, इसलिए त्रुटि देखना यह साबित करता है कि कॉलर के पास वह action है:
```bash
# Confirm iam:CreateUser without creating a new principal (fails only after authz)
aws iam create-user --user-name <existing_user> # -> EntityAlreadyExistsException
# Confirm iam:CreateLoginProfile while learning password policy requirements
aws iam create-login-profile --user-name <target_user> --password lower --password-reset-required # -> PasswordPolicyViolationException
```
These attempts still generate CloudTrail events (with `errorCode` set) but avoid leaving new IAM artifacts, making them useful for **low-noise permission validation** during interactive recon.
### Permissions Brute Force
यदि आप अपनी अनुमतियों में रुचि रखते हैं लेकिन आपके पास IAM को क्वेरी करने का एक्सेस नहीं है, तो आप हमेशा उन्हें ब्रूट-फोर्स कर सकते हैं।
यदि आप अपनी स्वयं की permissions में रुचि रखते हैं लेकिन IAM को query करने का access नहीं है, तो आप उन्हें हमेशा brute-force कर सकते हैं।
#### bf-aws-permissions
टूल [**bf-aws-permissions**](https://github.com/carlospolop/bf-aws-permissions) बस एक बैश स्क्रिप्ट है जो निर्दिष्ट प्रोफ़ाइल का उपयोग करके सभी **`list*`, `describe*`, `get*`** क्रियाएँ चलाएगी जो इसे `aws` cli सहायता संदेशों का उपयोग करके मिल सकती हैं और **सफल कार्यान्वयन** लौटाएगी
यह टूल [**bf-aws-permissions**](https://github.com/carlospolop/bf-aws-permissions) सिर्फ़ एक bash script है जो निर्दिष्ट profile का उपयोग करके aws cli के help messages में मिलने वाली सभी **`list*`, `describe*`, `get*`** actions चलाएगा और **सफल निष्पादनों को वापस करेगा**
```bash
# Bruteforce permissions
bash bf-aws-permissions.sh -p default > /tmp/bf-permissions-verbose.txt
```
#### bf-aws-perms-simulate
उपकरण [**bf-aws-perms-simulate**](https://github.com/carlospolop/bf-aws-perms-simulate) आपकी वर्तमान अनुमति (या अन्य प्रिंसिपलों की) को ढूंढ सकता है यदि आपके पास अनुमति **`iam:SimulatePrincipalPolicy`** है।
यह टूल [**bf-aws-perms-simulate**](https://github.com/carlospolop/bf-aws-perms-simulate) आपकी वर्तमान अनुमति (या अन्य principals की अनुमति) पता लगा सकता है अगर आपके पास अनुमति **`iam:SimulatePrincipalPolicy`** है।
```bash
# Ask for permissions
python3 aws_permissions_checker.py --profile <AWS_PROFILE> [--arn <USER_ARN>]
```
#### Perms2ManagedPolicies
यदि आपने **कुछ अनुमतियाँ पाई हैं जो आपके उपयोगकर्ता के पास हैं**, और आप सोचते है कि **प्रबंधित AWS भूमिका** द्वारा दी जा रही हैं (और किसी कस्टम द्वारा नहीं)। आप टूल [**aws-Perms2ManagedRoles**](https://github.com/carlospolop/aws-Perms2ManagedPolicies) का उपयोग कर सकते हैं यह जांचने के लिए कि **AWS प्रबंधित भूमिकाएँ कौन सी हैं जो उन अनुमतियों को प्रदान करत हैं जो आपने खोजी हैं कि आपे पा है**
यदि आपने **कुछ अनुमतियाँ जो आपके यूजर के पास हैं** पाई हैं, और आपको लगता है कि किसी **managed AWS role** (और किसी custom role से नहीं) द्वारा दी जा रही हैं, तो आप टूल [**aws-Perms2ManagedRoles**](https://github.com/carlospolop/aws-Perms2ManagedPolicies) का उपयोग करके उन सभी **AWS managed roles** की जाँच कर सकते हैं जो उन अनुमतियों को प्रदान करत हैं जिन्हें आपे पाया है।
```bash
# Run example with my profile
python3 aws-Perms2ManagedPolicies.py --profile myadmin --permissions-file example-permissions.txt
```
> [!WARNING]
> यह "जानना" संभव है कि आपके पास जो अनुमतियाँ हैं वे AWS प्रबंधित भूमिका द्वारा दी गई हैं यदि आप देखते हैं कि **आपके पास उन सेवाओं पर अनुमतियाँ हैं जो उपयोग नहीं की जाती हैं** उदाहरण के लिए
> यह संभव है कि आप "जान" सकें कि जो अनुमतियाँ आपके पास हैं वे एक AWS managed role द्वारा प्रदान की गई हैं, अगर आप उदाहरण के लिए देखते हैं कि **आपके पास उन सेवाओं पर अनुमतियाँ हैं जो उपयोग नहीं हो रही हैं**।
#### Cloudtrail2IAM
[**CloudTrail2IAM**](https://github.com/carlospolop/Cloudtrail2IAM) एक Python उपकरण है जो **AWS CloudTrail लॉग का विश्लेषण करता है ताकि सभी या केवल एक विशिष्ट उपयोगकर्ता या भूमिका द्वारा किए गए कार्यों को निकाला और संक्षेपित किया जा सके**। यह उपकरण **निर्दिष्ट बकेट से हर क्लाउडट्रेल लॉग को पार्स करेगा**
[**CloudTrail2IAM**](https://github.com/carlospolop/Cloudtrail2IAM) एक Python टूल है जो **AWS CloudTrail logs का विश्लेषण करके सभी या किसी विशिष्ट उपयोगकर्ता/भूमिका द्वारा किए गए कार्यों को निकाला और सारांशित करता है**। यह टूल संकेत किए गए bucket से **हर cloudtrail log को पार्स करेगा**
```bash
git clone https://github.com/carlospolop/Cloudtrail2IAM
cd Cloudtrail2IAM
@@ -126,16 +138,16 @@ pip install -r requirements.txt
python3 cloudtrail2IAM.py --prefix PREFIX --bucket_name BUCKET_NAME --profile PROFILE [--filter-name FILTER_NAME] [--threads THREADS]
```
> [!WARNING]
> यदि आप .tfstate (Terraform स्थिति फ़ाइलें) या CloudFormation फ़ाइलें (ये आमतौर पर एक बकेट के अंदर cf-templates उपसर्ग के साथ स्थित yaml फ़ाइलें होती हैं) पाते हैं, तो आप न्हें aws कॉन्फ़िगरेशन खोजने और यह पता लगाने के लिए भी पढ़ सकते हैं कि किसे कौन सी अनुमतियाँ दी गई हैं।
> यदि आपको .tfstate (Terraform state files) या CloudFormation फ़ाइलें (ये आमतौर पर किसी bucket के अंदर cf-templates प्रीफ़िक्स वाली yaml फ़ाइलें होती हैं) मिलती हैं, तो आप न्हें पढ़कर aws कॉन्फ़िगरेशन और पता कर सकते हैं कि किसे कौन-कौन सी permissions आवंटित की गई हैं।
#### enumerate-iam
इस टूल [**https://github.com/andresriancho/enumerate-iam**](https://github.com/andresriancho/enumerate-iam) का उपयोग करने के लिए, आपको पहले सभी API AWS एंडपॉइंट्स डाउनलोड करने की आवश्यकता है, जिनमें से स्क्रिप्ट **`generate_bruteforce_tests.py`** सभी **"list\_", "describe\_", और "get\_" एंडपॉइंट्स प्राप्त करेगी।** और अंत में, यह दिए गए क्रेडेंशियल्स के साथ **उन्हें एक्सेस करने की कोशिश करेगी** और **यह बताएगी कि क्या यह सफल रहा।**
To use the tool [**https://github.com/andresriancho/enumerate-iam**](https://github.com/andresriancho/enumerate-iam) you first need to download all the API AWS endpoints, from those the script **`generate_bruteforce_tests.py`** will get all the **"list\_", "describe\_", and "get\_" endpoints.** And finally, it will try to **access them** with the given credentials and **indicate if it worked**.
(मेरे अनुभव में **यह टूल किसी बिंदु पर लटक जाता है**, [**इस फिक्स को देखें**](https://github.com/andresriancho/enumerate-iam/pull/15/commits/77ad5b41216e3b5f1511d0c385da8cd5984c2d3c) इसे ठीक करने के लिए प्रयास करने के लिए)।
(मेरे अनुभव में **tool कुछ बिंदु पर hang कर जाता है**, [**checkout this fix**](https://github.com/andresriancho/enumerate-iam/pull/15/commits/77ad5b41216e3b5f1511d0c385da8cd5984c2d3c) ताकि इसे ठीक करने की कोशिश की जा सके)।
> [!WARNING]
> मेरे अनुभव में यह टूल पिछले वाले की तरह है लेकिन खराब काम कर रहा है और कम अनुमतियों की जांच कर रहा है।
> मेरे अनुभव में यह tool पिछले वाले जैसा ही है पर कम प्रभावी रूप से काम करा है और कम permissions चेक करता है।
```bash
# Install tool
git clone git@github.com:andresriancho/enumerate-iam.git
@@ -154,7 +166,7 @@ python3 enumerate-iam.py --access-key ACCESS_KEY --secret-key SECRET_KEY [--sess
```
#### weirdAAL
आप टूल [**weirdAAL**](https://github.com/carnal0wnage/weirdAAL/wiki) का भी उपयोग कर सकते हैं। यह टूल **कई सामान्य सेवाओं पर कई सामान्य ऑपरेशनों की जांच करेगा** (कुछ enumeration अनुमतियों और कुछ privesc अनुमतियों की भी जांच करेगा)। लेकिन यह केवल कोडेड जांचों की जांच करेगा (अधिक चीजों की जांच करने का एकमात्र तरीका अधिक परीक्षण कोड करना है)।
आप [**weirdAAL**](https://github.com/carnal0wnage/weirdAAL/wiki) टूल का भी उपयोग कर सकते हैं। यह टूल **कई सामान्य ऑपरेशन्स कई सामान्य सेवाओं पर** जांच करेगा (यह कुछ enumeration permissions और कुछ privesc permissions भी जांचेगा)। लेकिन यह केवल coded checks को ही जांचेगा (अधिक चीज़ें जांचने का एकमात्र तरीका है कि आप और टेस्ट कोड करें)।
```bash
# Install
git clone https://github.com/carnal0wnage/weirdAAL.git
@@ -178,7 +190,7 @@ python3 weirdAAL.py -m recon_all -t MyTarget # Check all permissions
# [+] elbv2 Actions allowed are [+]
# ['DescribeLoadBalancers', 'DescribeAccountLimits', 'DescribeTargetGroups']
```
#### BF अनुमतियों को मजबूत करने के उपकरण
#### BF permissions के लिए हार्डनिंग टूल्स
{{#tabs }}
{{#tab name="CloudSploit" }}
@@ -208,43 +220,43 @@ steampipe dashboard
#### \<YourTool>
पिछले किसी भी उपकरण में सभी अनुमतियों की जाच करने की क्षमता नहीं है, इसलिए यदि आप क बेहतर उपकरण जानते हैं तो PR भेजें!
पिछलों में से कोई भी टूल सभी permissions की जाच करने में सक्षम नहीं है, इसलिए अगर आप किसी बेहतर टूल को जानते हैं तो एक PR भेजें!
### अनधिकृत पहुंच
### Unauthenticated Access
{{#ref}}
../aws-unauthenticated-enum-access/aws-iam-and-sts-unauthenticated-enum/README.md
{{#endref}}
### विशेषाधिकार वृद्धि
### Privilege Escalation
अगली पृष्ठ पर आप **IAM अनुमतियों का दुरुपयोग करके विशेषाधिकार बढ़ाने** का तरीका देख सकते हैं:
निम्नलिखित पृष्ठ में आप देख सकते हैं कि कैसे **abuse IAM permissions to escalate privileges**:
{{#ref}}
../aws-privilege-escalation/aws-iam-privesc/README.md
{{#endref}}
### IAM पोस्ट एक्सप्लोइटेशन
### IAM Post Exploitation
{{#ref}}
../aws-post-exploitation/aws-iam-post-exploitation/README.md
{{#endref}}
### IAM स्थिरता
### IAM Persistence
{{#ref}}
../aws-persistence/aws-iam-persistence/README.md
{{#endref}}
## IAM पहचान केंद्र
## IAM Identity Center
आप **IAM पहचान केंद्र का विवरण** यहाँ पा सकते हैं:
आप **IAM Identity Center का विवरण** निम्न में पा सकते हैं:
{{#ref}}
../aws-basic-information/
{{#endref}}
### CLI के साथ SSO के माध्यम से कनेक्ट करें
### Connect via SSO with CLI
```bash
# Connect with sso via CLI aws configure sso
aws configure sso
@@ -255,18 +267,18 @@ sso_account_id = <account_numbre>
sso_role_name = AdministratorAccess
sso_region = us-east-1
```
### Enumeration
### सूचीकरण
Identity Center के मुख्य तत्व हैं:
Identity Center के मुख्य घटक हैं:
- उपयोगकर्ता और समूह
- अनुमति सेट: नीतियाँ संलग्न हैं
- AWS खाते
- Permission Sets: नीतियाँ संलग्न होती हैं
- AWS Accounts
फिर, संबंध बनाए जाते हैं ताकि उपयोगकर्ता/समूहों के पास AWS खाते पर अनुमति सेट हो।
फिर, संबंध बनाए जाते हैं ताकि उपयोगकर्ताओं/समूहों के पास AWS Account पर Permission Sets हो
> [!NOTE]
> ध्यान दें कि अनुमति सेट पर नीतियाँ संलग्न करने के 3 तरीके हैं। AWS प्रबंधित नीतियाँ संलग्न करना, ग्राहक प्रबंधित नीतियाँ (ये नीतियाँ उन सभी खातों में बनाई जानी चाहिए जिन पर अनुमति सेट प्रभाव डाल रहा है), और इनलाइन नीतियाँ (जो वहा परिभाषित हैं)।
> ध्यान दें कि Permission Set में नीतियाँ संलग्न करने के 3 तरीके होते हैं। AWS managed policies अटैच करना, Customer managed policies (इन नीतियों को उन सभी accounts में बनाना होगा जिन पर Permission Set प्रभाव डाल रहा है), और inline policies (जो वहां पर परिभाषित होती हैं)।
```bash
# Check if IAM Identity Center is used
aws sso-admin list-instances
@@ -302,7 +314,7 @@ aws identitystore list-group-memberships-for-member --identity-store-id <store-i
```
### Local Enumeration
यह संभव है कि `$HOME/.aws` फ़ोल्डर के अंदर config फ़ाइल बनाई जाए ताकि उन प्रोफाइलों को कॉन्फ़िगर किया जा सके जो SSO के माध्यम से सुलभ हैं, उदाहरण के लिए:
आप `$HOME/.aws` फ़ोल्डर के अंदर config फ़ाइल बना कर SSO के माध्यम से एक्सेस किए जा सकने वाले profiles कॉन्फ़िगर कर सकते हैं, उदाहरण के लिए:
```ini
[default]
region = us-west-2
@@ -320,16 +332,16 @@ output = json
role_arn = arn:aws:iam::<acc-id>:role/ReadOnlyRole
source_profile = Hacktricks-Admin
```
यह कॉन्फ़िगरेशन निम्नलिखित कमांड के साथ उपयोग किया जा सकता है:
इस कॉन्फ़िगरेशन का उपयोग इन कमांड्स के साथ किया जा सकता है:
```bash
# Login in ms-sso-profile
aws sso login --profile my-sso-profile
# Use dependent-profile
aws s3 ls --profile dependent-profile
```
जब **SSO से प्रोफ़ाइल का उपयोग किया जाता है** किसी जानकारी तक पहुँचने के लिए, तो क्रेडेंशियल्स **एक फ़ाइल में कैश** किए जाते हैं जो फ़ोल्डर **`$HOME/.aws/sso/cache`** के अंदर हती है। इसलिए न्हें **वहाँ से पढ़ा और उपयोग किया जा सकता है**
जब किसी जानकारी तक पहुँचने के लिए **profile from SSO is used**, तो credentials फ़ाइल में **cached** होते हैं जो फ़ोल्डर **`$HOME/.aws/sso/cache`** के अंदर हती है। इसलिए न्हें **read and used from there** किया जा सकता है।
इसके अलावा, **अधिक क्रेडेंशियल्स** फ़ोल्डर **`$HOME/.aws/cli/cache`** में संग्रहीत किए जा सकत हैं। यह कैश निर्देशिका मुख्य रूप से तब उपयोग की जाती है जब आप **AWS CLI प्रोफाइल के साथ काम कर रहे हैं** जो IAM उपयोगकर्ता क्रेडेंशियल्स का उपयोग करते हैं या IAM के माध्यम से **रोल्स को असुम** करते हैं (बिना SSO के)। कॉन्फ़िग उदाहरण:
इसके अलावा, **more credentials** फ़ोल्डर **`$HOME/.aws/cli/cache`** में संग्रहीत क जा सकत हैं। यह cache directory मुख्य रूप से तब उपयोग में आती है जब आप **working with AWS CLI profiles** हैं जो IAM user credentials का उपयोग करते हैं या IAM के माध्यम से रोल **assume** करते हैं (बिना SSO)। Config example:
```ini
[profile crossaccountrole]
role_arn = arn:aws:iam::234567890123:role/SomeRole
@@ -337,36 +349,36 @@ source_profile = default
mfa_serial = arn:aws:iam::123456789012:mfa/saanvi
external_id = 123456
```
### अनधिकृत पहुँच
### Unauthenticated Access
{{#ref}}
../aws-unauthenticated-enum-access/aws-identity-center-and-sso-unauthenticated-enum/README.md
{{#endref}}
### विशेषाधिकार वृद्धि
### Privilege Escalation
{{#ref}}
../aws-privilege-escalation/aws-sso-and-identitystore-privesc/README.md
{{#endref}}
### पोस्ट एक्सप्लोइटेशन
### Post Exploitation
{{#ref}}
../aws-post-exploitation/aws-sso-and-identitystore-post-exploitation/README.md
{{#endref}}
### स्थिरता
### Persistence
#### एक उपयोगकर्ता बनाएं और उसे अनुमतियाँ सौंपें
#### एक user बनाएं और उसे permissions सौंपें
```bash
# Create user identitystore:CreateUser
aws identitystore create-user --identity-store-id <store-id> --user-name privesc --display-name privesc --emails Value=sdkabflvwsljyclpma@tmmbt.net,Type=Work,Primary=True --name Formatted=privesc,FamilyName=privesc,GivenName=privesc
## After creating it try to login in the console using the selected username, you will receive an email with the code and then you will be able to select a password
```
- एक समूह बनाएं और से अनुमतियाँ सौंपें और उस पर एक नियंत्रित उपयोगकर्ता सेट करें
- क नियंत्रित उपयोगकर्ता या समूह को अतिरिक्त अनुमतियाँ दें
- डिफ़ॉल्ट रूप से, केवल प्रबंधन खाते से अनुमतियों वाले उपयोगकर्ता IAM पहचान केंद्र तक पहुँच और नियंत्र करने में सक्षम होंगे।
- एक समूह बनाएं और से अनुमतियाँ असाइन करें तथा उस पर एक नियंत्रित उपयोगकर्ता सेट करें
-िसी नियंत्रित उपयोगकर्ता या समूह को अतिरिक्त अनुमतियाँ दें
- डिफ़ॉल्ट रूप से, केवल Management Account के पास अनुमति वाले उपयोगकर्ता ही IAM Identity Center तक पहुँचने और उसे नियंत्रित करने में सक्षम होंगे।
हालाकि, यह डेलीगेट एडमिनिस्ट्रेटर के माध्यम से संभव है कि एक अलग खाते के उपयोगकर्ताओं को इसे प्रबंधित करने की अनुमति दी जाए। उनके पास बिल्कुल वही अनुमति नहीं होगी, लेकिन वे [**प्रबंधन गतिविधियाँ**](https://docs.aws.amazon.com/singlesignon/latest/userguide/delegated-admin.html) करने में सक्षम होंगे।
हालाकि, Delegate Administrator के माध्यम से किसी अलग खाते के उपयोगकर्ताओं को इसे प्रबंधित करने की अनुमति देना संभव है। उनके पास बिल्कुल वही अनुमतियाँ नहीं होगी, लेकिन वे [**management activities**](https://docs.aws.amazon.com/singlesignon/latest/userguide/delegated-admin.html) करने में सक्षम होंगे।
{{#include ../../../banners/hacktricks-training.md}}