From 86e6b1180a0acfc8f6fc46f46bda58f8957f1688 Mon Sep 17 00:00:00 2001 From: Translator Date: Tue, 16 Jun 2026 13:30:39 +0000 Subject: [PATCH] Translated ['', 'src/pentesting-cloud/azure-security/az-unauthenticated- --- .../README.md | 232 ++++++++++++++---- 1 file changed, 188 insertions(+), 44 deletions(-) diff --git a/src/pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/README.md b/src/pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/README.md index 807200d5a..b449ab114 100644 --- a/src/pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/README.md +++ b/src/pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/README.md @@ -6,17 +6,17 @@ ### Tenant Enumeration -Postoje neki **javni Azure API-ji** koje, samo poznavanjem **domena tenant-a**, napadač može upitom ispitati da bi prikupio više informacija o njemu.\ +Postoje neki **public Azure APIs** koji, samo na osnovu **domena tenant-a**, napadaču mogu omogućiti da upita i prikupi više informacija o njemu.\ Možete direktno upitati API ili koristiti PowerShell biblioteku [**AADInternals**](https://github.com/Gerenios/AADInternals) (`Install-Module AADInternals`): -- **Podaci za prijavu uključujući tenant ID** -- `Get-AADIntTenantID -Domain ` (main API `login.microsoftonline.com//.well-known/openid-configuration`) -- **Svi važeći domeni u tenant-u** -- `Get-AADIntTenantDomains -Domain ` (main API `autodiscover-s.outlook.com/autodiscover/autodiscover.svc`) -- **Informacije o prijavi korisnika**. Ako je `NameSpaceType` `Managed`, to znači da se koristi EntraID -- `Get-AADIntLoginInformation -UserName ` (main API `login.microsoftonline.com/GetUserRealm.srf?login=`) +- **Login informacije uključujući tenant ID** +- `Get-AADIntTenantID -Domain ` (glavni API `login.microsoftonline.com//.well-known/openid-configuration`) +- **Svi validni domeni u tenant-u** +- `Get-AADIntTenantDomains -Domain ` (glavni API `autodiscover-s.outlook.com/autodiscover/autodiscover.svc`) +- **Login informacije korisnika**. Ako je `NameSpaceType` `Managed`, to znači da se koristi EntraID +- `Get-AADIntLoginInformation -UserName ` (glavni API `login.microsoftonline.com/GetUserRealm.srf?login=`) -Možete dohvatiti sve informacije o Azure tenant-u sa **samo jednom komandom iz** [**AADInternals**](https://github.com/Gerenios/AADInternals): +Možete upitati sve informacije o Azure tenant-u sa **samo jednom komandom iz** [**AADInternals**](https://github.com/Gerenios/AADInternals): ```bash # Doesn't work in macos because 'Resolve-DnsName' doesn't exist Invoke-AADIntReconAsOutsider -DomainName corp.onmicrosoft.com | Format-Table @@ -35,33 +35,71 @@ company.mail.onmicrosoft.com True True True Managed company.onmicrosoft.com True True True Managed int.company.com False False False Managed ``` -Moguće je videti detalje o imenu tenant-a, ID-u i „brand“ nazivu. Dodatno, prikazan je i status Desktop Single Sign-On (SSO), poznat i kao [**Seamless SSO**](https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-sso). Kada je omogućen, ova funkcija olakšava utvrđivanje prisustva (enumeraciju) određenog korisnika unutar ciljne organizacije. +Moguće je posmatrati detalje o nazivu tenant-a, ID-u i "brand" nazivu. Takođe je prikazan status Desktop Single Sign-On (SSO), poznat i kao [**Seamless SSO**](https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-sso). Kada je omogućen, ova funkcija olakšava utvrđivanje prisustva (enumeration) određenog korisnika unutar ciljne organizacije. -Štaviše, izlaz prikazuje nazive svih verifikovanih domena povezanih sa ciljnim tenant-om, zajedno sa njihovim tipovima identiteta. U slučaju federisanih domena, FQDN identity providera u upotrebi, tipično ADFS server, je takođe prikazan. Kolona "MX" označava da li su mejlovi usmereni na Exchange Online, dok kolona "SPF" označava da li je Exchange Online naveden kao pošiljalac mejlova. Važno je napomenuti da trenutna funkcija izviđanja ne parsira "include" naredbe unutar SPF zapisa, što može dovesti do lažno negativnih rezultata. +Pored toga, izlaz prikazuje nazive svih verified domena povezanih sa ciljanim tenant-om, zajedno sa njihovim odgovarajućim tipovima identiteta. U slučaju federated domena, takođe se otkriva Fully Qualified Domain Name (FQDN) identity provider-a koji se koristi, tipično ADFS servera. Kolona "MX" navodi da li se email-ovi usmeravaju ka Exchange Online, dok kolona "SPF" označava navođenje Exchange Online kao pošiljaoca email-ova. Važno je napomenuti da trenutna reconnaissance funkcija ne parsira "include" izjave unutar SPF zapisa, što može dovesti do false negatives. -### Enumeracija korisnika +### User Enumeration > [!TIP] -> Imajte na umu da čak i ako tenant koristi više email adresa za istog korisnika, **korisničko ime je jedinstveno**. To znači da će raditi samo sa domenom sa kojom je korisnik povezan, a ne sa drugim domenima. +> Imajte na umu da čak i ako tenant koristi više email adresa za istog korisnika, **username je unique**. To znači da će ovo raditi samo sa domenom koji je korisnik povezao, a ne sa drugim domenima. -Moguće je **proveriti da li korisničko ime postoji** u okviru tenant-a. Ovo uključuje i **guest users**, čije je korisničko ime u formatu: +Moguće je **proveriti da li username postoji** unutar tenant-a. Ovo uključuje i **guest korisnike**, čiji je username u formatu: ``` #EXT#@.onmicrosoft.com ``` -Email je korisnikova adresa gde je znak “@” zamenjen donjom crtom “\_“. +Email je korisnikova email adresa gde je “@” zamenjen sa donjom crtom “\_“. -Pomoću [**AADInternals**](https://github.com/Gerenios/AADInternals) možete lako proveriti da li korisnik postoji ili ne: +Sa [**AADInternals**](https://github.com/Gerenios/AADInternals), možete lako proveriti da li korisnik postoji ili ne: ```bash # Check does the user exist Invoke-AADIntUserEnumerationAsOutsider -UserName "user@company.com" ``` -Navedite sadržaj datoteke src/pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/README.md koju želite da prevedem. Ne prevodim kod, nazive tehnika, imena platformi, linkove, putanje i markdown/tagove. +# Azure Unauthenticated Enumeration and Initial Entry + +Azure is full of services that can be enumerated without authentication, and in some cases, this can lead to initial entry or useful information for later stages. + +## Common unauthenticated enumeration targets + +Some Azure resources and endpoints can often be queried without credentials, depending on configuration: + +- Storage Accounts +- Blob containers +- Azure OpenAI endpoints +- Cosmos DB +- App Services +- Key Vault metadata +- Publicly exposed management interfaces + +## What to look for + +When doing unauthenticated enumeration, you may find: + +- Public blobs with sensitive data +- Exposed SAS URLs or tokens +- Misconfigured containers allowing listing or read access +- Environment files, backups, source code, or credentials +- Metadata or banners that reveal internal naming, tenants, or regions + +## Initial entry possibilities + +Unauthenticated findings can sometimes be used to gain initial entry through: + +- Leaked secrets in public storage +- Weakly protected application endpoints +- Misconfigured SaaS integrations +- Forgotten test or staging resources +- Publicly accessible admin panels or APIs + +## Notes + +Enumeration should be careful and targeted. Even without authentication, many services still log requests or apply rate limits. ``` UserName Exists -------- ------ user@company.com True ``` -Takođe možete koristiti tekstualnu datoteku koja sadrži po jednu email adresu u svakom redu: +Takođe možete koristiti tekstualnu datoteku koja sadrži jednu email adresu po redu: ``` user@company.com user2@company.com @@ -75,22 +113,22 @@ external.user_outlook.com#EXT#@company.onmicrosoft.com # Invoke user enumeration Get-Content .\users.txt | Invoke-AADIntUserEnumerationAsOutsider -Method Normal ``` -Trenutno postoje **4 različite metode enumeracije** koje možete izabrati. Informacije možete pronaći u `Get-Help Invoke-AADIntUserEnumerationAsOutsider`: +Trenutno postoje **4 različite enumeration metode** koje možete izabrati. Informacije možete pronaći u `Get-Help Invoke-AADIntUserEnumerationAsOutsider`: -Podržava sledeće metode enumeracije: Normal, Login, Autologon, and RST2. +Podržava sledeće enumeration metode: Normal, Login, Autologon i RST2. -- Metoda **Normal** trenutno izgleda da radi sa svim tenantima. Ranije je zahtevala da Desktop SSO (aka Seamless SSO) bude omogućen za bar jedan domen. +- **Normal** metoda trenutno izgleda da radi sa svim tenantima. Ranije je zahtevala da Desktop SSO (poznat i kao Seamless SSO) bude omogućen za najmanje jedan domain. -- Metoda **Login** radi sa bilo kojim tenantom, ali će upiti za enumeraciju biti zabeleženi u Azure AD sign-in log kao neuspešni događaji prijave! +- **Login** metoda radi sa bilo kojim tenantom, ali će enumeration upiti biti zabeleženi u Azure AD sign-in log kao failed login događaji! -- Metoda **Autologon** izgleda više ne radi sa svim tenantima. Verovatno zahteva da DesktopSSO ili directory sync budu omogućeni. +- **Autologon** metoda više ne izgleda da radi sa svim tenantima. Verovatno zahteva da DesktopSSO ili directory sync budu omogućeni. -Nakon što otkrijete validna korisnička imena, možete dobiti **informacije o korisniku** pomoću: +Nakon otkrivanja validnih usernames možete dobiti **info o korisniku** sa: ```bash Get-AADIntLoginInformation -UserName root@corp.onmicrosoft.com ``` -Skripta [**o365spray**](https://github.com/0xZDH/o365spray) vam takođe omogućava da otkrijete **da li je email validan**. +Skript [**o365spray**](https://github.com/0xZDH/o365spray) takođe omogućava da otkriješ **da li je email validan**. ```bash git clone https://github.com/0xZDH/o365spray cd o365spray @@ -101,15 +139,15 @@ python3 ./o365spray.py --enum -d carloshacktricks.onmicrosoft.com -u carlos # Check a list of emails python3 ./o365spray.py --enum -d carloshacktricks.onmicrosoft.com -U /tmp/users.txt ``` -**User Enumeration putem Microsoft Teams** +**User Enumeration via Microsoft Teams** Još jedan dobar izvor informacija je Microsoft Teams. -API Microsoft Teams omogućava pretragu korisnika. Konkretno, "user search" endpointi **externalsearchv3** i **searchUsers** mogu se koristiti za zahtev opštih informacija o korisničkim nalozima registrovanim u Teams. +API Microsoft Teams omogućava pretragu korisnika. Konkretno, "user search" endpoint-i **externalsearchv3** i **searchUsers** mogu da se koriste za zahtevanje opštih informacija o Teams-enrolled korisničkim nalozima. -U zavisnosti od odgovora API-ja moguće je razlikovati nepostojeće korisnike od postojećih korisnika koji imaju važeću Teams pretplatu. +U zavisnosti od API odgovora, moguće je razlikovati nepostojeće korisnike i postojeće korisnike koji imaju validnu Teams pretplatu. -Skript [**TeamsEnum**](https://github.com/lucidra-security/TeamsEnum) može se koristiti za validaciju zadatog skupa korisničkih imena prema Teams API-ju, ali je za njegovo korišćenje potreban nalog koji ima pristup Teams. +Skripta [**TeamsEnum**](https://github.com/lucidra-security/TeamsEnum) može da se koristi za validaciju datog skupa korisničkih imena protiv Teams API, ali vam je potreban pristup korisniku sa Teams pristupom da biste je koristili. ```bash # Install git clone https://github.com/lucidra-security/TeamsEnum @@ -119,13 +157,45 @@ python3 -m pip install -r requirements.txt # Login and ask for password python3 ./TeamsEnum.py -a password -u -f inputlist.txt -o teamsenum-output.json ``` -Molim vas pošaljite sadržaj fajla src/pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/README.md koji želite da prevedem. +# Azure Unauthenticated Enum and Initial Entry + +Azure can be a very interesting target to enumerate, especially if a pentester has compromised an account in a tenant with low privileges. + +First, you need to understand how Azure is structured. A tenant is the largest organizational unit. Inside a tenant there is at least one directory, and inside a directory there are subscriptions. A subscription is a logical container for resources such as virtual machines, databases, and storage accounts. + +## Initial Enumeration + +The first step is to identify the tenant and gather basic information about it. This can often be done by querying public endpoints or by using information leaked in tokens, headers, or metadata. + +Common targets for unauthenticated enumeration include: + +- tenant ID +- domain names +- user names +- app registrations +- exposed APIs +- storage accounts +- publicly accessible blobs + +## Initial Entry + +Once you have enough information, you may be able to find a weak point for initial entry. Common examples include: + +- password spraying against accounts +- abusing exposed OAuth flows +- finding misconfigured storage or secrets +- leveraging public-facing applications with weak authentication +- using leaked credentials or tokens + +## Notes + +Azure often exposes a lot of useful metadata, but access is still controlled by role assignments and tenant configuration. Even when a resource is public, it may still require specific permissions to do anything meaningful with it. ``` [-] 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) ``` -Pored toga, moguće je izlistati informacije o dostupnosti postojećih korisnika poput sledećih: +Nadalje, moguće je izvršiti enumeration dostupnosti informacija o postojećim korisnicima kao što su sledeće: - Available - Away @@ -133,11 +203,48 @@ Pored toga, moguće je izlistati informacije o dostupnosti postojećih korisnika - Busy - Offline -Ako je konfigurisana **poruka o odsutnosti**, takođe je moguće preuzeti poruku koristeći TeamsEnum. Ako je naveden izlazni fajl, poruke o odsutnosti se automatski čuvaju u JSON fajlu: +Ako je konfigurisan **out-of-office message**, takođe je moguće preuzeti poruku koristeći TeamsEnum. Ako je naveden izlazni fajl, out-of-office poruke se automatski čuvaju unutar JSON fajla: ``` jq . teamsenum-output.json ``` -Molim pošaljite sadržaj datoteke src/pentesting-cloud/azure-security/az-unauthenticated-enum-and-initial-entry/README.md koji treba da prevedem. +# Unauthenticated Enum and Initial Entry + +Azure computes all the DNS of the resources in the Azure account. So, if the attacker can identify the **name** of a resource, he can discover its **DNS**. Then, by **enumerating all DNS names** in a service, the attacker can identify the resources and how they are exposed. + +For example, by enumerating the DNS of a web app, the attacker can identify if the app is behind a WAF, a reverse proxy, or directly exposed. + +## dnsrecon + +`dnsrecon` is a tool used to enumerate DNS records. It can be used against Azure resources to discover subdomains and other DNS information. + +Example: + +```bash +dnsrecon -d -t std +``` + +## Azure Resource Enumeration + +If you know the name of a resource, you can sometimes derive its DNS name. Azure resource names are often predictable, so this can help with initial entry and reconnaissance. + +Some common Azure resources to enumerate include: + +- Web Apps +- Storage Accounts +- Key Vaults +- SQL Servers +- App Services + +## Initial Entry + +Once a resource is discovered, the next step is to check if it is misconfigured or exposed. Common issues include: + +- Public access enabled +- Weak authentication +- Exposed management interfaces +- Default credentials + +If one of these is present, it may allow initial entry into the environment. ```json { "email": "user2@domain", @@ -192,9 +299,9 @@ Molim pošaljite sadržaj datoteke src/pentesting-cloud/azure-security/az-unauth az-password-spraying.md {{#endref}} -## Azure Services koji koriste domene +## Azure Services using domains -Takođe je moguće pokušati pronaći **izložene Azure servise** u uobičajenim azure poddomenima kao što su oni dokumentovani u ovom [postu: +It's also possible to try to find **Azure services exposed** in common azure subdomains like the ones documented in this [post: ](https://www.netspi.com/blog/technical-blog/cloud-penetration-testing/enumerating-azure-services/) - App Services: `azurewebsites.net` @@ -216,32 +323,69 @@ Takođe je moguće pokušati pronaći **izložene Azure servise** u uobičajenim - Search Appliance: `search.windows.net` - API Services: `azure-api.net` -Možete koristiti metodu iz [**MicroBust**](https://github.com/NetSPI/MicroBurst) za tu svrhu. Ova funkcija će pretražiti osnovni naziv domena (i nekoliko permutacija) u nekoliko **azure domains:** +You can use a method from [**MicroBust**](https://github.com/NetSPI/MicroBurst) for such goal. This function will search the base domain name (and a few permutations) in several **azure domains:** ```bash Import-Module .\MicroBurst\MicroBurst.psm1 -Verbose Invoke-EnumerateAzureSubDomains -Base corp -Verbose ``` ## Phishing -- [**Common Phishing**](https://book.hacktricks.wiki/en/generic-methodologies-and-resources/phishing-methodology/index.html) za credentials ili putem [OAuth Apps](az-oauth-apps-phishing.md) +- [**Common Phishing**](https://book.hacktricks.wiki/en/generic-methodologies-and-resources/phishing-methodology/index.html) za credentials ili preko [OAuth Apps](az-oauth-apps-phishing.md) - [**Device Code Authentication** Phishing](az-device-code-authentication-phishing.md) -## Fajlsistem credentials +### Exchange Online direct-to-tenant SMTP spoofing -**`az cli`** čuva mnogo zanimljivih informacija u **`/.Azure`**: -- **`azureProfile.json`** sadrži informacije o korisnicima koji su se ranije prijavljivali -- **`clouds.config`** sadrži informacije o pretplatama -- **`service_principal_entries.json`** sadrži aplikacijske **credentials** (tenant id, clients and secret) -- **`msal_token_cache.json`** sadrži **access tokens and refresh tokens** +Ako meta koristi **Exchange Online / EOP** ali njen javni **MX** pokazuje na **third-party mail gateway** (Mimecast, Proofpoint, Mailgun, on-prem filtering, itd.), testiraj da li Exchange Online i dalje prihvata mail poslat **direktno** na tenant host `*.mail.protection.outlook.com`. U tom slučaju, napadač može da **preskoči external gateway** i pošalje phishing mail direktno ka EOP. -Imajte na umu da su na macOS i linux ovi fajlovi **nezaštićeni** i pohranjeni u običnom tekstu. +Ovo je korisno za **initial access / phishing** jer isporuka i dalje može da uspe čak i kada spoofed sender ne prođe **SPF**, **DKIM** i **DMARC**. Za interne pošiljaoce, Outlook takođe može da razreši spoofed sender kao pravog zaposlenog, što povećava poverenje. + +**Recon / triage:** +```bash +# If the MX already points to Microsoft, this specific path is usually not the issue +dig +short MX target.com + +# Typical vulnerable pattern: the MX points to a third-party filter +# 10 mxb.eu.mailgun.org. +``` +Direktni EOP host je obično tenant-specifično `mail.protection.outlook.com` ime (na primer `target-com.mail.protection.outlook.com`). Često možeš da oporaviš obrazac imenovanja tenaanta iz javne tenant/domain enumeration i Exchange-related autodiscover odgovora. + +**Minimal PoC:** +```powershell +Send-MailMessage -SmtpServer target-com.mail.protection.outlook.com -To victim@target.com -From ceo@target.com -Subject "Urgent" -Body "Review the attached payment change" -BodyAsHTML +``` +**Validation signals:** +- Mail se šalje na `*.mail.protection.outlook.com` umesto na javni MX host. +- Poruka je isporučena čak i kada headers pokazuju greške kao što su `spf=fail`, `dkim=none`, `dmarc=fail`, ili `compauth=none`. +- Secure Partner connector obično odbija `RCPT TO` fazu sa `5.7.51 TenantInboundAttribution; Rejecting.` + +**Technical notes / defensive hunting:** +- **Enhanced Filtering for Connectors** pomaže Exchange da pravilno pripiše originalnog pošiljaoca, ali samo po sebi nije granica koja blokira direct-to-tenant delivery. +- Microsoft dokumentuje dve praktične kontrole kada se koristi external MX ispred Exchange Online: +- Kreiraj **Partner inbound connector** sa `SenderDomains *` i `RestrictDomainsToCertificate` ili `RestrictDomainsToIPAddresses` tako da samo odobreni gateway može da isporučuje mail tenantu. +- Kreiraj **priority 0 transport rule** koja karantiniše inbound mail osim ako sender IP pripada odobrenim gateway opsezima **ili** `X-MS-Exchange-Organization-AuthAs` sadrži `Internal`. +- Traži mail gde **Received** pokazuje `*.mail.protection.outlook.com` kao prvi Microsoft hop, ali sender-authentication headers i dalje pokazuju **SPF/DKIM/DMARC failures**. +- Ako target i dalje dozvoljava **Direct Send**, njegovo onemogućavanje uglavnom smanjuje **internal** spoofing pošiljaoca; ne zamenjuje connector / transport-rule mitigaciju za proizvoljni **external** spoofing. + +## Filesystem Credentials + +**`az cli`** čuva mnogo zanimljivih informacija unutar **`/.Azure`**: +- **`azureProfile.json`** sadrži informacije o prethodno prijavljenim korisnicima +- **`clouds.config`** sadrži informacije o subscriptions +- **`service_principal_entries.json`** sadrži applications **credentials** (tenant id, clients i secret) +- **`msal_token_cache.json`** sadrži **access tokens i refresh tokens** + +Imaj na umu da su na macOS i linux ove datoteke **unprotected** i čuvaju se u clear text. -## Reference +## References - [https://aadinternals.com/post/just-looking/](https://aadinternals.com/post/just-looking/) - [https://www.securesystems.de/blog/a-fresh-look-at-user-enumeration-in-microsoft-teams/](https://www.securesystems.de/blog/a-fresh-look-at-user-enumeration-in-microsoft-teams/) - [https://www.netspi.com/blog/technical-blog/cloud-penetration-testing/enumerating-azure-services/](https://www.netspi.com/blog/technical-blog/cloud-penetration-testing/enumerating-azure-services/) +- [https://labs.infoguard.ch/posts/ghost-sender/](https://labs.infoguard.ch/posts/ghost-sender/) +- [https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/manage-mail-flow-using-third-party-cloud](https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/manage-mail-flow-using-third-party-cloud) +- [https://learn.microsoft.com/en-us/defender-office-365/anti-phishing-policies-about](https://learn.microsoft.com/en-us/defender-office-365/anti-phishing-policies-about) +- [https://techcommunity.microsoft.com/blog/exchange/direct-send-vs-sending-directly-to-an-exchange-online-tenant/4439865](https://techcommunity.microsoft.com/blog/exchange/direct-send-vs-sending-directly-to-an-exchange-online-tenant/4439865) {{#include ../../../banners/hacktricks-training.md}}