diff --git a/src/pentesting-cloud/azure-security/az-privilege-escalation/az-entraid-privesc/dynamic-groups.md b/src/pentesting-cloud/azure-security/az-privilege-escalation/az-entraid-privesc/dynamic-groups.md index cc6588133..510c7ce31 100644 --- a/src/pentesting-cloud/azure-security/az-privilege-escalation/az-entraid-privesc/dynamic-groups.md +++ b/src/pentesting-cloud/azure-security/az-privilege-escalation/az-entraid-privesc/dynamic-groups.md @@ -2,27 +2,59 @@ {{#include ../../../../banners/hacktricks-training.md}} -## Basic Information +## बुनियादी जानकारी -**डायनामिक समूह** वे समूह हैं जिनमें एक सेट **नियम** कॉन्फ़िगर किया गया है और सभी **उपयोगकर्ता या उपकरण** जो नियमों से मेल खाते हैं, समूह में जोड़े जाते हैं। हर बार जब एक उपयोगकर्ता या उपकरण का **गुण** **बदला** जाता है, डायनामिक नियमों की **पुनः जांच** की जाती है। और जब एक **नया नियम** **बनाया** जाता है, तो सभी उपकरणों और उपयोगकर्ताओं की **जांच** की जाती है। +**Dynamic groups** ऐसे समूह हैं जिनमें एक सेट **rules** configured होते हैं और सभी **users or devices** जो उन rules से match करते हैं, समूह में जोड़ दिए जाते हैं। हर बार जब किसी user या device का **attribute** **changed** होता है, तो dynamic rules को **rechecked** किया जाता है। और जब कोई **new rule** **created** होता है तो सभी devices और users को **checked** किया जाता है। -डायनामिक समूहों को **Azure RBAC भूमिकाएँ सौंपित** की जा सकती हैं, लेकिन डायनामिक समूहों में **AzureAD भूमिकाएँ** जोड़ना **संभव नहीं** है। +Dynamic groups में **Azure RBAC roles** assigned किए जा सकते हैं, लेकिन dynamic groups में **AzureAD roles** जोड़ना संभव नहीं है। -इस सुविधा के लिए Azure AD प्रीमियम P1 लाइसेंस की आवश्यकता होती है। +इस फीचर के लिए **Azure AD premium P1 license** की आवश्यकता होती है। ## Privesc -ध्यान दें कि डिफ़ॉल्ट रूप से कोई भी उपयोगकर्ता Azure AD में मेहमानों को आमंत्रित कर सकता है, इसलिए, यदि एक डायनामिक समूह का **नियम** उपयोगकर्ताओं को **अनुमतियाँ** देता है जो **गुणों** के आधार पर हैं जो एक नए **मेहमान** में **सेट** किए जा सकते हैं, तो इस गुणों के साथ एक **मेहमान** **बनाना** संभव है और **अधिकार बढ़ाना** संभव है। यह भी संभव है कि एक मेहमान अपने प्रोफ़ाइल का प्रबंधन करे और इन गुणों को बदल सके। +ध्यान दें कि डिफ़ॉल्ट रूप से किसी भी user को Azure AD में guests invite करने की अनुमति होती है, इसलिए यदि कोई dynamic group **rule** ऐसे **permissions** देता है जो उन **attributes** के आधार पर users को मिलते हैं जिन्हें एक नए **guest** में सेट किया जा सकता है, तो उन attributes के साथ एक **guest** create करके privileges escalate करना संभव है। यह भी संभव है कि एक **guest** अपना प्रोफ़ाइल manage करके इन attributes को बदल सके। -डायनामिक सदस्यता की अनुमति देने वाले समूह प्राप्त करें: **`az ad group list --query "[?contains(groupTypes, 'DynamicMembership')]" --output table`** +Dynamic membership की अनुमति देने वाले groups प्राप्त करें: **`az ad group list --query "[?contains(groupTypes, 'DynamicMembership')]" --output table`** -### Example +### Dynamic Groups सूचीकरण -- **नियम उदाहरण**: `(user.otherMails -any (_ -contains "security")) -and (user.userType -eq "guest")` -- **नियम विवरण**: कोई भी मेहमान उपयोगकर्ता जिसके पास 'security' स्ट्रिंग वाला एक द्वितीयक ईमेल है, समूह में जोड़ा जाएगा +किसी dynamic group के rules प्राप्त करें: -मेहमान उपयोगकर्ता ईमेल के लिए, निमंत्रण स्वीकार करें और [https://entra.microsoft.com/#view/Microsoft_AAD_IAM/TenantOverview.ReactView](https://entra.microsoft.com/#view/Microsoft_AAD_IAM/TenantOverview.ReactView) में **उस उपयोगकर्ता** की वर्तमान सेटिंग्स की जांच करें।\ -दुर्भाग्यवश, पृष्ठ गुण मानों को संशोधित करने की अनुमति नहीं देता है, इसलिए हमें API का उपयोग करने की आवश्यकता है: +With **Azure CLI**: +```bash +az ad group list \ +--filter "groupTypes/any(c:c eq 'DynamicMembership')" \ +--query "[].{displayName:displayName, rule:membershipRule}" \ +-o table +``` +**PowerShell** और **Microsoft Graph SDK** के साथ: +```bash +Install-Module Microsoft.Graph -Scope CurrentUser -Force +Import-Module Microsoft.Graph + +Connect-MgGraph -Scopes "Group.Read.All" + +Get-MgGroup -Filter "groupTypes/any(c:c eq 'DynamicMembership')" ` +-Property Id, DisplayName, GroupTypes + +# Get the rules of a specific group +$g = Get-MgGroup -Filter "displayName eq ''" ` +-Property DisplayName, GroupTypes, MembershipRule, MembershipRuleProcessingState + +$g | Select-Object DisplayName, GroupTypes, MembershipRule + +# Get the rules of all dynamic groups +Get-MgGroup -Filter "groupTypes/any(c:c eq 'DynamicMembership')" ` +-Property DisplayName, MembershipRule | +Select-Object DisplayName, MembershipRule +``` +### उदाहरण + +- **Rule example**: `(user.otherMails -any (_ -contains "security")) -and (user.userType -eq "guest")` +- **Rule description**: किसी भी Guest उपयोगकर्ता जिसकी द्वितीयक ईमेल में 'security' स्ट्रिंग हो, उसे समूह में जोड़ा जाएगा + +Guest उपयोगकर्ता ईमेल के लिए, निमंत्रण स्वीकार करें और [https://entra.microsoft.com/#view/Microsoft_AAD_IAM/TenantOverview.ReactView](https://entra.microsoft.com/#view/Microsoft_AAD_IAM/TenantOverview.ReactView).\ +दुर्भाग्यवश यह पेज attribute मानों को संशोधित करने की अनुमति नहीं देता, इसलिए हमें API का उपयोग करना होगा: ```bash # Login with the gust user az login --allow-no-subscriptions @@ -41,7 +73,7 @@ az rest --method GET \ --url "https://graph.microsoft.com/v1.0/users/" \ --query "otherMails" ``` -## References +## संदर्भ - [https://www.mnemonic.io/resources/blog/abusing-dynamic-groups-in-azure-ad-for-privilege-escalation/](https://www.mnemonic.io/resources/blog/abusing-dynamic-groups-in-azure-ad-for-privilege-escalation/)