Azure Penetration Testing Part - 2: Finding Azure Services and Vulnerabilities
π Finding Azure Services and Vulnerabilities (Unauthenticated)
As a cloud penetration tester, your assessment may begin with zero access to the Azure tenant no credentials, no tokens, no insider knowledge. In such cases, your job is to discover, fingerprint, and exploit public facing Azure assets in scope.
From bug bounty targets to shadow IT discovery, anonymous Azure service enumeration can reveal misconfigured services, leaked data, or even paths to initial compromise.
β οΈ Microsoftβs Penetration Testing Rules of Engagement
Since June 2017, Microsoft has eliminated the need for pre approval to perform penetration tests against Azure resources you own or control. However, strict boundaries still apply.
π Microsoft Penetration Testing Guidance
β Activities That Are Prohibited
- Scanning assets that belong to other Azure customers
- Accessing any data not owned by you
- Denial of service (DoS) testing
- Phishing or social engineering attacks against Microsoft employees
π¨ Violating these rules may result in account suspension, legal action, or financial liability.
β Activities That Are Allowed
- Scanning your own Azure endpoints for vulnerabilities
- Performing port scans or fuzzing against your apps or APIs
- Testing public cloud services and configurations hosted in your subscription
π§Ύ Common Azure Pentesting Scenarios
Depending on your organization or client, Azure pentesting may include various types of testing. Defining scope and objectives in writing is critical to avoid unauthorized activity.
Typical Azure Testing Scopes:
| Scope | Description |
|---|---|
| Anonymous External Testing | Attacking public Azure services with no prior access |
| Read Only Configuration Review | Reviewing policies, RBAC, and security controls without write access |
| Internal Network Testing | Simulating an attacker who has internal access (e.g., a compromised VM) |
| Architecture Review | Assessing design, segmentation, and resilience of Azure infrastructure |
π§ Tip: Azure pentests are often hybrid combining multiple scopes. Always confirm in writing which methods are approved.
π΅οΈ Unauthenticated Enumeration
AADInternals Tool
π AADInternals
Install
1Install-Module AADInternals
2Import-Module AADInternalsQuery all the information of an Azure tenant
1Invoke-AADIntReconAsOutsider -DomainName corp.onmicrosoft.com | Format-TableGet Tenant ID
1Get-AADIntTenantID -Domain cybercheckpentest.onmicrosoft.comGet All domains of the Tenant
1Get-AADIntTenantDomains -Domain cybercheckpentest.onmicrosoft.comGet OpenID configuration
1Get-AADIntOpenIDConfiguration -Domain cybercheckpentest.onmicrosoft.comCheck if the user exists or not
1Invoke-AADIntUserEnumerationAsOutsider -UserName user@company.comGet info about a user
1Get-AADIntLoginInformation -UserName root@corp.onmicrosoft.comCheck if users exist using a list
1Get-Content .\users.txt | Invoke-AADIntUserEnumerationAsOutsiderπ Azure Public IP Address Ranges
Like other public cloud providers, Microsoft Azure enables organizations to assign internet accessible IP addresses to cloud hosted services.
These public IPs are often the first line of attack surface exposed to the internet and, therefore, a prime target for reconnaissance during external pentesting.
What Resources Use Public IPs?
Azure public IPs can be attached to many infrastructure services, including:
- π₯οΈ Virtual machine network interfaces
- π Internet facing load balancers
- π VPN gateways
- π‘οΈ Application gateways
- π₯ Azure Firewall instances
Depending on the resource type and configuration, the IP can be either:
| Allocation Type | Behavior |
|---|---|
| Static | Fixed and retained for the resource lifespan |
| Dynamic | May change when the resource is stopped/deallocated |
π― Why Public IPs Matter in Pentesting
As a pentester, identifying public IPs allocated to the organizationβs Azure tenant is critical to mapping the IaaS attack surface. These addresses could expose:
- Remote desktop or SSH interfaces
- Open ports on misconfigured VMs
- Unprotected application front ends
- Forgotten test environments
β Ethical Scanning in Engagements
When operating within a legal engagement, always request the list of public IPs from the organization. This avoids scanning unrelated Azure customers.
π§ How to Collect IPs with Azure CLI:
1az network public-ip list --query '[].[name, ipAddress,
2publicIpAllocationMethod]' -o tableπ§ How to Collect IPs with az PowerShell module :
1Get-AzPublicIpAddress | Select
2Name,IpAddress,PublicIpAllocationMethodβ οΈ Important: Dynamic IPs can change. To avoid scanning the wrong tenant, consider targeting DNS hostnames instead, which update automatically with IP changes.
π§ Attack Surface Enumeration with Public Data
Even without access to a tenant, adversaries can still use public data to map Azureβs global IP footprint.
π¦ Microsoft Azure Public IP JSON File
Azure publishes a weekly updated JSON file listing all IPv4 and IPv6 ranges used by Azure services across regions:
π Download link:
Downlaod the file
1Invoke-WebRequest <json_url> -O azure_ip_range.jsonFilter IP Address for a region
1$jsonData = gc .azure_ip_range.json | ConvertFrom-Json
2($jsonData | select -ExpandProperty values | where name
3-EQ AzureCloud.uksouth).properties.addressPrefixesFilter all the services in the region
1($jsonData | select -ExpandProperty values | where name
2-EQ AppService.UKSouth).properties.addressPrefixesScan with Nmap or Masscan
1nmap -Pn -p 80,443 -iL azure-ips.txt -oA azure-scanπ DNS Based Enumeration of Azure Services
One of the most effective ways to anonymously discover Azure hosted services is through DNS enumeration. Many Azure services expose public endpoints that follow predictable naming conventions using Microsoft owned DNS suffixes.
This approach is particularly useful for:
- π Identifying shadow IT or misconfigured services
- π§ͺ Conducting external assessments and bug bounty recon
- π― Pinpointing tenant specific assets (without authentication)
π·οΈ How Azure DNS Naming Works
When a customer creates a public facing Azure resource, the platform automatically assigns a subdomain under a known Microsoft-owned DNS suffix.
π Format:
1<resource-name>.<service-dns-suffix>π¦ Example
If a customer creates a blob storage account named azurepentesting, the resulting FQDN would be
1azurepentesting.blob.core.windows.netπ Global vs Regional DNS Suffixes
Some services use region specific suffixes, while others are global.
| Resource Type | DNS Format Example | Scope |
|---|---|---|
| Storage Account | azurept.blob.core.windows.net | Global |
| Virtual Machine | vm01.uksouth.cloudapp.azure.com | Regional |
| Web App (App Service) | app123.azurewebsites.net | Global |
| Kudu (SCM Console) | app123.scm.azurewebsites.net | Global |
| Key Vault | vaultname.vault.azure.net | Global |
π Why This Matters for Pentesters
Understanding DNS naming patterns allows you to enumerate deployed Azure services anonymously and systematically. Once found, these endpoints can be checked for
- Open access controls (e.g., anonymous blob reads)
- Debug consoles (e.g., Kudu)
- Expired but still resolvable subdomains
- Potential for subdomain takeovers
π§° DNS Enumeration Methodology
Hereβs a typical workflow for external Azure DNS reconnaissance
πΉ 1. Define Base Terms
Start with known or likely naming patterns tied to the organization.
1Examples: packt, azurepentesting, azurept, contosoπΉ 2. Generate Permutations Expand the base terms with common environment prefixes and suffixes
1Examples: packt-prod, azurept-dev, contoso-qa, azurepentesting-stageUse automated tools or wordlists to generate hundreds of permutations quickly.
πΉ 3. Resolve DNS with Azure Specific Tools
Use tools like MicroBurst, which are purpose built for Azure.
π― Why MicroBurst?
- Automatically knows all common Azure DNS suffixes
- Supports brute force and targeted enumeration
- Avoids manual suffix management
π MicroBurst:
Download MicroBurst
1git clone https://github.com/NetSPI/MicroBurst.gitImport the MicroBurst module into your PowerShell session
1cd .MicroBurst &&
2Import-Module .\MicroBurst.psm1Use the Invoke-EnumerateAzureSubDomains function to identify potential targets that have a base name of azurepentesting
1Invoke-EnumerateAzureSubDomains -Base azurepentestingπ§Ύ Custom Domains and IP Ownership in Azure
Not every Azure hosted service looks like it belongs to Azure. Many organizations use custom domains or transparent proxies that mask their cloud origin either for branding or obfuscation.
As a penetration tester, identifying the true origin of your target infrastructure is essential to
- π― Define the accurate scope of your engagement
- π Uncover hidden Azure assets
- π‘οΈ Avoid impacting unrelated environments
π΅οΈ Why This Matters
Letβs say youβre authorized to test only
app.example.com- IP:
20.84.204.10
On the surface, itβs unclear whether this is hosted on
- Azure?
- AWS?
- A self hosted data center?
If this resolves to a Microsoft owned IP range, it changes your targeting strategy. You may now be dealing with Azure App Services, Azure CDN, or a virtual machine behind a proxy.
π‘ Knowing the underlying platform helps guide fingerprinting, exploitation, and post access techniques.
π Custom Domains in Azure
Azure supports custom DNS mappings for many services, such as
| Service | Custom Domain Capable? |
|---|---|
| Azure App Service | β Yes |
| Azure CDN | β Yes |
| Front Door | β Yes |
| Blob Storage (Static Sites) | β Yes |
These services often hide Azure DNS suffixes (e.g., azurewebsites.net) behind a vanity domain like login.mybrand.com.
π§ͺ Verifying Azure IP Ownership
When you're dealing with IP addresses or domains and want to confirm whether they belong to Azure, use one of the following tools.
π§° Tool 1: Cloud IP Checker (Go)
Cloud IP Checker is a fast, Go based tool for verifying IP addresses against the official Microsoft IP ranges and Service Tags.
π¦ Features:
- Compares IPs to Azureβs weekly published JSON file
- Shows matching service, region, and range
- Can be run locally or deployed as a REST API
π§° Tool 2: AzureIPCheck (Python)
AzureIPCheck is a Python alternative that supports
- Local JSON parsing of Azure IPs
- Manual or bulk IP lookup
- Easy script integration
π GitHub: AzureIPCheck
π§ͺ Example Workflow
- Get your list of target IPs/domains.
- Resolve domains to IPs using tools like
dig,nslookup, ormassdns. - Run IPs through Cloud IP Checker or AzureIPCheck.
- Identify which targets are on Azure infrastructure.
- Adjust enumeration and exploitation techniques accordingly.
π§ Pentest Insight
- Custom domain? Check underlying A records and CNAME chains.
- IP not owned by target? You may be out of scope or dealing with shared cloud infra.
- Azure-verified? Now you can map likely service type and pivot accordingly (e.g., blob storage, App Service, VM).
β οΈ Always confirm scope boundaries with stakeholders when you discover unexpected cloud infrastructure behind custom domains.
π Identifying Vulnerabilities in Public Facing Azure Services
Once youβve mapped out your anonymous Azure attack surface and validated scope with the asset owner, youβre ready to start probing for vulnerabilities.
In Azure environments, public facing weaknesses generally fall into three primary categories
- βοΈ Misconfigurations
- π§° Missing patches
- π§βπ» Vulnerable application code
β οΈ Configuration Related Vulnerabilities
These issues are often caused by human error and poor defaults. Misconfigured Azure services can expose
- Sensitive files and logs
- Internal applications or VMs
- Access control flaws
π₯οΈ IaaS (Infrastructure as a Service) Misconfigurations
Azure IaaS includes services like
- Virtual Machines (VMs)
- Virtual Machine Scale Sets
- Windows Virtual Desktop (WVD)
These services often expose management interfaces such as RDP (3389) or SSH (22) via public IP addresses.
π What to Look For
- Weak or default credentials on public facing ports
- Forgotten dev/test environments left online
- Exposed applications on HTTP/HTTPS (e.g., admin panels, old versions)
π§ͺ Enumeration Workflow
- Obtain the organizationβs IP list (via Azure CLI or PowerShell).
- Use Nmap, Masscan, or RustScan to fingerprint hosts and open ports.
- Attempt authentication brute force or credential stuffing (if in scope).
β οΈ Always verify IP ownership and get written authorization before scanning!
π§± PaaS (Platform as a Service) Misconfigurations
PaaS services like Azure Blob Storage, Web Apps, or Key Vaults are often internet accessible by design. Misconfigurations here can lead to anonymous access or data exposure.
πΎ Azure Storage Accounts: Blob Service Vulnerabilities
| Service Name | Purpose | Subdomain Example |
|---|---|---|
| Blob | Object/file storage | azurept.blob.core.windows.net |
| Files | SMB/NFS shared file storage | azurept.file.core.windows.net |
| Table | NoSQL data storage | azurept.table.core.windows.net |
| Queue | Message queue for services | azurept.queue.core.windows.net |
π Note: Only Blob storage supports full anonymous access. Others require authentication.
π Blob Storage Structure
- Storage Account: Top-level namespace (e.g.,
azurepentesting) - Container: Like a folder (e.g.,
public,files,uploads) - Object: The actual file (e.g.,
README.txt,report123.pdf)
π Public Access Permission Levels
| Access Level | Description | Risk Level |
|---|---|---|
| Private | Auth required to view/list blobs | β Secure |
| Blob | Anyone can access a known file URL | β οΈ Medium |
| Container | Anyone can list all files in the container | π₯ High Risk |
π Listing Container Contents (Unauthenticated)
If the container has Container level access, you can list all blobs using
1https://azurepentesting.blob.core.windows.net/public/?restype=container&comp=listThis will return an XML response with blob names and timestamps.
π§° Container Guessing
If you donβt know the container name
- Use wordlists and tools like Gobuster or MicroBurst to guess container names
- Check access permissions by appending ?restype=container&comp=list
- Look for containers with open listings
1gobuster dir -u https://azurepentesting.blob.core.windows.net/ -w containers.txt -q -e -kπ΅οΈ IDOR in Blob URLs
Some applications store user files using predictable filenames (e.g., invoice-001.pdf, invoice-002.pdf).
This can be exploited using
- Sequential brute force
- Guessing based on naming patterns
π Learn more
Use MicroBurst
use the Invoke-EnumerateAzureBlobs script to access data in a misconfigured Azure Blob storage service.
1Invoke-EnumerateAzureBlobs -Base azurepentestingdownload the contents of the objects
1Invoke-WebRequest -Uri "https://azurepentesting.blob.core.windows.net/private/credentials.txt" -OutFile "credentials.txt"Use a custom list
1Invoke-EnumerateAzureBlobs -Base azurepentesting -Folders .customcontainername.txtπ§ Summary
Identifying and exploiting misconfigurations in Azure services is often low effort, high impact, especially when public access is misapplied
| Target Type | Tool Examples | Risk |
|---|---|---|
| VM Public IP | Nmap, RustScan | RCE, Credential reuse |
| Blob Storage | MicroBurst, Gobuster | Data leakage |
| Predictable URLs | Manual / Wordlists | IDOR |
π Finding Azure Credentials
While misconfigured services are an effective way to gain access to Azure environments, the most common real world method is far simpler: using valid credentials.
In penetration tests, red team engagements, and even real-world breaches, attackers routinely gain access to Azure tenants by:
- Guessing weak passwords
- Reusing leaked credentials from past breaches
- Exploiting poor identity hygiene
π§© Step 1: Guessing Azure AD Credentials
Despite modern security features, weak and default passwords are still widespread in the enterprise.
π Common Issues:
- Poor password policies
- Reused passwords across systems
- Users who choose seasonal or easily guessable phrases (e.g.,
Winter2024!,Company@123)
Even organizations that enforce complexity and expiration rules can still fall victim to predictable password patterns.
π₯ Step 2: Building a Username List
To guess credentials, youβll first need valid usernames often in email address format:
1<firstname>.<lastname>@company.com
2<firstinitial><lastname>@company.com
3<first>.<last_initial>@domain.comπ οΈ How to Gather Usernames
- π Public company websites and support pages
- π LinkedIn profiles (name and title matching)
- π» GitHub commits and open source repositories
- π Past data breaches (e.g., via HaveIBeenPwned, DeHashed)
Use known formats and user naming conventions to generate a list of likely usernames.
π Step 3: Building a Password List
Use targeted or generic password lists, keeping policy requirements in mind (length, complexity, rotation)
π― Common Lists:
- π PwnedPasswordsTop100k
- π RockYou.tx
- π§ Custom seasonal/company themed patterns (e.g., Contoso2024!, Fall2023@)
π― Choosing a Password Guessing Strategy
Different strategies work better in different contexts. You should always tailor your approach to avoid account lockouts and maintain stealth.
π₯ Brute Force Attack
Target one or a few usernames, cycling through many passwords.
- π Risk of account lockout
- π‘ Limit guesses (e.g., 3 attempts) to avoid triggering Azure AD lockout policies
πΏ Password Spray Attack
Try one password across many usernames, slowly and stealthily
- π§ Effective against large orgs with poor password hygiene
- π« Often blocked after multiple bad attempts from the same IP
π‘ Tip: Distribute attempts across IP addresses to bypass smart lockout protections.
π§° Introducing: MSOLSpray
MSOLSpray is a PowerShell based password spraying tool built specifically for Microsoft Online services (Azure AD, Office 365).
β Features
- Validates credentials
- Detects:
- β Invalid accounts
- π Locked/disabled accounts
- π Password expiration
- π‘οΈ MFA status
π MSOLSpray
Download MSOLSpray
1git clone https://github.com/dafthack/MSOLSpray.gitImport the MSOLSpray module into your PowerShell session
1cd .MSOLSpray &&
2Import-Module .\MSOLSpray.ps1Run MSOLSpray against the user accounts
1Invoke-MSOLSpray -UserList .\userlist.txt -Password Password123β οΈ Ethical Guidance for Credential Attacks
Credential attacks can easily violate your scope or policies if done incorrectly
Always:
- Get written authorization
- Confirm lockout thresholds and policies
- Coordinate with the Azure security or IAM team
- Limit guesses and delay between attempts
- Never guess credentials for Microsoft employee domains
π Microsoftβs own protections like Smart Lockout, Identity Protection, and Defender for Identity will trigger alerts and lockouts if abuse is detected.
π‘οΈ Conditional Access Policies and MFA Bypasses
Modern Azure AD environments often rely on Conditional Access (CA) policies to control access to Microsoft cloud services. These policies act as identity firewalls, blocking access unless certain conditions such as location, device type, or MFA are met.
However, even strong identity controls can be circumvented, especially when legacy protocols or misconfigured exceptions are present.
π§ What Is Conditional Access?
Conditional Access policies allow admins to enforce identity driven controls based on:
- User risk level
- Device platform (e.g., Android, iOS)
- Location or IP address
- App type or protocol
- Sign in behavior
β οΈ Bypassing Conditional Access in the Wild
Despite their strength, Conditional Access policies are not bulletproof. Pentesters have repeatedly observed
- Misconfigured CA exclusions
- Legacy authentication protocols bypassing MFA
- Mobile device exceptions exploited using spoofed user agents
- Admins disabling CA or MFA during help desk troubleshooting
These gaps offer attackers a foothold into the Azure AD tenant, even with MFA in place.
π§° Tool: MFASweep
π MFASweep is a PowerShell based tool designed to identify which Microsoft services are not enforcing MFA or Conditional Access for a set of user credentials.
β What MFASweep Tests
| Targeted Service | Use Case |
|---|---|
| Microsoft Graph API | Token based access and identity info |
| Azure Service Management API | Core Azure resource interaction |
| Microsoft 365 Exchange Web Services | Outlook and mail access |
| Microsoft 365 Web portal | Office.com login |
| Microsoft 365 Web (Mobile UA) | Login via spoofed mobile user agent |
| Microsoft 365 ActiveSync | Legacy mobile protocol often MFA-exempt |
Download MFASweep
1git clone https://github.com/dafthack/MFASweep.gitImport the MFASweep
1cd MFASweep &&
2Import-Module .\MFASweep.ps1Run MFASweep against any compromised user accounts
1Invoke-MFASweep -Username johnra@azurepentesting.com -Password Password123π§ Summary
Even in modern Azure tenants with Conditional Access and MFA:
- π§± Misconfigured exceptions and outdated protocols remain exploitable
- π― MFASweep is a valuable tool for identifying these weak spots
- π‘οΈ Always test responsibly, with written approval and clear scope boundaries