Azure Recon for Initial Foothold & Profit💰
Unveiling Secrets, Forging Paths, and Reaping Rewards
D: \nullhyderabad> type whoami
Syed Izhar Ahmed
Cloud Security Engineer @ Brio Technologies
Founder @ InfosecIITG
Certifications
Linkedin : https://www.linkedin.com/in/izharahmedsyed/
D: \ nullhyderabad> Scenario
Our team, renowned for its expertise in cybersecurity, has been approached by Mega Big Tech, a leading tech giant, to conduct a comprehensive penetration test on their infrastructure.
The only information given to us is the domain name, �which is megabigtech.com�
D: \ nullhyderabad> Agenda
Initial Recon
D:\ Initial Recon> Information_Disclosure
During our OSINT analysis, we spotted a potential leak on Pastebin that could prove valuable for future use.
�D:\ Initial Recon> Entra_ID_Presence
You can verify if a company is using Entra ID for authentication by visiting the following URL:
https://login.microsoftonline.com/getuserrealm.srf?login=<COMPANYNAME>&xml=1
If the NameSpaceType value in the XML output displays as Managed, then the company is using Entra ID.
D:\ Initial Recon> AADInternals
Once confirmed that Megabigtech uses Entra ID, more information can be gathered by tools such as AADInternals.
Reference
D:\ Initial Recon > Microburst
Azure services are accessible through recognizable domains and subdomains. We can detect if the target organization utilizes these services by searching for such subdomains.
Microburst utilizes different PowerShell modules such as Az, AzureAD, AzureRM, and MSOL, along with additional REST API calls, to evaluate security in Azure environments.
Reference: https://github.com/NetSPI/MicroBurst
D:\ Initial Recon > Potential Usernames
Key Observations
Potential usernames
D:\ Initial Recon> Validating Usernames
Browsing to login.microsoftonline.com, If the username is valid we will be prompted to enter the password. Otherwise, we'll get the message “This username may be incorrect.”
D:\ Initial Recon> Automating Validation
Username Validation
https://github.com/0xZDH/Omnispray
Password Validation
Credential stuffing and password spraying attacks are definitely noisy(locking accounts), and so it's often worth exploring other options
Expanding Attack Surface
D:\ Expanding Attack Surface > mindset
Some good questions to ask after gaining a foothold with a compromised user
D:\ Expanding Attack Surface> Leveraging AzureAD Module
Enumerate All directory users
Get-AzureADUser -All $true
Gather information about a particular user
Get-AzureADUser -ObjectId yuki.tanaka@megabigtech.com | fl *
Search for user created resources
Get-AzureADUser -ObjectId yuki.tanaka@megabigtech.com | Get-AzureADUserCreatedObject
Enumerate resources owned by the current user
Get-AzureADUserOwnedObject -ObjectId yuki.tanaka@megabigtech.com
D:\ Expanding Attack Surface > Groups
Checking if the user is part of any groups
Get-AzureADUserMembership -ObjectId yuki.tanaka@megabigtech.com
��
�
D:\ Expanding Attack Surface> Leveraging Az Module
List what resources the current user has access to
Get-AzResource
Enumerate RBAC permissions the user has over the WebApp
Get-AzRoleAssignment -SignInName <user>
D:\ Expanding Attack Surface > App Service
Azure App Service is a Platform as a Service (PaaS) offering that enables developers to build and host web apps, mobile back ends, and RESTful APIs in the programming language of their choice without managing infrastructure.
Azure App Service offers auto-scaling and high availability, supports both Windows and Linux, and enables automated deployments from GitHub and Azure DevOps,
Website Contributor has access to Kudu. Kudu is the engine behind a number of features in Azure App Service and behind every App Service Web App is a KUDU Console that is used for debugging and monitoring. The important aspect here is if the web app is interacting with other services such as Azure SQL, Storage Account or Key Vault, then we will be able to access them in the privileged context of the app.
D:\ Expanding Attack Surface > Leveraging AzWebApp
Enumerating Interesting information about the Web App
Get-AzWebApp -Name megabigtechdevapp23 | select enabledhostnames
Source Control Manager, otherwise known as Kudu is the engine behind some features in Azure App Service that are related to source-control-based deployment and other deployment methods, like Dropbox and OneDrive sync.
D:\ Expanding Attack Surface > Hands On
Lateral Movement & Exploitation
D:\ Lateral Movement & Exploitation > Mindset
The Web App may be configured to connect to backend resources using a managed identity (which is the best practice). In which case we can check if environment variables like IDENTITY_ENDPOINT and IDENTITY_HEADER are present as those are required by Managed identity
https://github.com/ed2kurObi/HackMSI
Another option when configuring the web app is to use a connection string that is stored as an environment variable.
D:\ Lateral Movement & Exploitation > Hands On
D:\ Attack Path
D:\ Questions?