Az - Unauthenticated Enum & Initial Entry

Unterstützen Sie HackTricks

Azure-Mandant

Mandantenenumeration

Es gibt einige öffentliche Azure-APIs, bei denen ein Angreifer nur durch Kenntnis der Domäne des Mandanten Abfragen durchführen kann, um weitere Informationen darüber zu sammeln. Sie können die API direkt abfragen oder die PowerShell-Bibliothek AADInternals** verwenden:

APIInformationenAADInternals-Funktion

login.microsoftonline.com/<domain>/.well-known/openid-configuration

Anmeldeinformationen, einschließlich Mandanten-ID

Get-AADIntTenantID -Domain <domain>

autodiscover-s.outlook.com/autodiscover/autodiscover.svc

Alle Domänen des Mandanten

Get-AADIntTenantDomains -Domain <domain>

login.microsoftonline.com/GetUserRealm.srf?login=<UserName>

Anmeldeinformationen des Mandanten, einschließlich Mandantenname und Domäne Authentifizierungstyp. Wenn NameSpaceType Managed ist, bedeutet dies, dass AzureAD verwendet wird.

Get-AADIntLoginInformation -UserName <UserName>

login.microsoftonline.com/common/GetCredentialType

Anmeldeinformationen, einschließlich Desktop SSO-Informationen

Get-AADIntLoginInformation -UserName <UserName>

Sie können alle Informationen eines Azure-Mandanten mit nur einem Befehl der AADInternals Bibliothek abfragen:

Invoke-AADIntReconAsOutsider -DomainName corp.onmicrosoft.com | Format-Table

Ausgabebeispiel der Azure-Mandanteninformationen:

Tenant brand:       Company Ltd
Tenant name:        company
Tenant id:          1937e3ab-38de-a735-a830-3075ea7e5b39
DesktopSSO enabled: True

Name                           DNS   MX    SPF  Type      STS
----                           ---   --    ---  ----      ---
company.com                   True  True  True  Federated sts.company.com
company.mail.onmicrosoft.com  True  True  True  Managed
company.onmicrosoft.com       True  True  True  Managed
int.company.com              False False False  Managed

Es ist möglich, Details zum Namen, zur ID und zum "Marken" -Namen des Mandanten zu beobachten. Darüber hinaus wird der Status des Desktop Single Sign-On (SSO), auch bekannt als Seamless SSO, angezeigt. Wenn diese Funktion aktiviert ist, erleichtert sie die Bestimmung der Anwesenheit (Aufzählung) eines bestimmten Benutzers innerhalb der Zielorganisation.

Darüber hinaus zeigt die Ausgabe die Namen aller überprüften Domänen an, die mit dem Zielmandanten verbunden sind, zusammen mit ihren jeweiligen Identitätstypen. Im Fall von föderierten Domänen wird auch der vollständig qualifizierte Domänenname (FQDN) des verwendeten Identitätsanbieters, in der Regel ein ADFS-Server, offengelegt. Die Spalte "MX" gibt an, ob E-Mails an Exchange Online weitergeleitet werden, während die Spalte "SPF" das Auflisten von Exchange Online als E-Mail-Absender angibt. Es ist wichtig zu beachten, dass die aktuelle Aufklärungsfunktion die "include" -Anweisungen innerhalb von SPF-Einträgen nicht analysiert, was zu falschen Negativen führen kann.

Benutzer-Aufzählung

Es ist möglich zu überprüfen, ob ein Benutzername innerhalb eines Mandanten existiert. Dies umfasst auch Gastbenutzer, deren Benutzername im Format vorliegt:

<email>#EXT#@<tenant name>.onmicrosoft.com

Die E-Mail ist die E-Mail-Adresse des Benutzers, bei der das "@" durch einen Unterstrich "_" ersetzt wird.

Mit AADInternals können Sie einfach überprüfen, ob der Benutzer existiert oder nicht:

# Check does the user exist
Invoke-AADIntUserEnumerationAsOutsider -UserName "user@company.com"

Unauthenticated Enumeration and Initial Entry

Introduction

In this section, we will cover the techniques used for unauthenticated enumeration and gaining initial access to Azure environments. It is crucial to understand how attackers can gather information without the need for authentication, as this can lead to further exploitation of the target environment.

Enumeration Techniques

  1. DNS Enumeration: Discovering Azure resources using DNS enumeration techniques can provide valuable information about the target environment's structure and potential entry points.

  2. Service Enumeration: Identifying exposed services and their versions can help attackers determine possible vulnerabilities to exploit.

  3. Storage Account Enumeration: Enumerating storage accounts can reveal sensitive data such as storage containers with public access, which can be used for further attacks.

Initial Entry Points

  1. Weak Credentials: Brute-forcing weak credentials is a common method for gaining initial access to Azure environments. Attackers often use tools to automate this process and gain unauthorized access.

  2. Phishing Attacks: Sending phishing emails to Azure users can trick them into revealing their credentials, providing attackers with a way to access the environment.

  3. Exploiting Misconfigurations: Taking advantage of misconfigured resources or services in Azure can allow attackers to gain initial entry without the need for authentication.

By understanding these enumeration techniques and entry points, security professionals can better protect Azure environments from unauthorized access and potential exploitation.

UserName         Exists
--------         ------
user@company.com True

Du kannst auch eine Textdatei verwenden, die eine E-Mail-Adresse pro Zeile enthält:

user@company.com
user2@company.com
admin@company.com
admin2@company.com
external.user_gmail.com#EXT#@company.onmicrosoft.com
external.user_outlook.com#EXT#@company.onmicrosoft.com
# Invoke user enumeration
Get-Content .\users.txt | Invoke-AADIntUserEnumerationAsOutsider -Method Normal

Es gibt drei verschiedene Aufzählungsmethoden, aus denen Sie wählen können:

MethodeBeschreibung

Normal

Dies bezieht sich auf die oben erwähnte GetCredentialType-API. Die Standardmethode.

Login

Diese Methode versucht, sich als Benutzer anzumelden. Hinweis: Abfragen werden im Anmeldeprotokoll protokolliert.

Autologon

Diese Methode versucht, sich als Benutzer über den Autologon-Endpunkt anzumelden. Abfragen werden nicht protokolliert im Anmeldeprotokoll! Funktioniert daher auch gut für Password-Spray- und Brute-Force-Angriffe.

Nachdem Sie die gültigen Benutzernamen entdeckt haben, können Sie Informationen über einen Benutzer erhalten:

Get-AADIntLoginInformation -UserName root@corp.onmicrosoft.com

Das Skript o365creeper ermöglicht es auch, herauszufinden, ob eine E-Mail gültig ist.

# Put in emails.txt emails such as:
# - root@corp.onmicrosoft.com
python.exe .\o365creeper\o365creeper.py -f .\emails.txt -o validemails.txt

Benutzerenumerierung über Microsoft Teams

Eine weitere gute Informationsquelle ist Microsoft Teams.

Die API von Microsoft Teams ermöglicht die Suche nach Benutzern. Insbesondere die Endpunkte "externalsearchv3" und "searchUsers" könnten verwendet werden, um allgemeine Informationen über Teams-registrierte Benutzerkonten abzurufen.

Je nach API-Antwort ist es möglich, zwischen nicht vorhandenen Benutzern und vorhandenen Benutzern, die über ein gültiges Teams-Abonnement verfügen, zu unterscheiden.

Das Skript TeamsEnum könnte verwendet werden, um eine bestimmte Menge von Benutzernamen gegen die Teams-API zu validieren.

python3 TeamsEnum.py -a password -u <username> -f inputlist.txt -o teamsenum-output.json

Unauthenticated Enumeration and Initial Entry

Introduction

In this section, we will cover the techniques used to perform unauthenticated enumeration and gain initial access to Azure environments. Unauthenticated enumeration involves gathering information without the need for valid credentials, which can help in identifying potential entry points for further exploitation.

Tools and Techniques

  1. Enumerating Azure Services: Utilize tools like azurite to discover Azure services and resources without authentication.

  2. Public Information Sources: Search for publicly available information such as exposed storage accounts, databases, or other resources.

  3. Brute Forcing: Attempt to guess valid resource URLs or access keys to gain unauthorized access.

  4. Misconfigured Endpoints: Identify misconfigured endpoints that may expose sensitive data or allow unauthorized access.

Initial Entry Points

Once potential entry points are identified through unauthenticated enumeration, further exploitation can be carried out using techniques such as:

  • Weak Credentials: Attempting default or weak credentials to gain access to Azure services.

  • Vulnerabilities: Exploiting known vulnerabilities in Azure services or misconfigurations to gain unauthorized access.

  • Phishing Attacks: Social engineering attacks to trick users into revealing their credentials or other sensitive information.

By combining unauthenticated enumeration with these initial entry techniques, attackers can gain a foothold in Azure environments and carry out more advanced attacks.

[-] user1@domain - Target user not found. Either the user does not exist, is not Teams-enrolled or is configured to not appear in search results (personal accounts only)
[+] user2@domain - User2 | Company (Away, Mobile)
[+] user3@domain - User3 | Company (Available, Desktop)

Darüber hinaus ist es möglich, Verfügbarkeitsinformationen über vorhandene Benutzer wie folgt aufzulisten:

  • Verfügbar

  • Abwesend

  • Bitte nicht stören

  • Beschäftigt

  • Offline

Wenn eine Abwesenheitsnachricht konfiguriert ist, ist es auch möglich, die Nachricht mithilfe von TeamsEnum abzurufen. Wenn eine Ausgabedatei angegeben wurde, werden die Abwesenheitsnachrichten automatisch in der JSON-Datei gespeichert:

jq . teamsenum-output.json

Unauthenticated Enumeration and Initial Entry

Introduction

In this section, we will discuss how to perform unauthenticated enumeration and gain initial access to Azure environments. This technique involves gathering information without the need for valid credentials, allowing an attacker to identify potential entry points and vulnerabilities.

Enumeration Techniques

  1. DNS Enumeration: Discovering Azure subdomains using tools like dnsrecon or Sublist3r.

  2. Service Enumeration: Identifying exposed services and ports using tools like nmap or Masscan.

  3. Storage Account Enumeration: Enumerating storage accounts to identify publicly accessible data using tools like azcopy or BlobHunter.

Initial Entry Points

  1. Weak Credentials: Attempting to login with commonly used or default credentials.

  2. Exposed Services: Exploiting services with known vulnerabilities or misconfigurations.

  3. Phishing Attacks: Sending phishing emails to Azure users to obtain their credentials.

By following these techniques, an attacker can gather valuable information and potentially gain unauthorized access to Azure environments.

{
"email": "user2@domain",
"exists": true,
"info": [
{
"tenantId": "[REDACTED]",
"isShortProfile": false,
"accountEnabled": true,
"featureSettings": {
"coExistenceMode": "TeamsOnly"
},
"userPrincipalName": "user2@domain",
"givenName": "user2@domain",
"surname": "",
"email": "user2@domain",
"tenantName": "Company",
"displayName": "User2",
"type": "Federated",
"mri": "8:orgid:[REDACTED]",
"objectId": "[REDACTED]"
}
],
"presence": [
{
"mri": "8:orgid:[REDACTED]",
"presence": {
"sourceNetwork": "Federated",
"calendarData": {
"outOfOfficeNote": {
"message": "Dear sender. I am out of the office until March 23rd with limited access to my email. I will respond after my return.Kind regards, User2",
"publishTime": "2023-03-15T21:44:42.0649385Z",
"expiry": "2023-04-05T14:00:00Z"
},
"isOutOfOffice": true
},
"capabilities": [
"Audio",
"Video"
],
"availability": "Away",
"activity": "Away",
"deviceType": "Mobile"
},
"etagMatch": false,
"etag": "[REDACTED]",
"status": 20000
}
]
}

Azure-Dienste

Nun, da wir die Domänen des Azure-Mandanten kennen, ist es an der Zeit, zu versuchen, exponierte Azure-Dienste zu finden.

Sie können eine Methode von MicroBust für dieses Ziel verwenden. Diese Funktion wird den Basisdomänennamen (und einige Permutationen) in mehreren Azure-Dienst-Domänen suchen:

Import-Module .\MicroBurst\MicroBurst.psm1 -Verbose
Invoke-EnumerateAzureSubDomains -Base corp -Verbose

Offener Speicher

Sie könnten offenen Speicher mit einem Tool wie InvokeEnumerateAzureBlobs.ps1 entdecken, das die Datei Microburst/Misc/permitations.txt verwenden wird, um Permutationen (sehr einfach) zu generieren, um zu versuchen, offene Speicherkonten zu finden.

Import-Module .\MicroBurst\MicroBurst.psm1
Invoke-EnumerateAzureBlobs -Base corp
[...]
https://corpcommon.blob.core.windows.net/secrets?restype=container&comp=list
[...]

# Access https://corpcommon.blob.core.windows.net/secrets?restype=container&comp=list
# Check: <Name>ssh_info.json</Name>
# Access then https://corpcommon.blob.core.windows.net/secrets/ssh_info.json

SAS URLs

Ein Shared Access Signature (SAS) URL ist eine URL, die Zugriff auf einen bestimmten Teil eines Speicherkontos (könnte ein vollständiger Container, eine Datei usw. sein) mit bestimmten Berechtigungen (Lesen, Schreiben usw.) über die Ressourcen bereitstellt. Wenn Sie einen solchen URL finden, könnten Sie auf sensible Informationen zugreifen. Sie sehen so aus (dies ist, um auf einen Container zuzugreifen, wenn es nur den Zugriff auf eine Datei gewährt, wird der Pfad der URL auch diese Datei enthalten):

https://<storage_account_name>.blob.core.windows.net/newcontainer?sp=r&st=2021-09-26T18:15:21Z&se=2021-10-27T02:14:21Z&spr=https&sv=2021-07-08&sr=c&sig=7S%2BZySOgy4aA3Dk0V1cJyTSIf1cW%2Fu3WFkhHV32%2B4PE%3D

Verwenden Sie Storage Explorer, um auf die Daten zuzugreifen

Zugangsdaten kompromittieren

Phishing

Passwort-Spraying / Brute-Force

Az - Password Spraying

Referenzen

Unterstützen Sie HackTricks

Last updated