Az - Azure App Service & Function Apps

Supporta HackTricks

Informazioni di base sull'App Service

Dal documento: Azure App Service è un servizio basato su HTTP per l'hosting di applicazioni web, API REST e back end mobili. Puoi sviluppare nel tuo linguaggio preferito, sia esso .NET, .NET Core, Java, Ruby, Node.js, PHP o Python. Le applicazioni funzionano e scalano facilmente sia in ambienti basati su Windows che su Linux.

Ogni app funziona all'interno di un sandbox, ma l'isolamento dipende dai piani dell'App Service

  • Le app nei livelli Free e Shared funzionano su VM condivise

  • Le app nei livelli Standard e Premium funzionano su VM dedicate

Nota che nessuno di questi isolamenti previene altre comuni vulnerabilità web (come il caricamento di file o le iniezioni). E se viene utilizzata un'identità di gestione, potrebbe essere in grado di compromettere le sue autorizzazioni.

Enumerazione

# List webapps
az webapp list

## Less information
az webapp list --query "[].{hostName: defaultHostName, state: state, name: name, resourcegroup: resourceGroup}"

# Get access restrictions
az webapp config access-restriction show --resource-group <res-group> -n <name>

# Remove access restrictions
az webapp config access-restriction remove --resource-group <res-group> -n <name> --rule-name <rule-name>

# Get snapshots
az webapp config snapshot list --resource-group <res-group> -n <name>

# Restore snapshot
az webapp config snapshot restore -g <res-group> -n <name> --time 2018-12-11T23:34:16.8388367

# Restart webapp
az webapp restart --name <name> --resource-group <res-group>

Ottenere credenziali e accedere al codice dell'app web

# Get connection strings that could contain credentials (with DBs for example)
az webapp config connection-string list --name <name> --resource-group <res-group>
## Check how to use the DBs connection strings in the SQL page

# Get credentials to access the code and DB credentials if configured.
az webapp deployment list-publishing-profiles --resource-group <res-group> -n <name>


# Get git URL to access the code
az webapp deployment source config-local-git --resource-group <res-group> -n <name>

# Access/Modify the code via git
git clone 'https://<username>:<password>@name.scm.azurewebsites.net/repo-name.git'
## In my case the username was: $nameofthewebapp and the password some random chars
## If you change the code and do a push, the app is automatically redeployed

Accesso al contenitore Docker con l'app web tramite ssh:

# Get ssh session
az webapp create-remote-connection --subscription <SUBSCRIPTION-ID> --resource-group <RG-NAME> -n <APP-SERVICE-NAME>

## If successfull you will get a message such as:
#Verifying if app is running....
#App is running. Trying to establish tunnel connection...
#Opening tunnel on port: 39895
#SSH is available { username: root, password: Docker! }

## So from that machine ssh into that port (you might need generate a new ssh session to the jump host)
ssh root@127.0.0.1 -p 39895

Informazioni di Base sulle Function Apps

Azure Functions è una soluzione serverless che ti consente di scrivere meno codice, mantenere meno infrastruttura e risparmiare sui costi. Invece di preoccuparti di distribuire e mantenere server, l'infrastruttura cloud fornisce tutte le risorse aggiornate necessarie per mantenere le tue applicazioni in esecuzione.

Nel portale di Azure, l'integrazione tra Azure Functions e Azure API Management è facilitata, consentendo che i punti finali delle funzioni attivate da HTTP siano esposti come API REST. Le API esposte in questo modo sono descritte utilizzando una definizione OpenAPI, fornendo un'interfaccia standard, indipendente dal linguaggio, per le API RESTful.

Le Function Apps supportano le Identità Gestite.

Inoltre, la Function App potrebbe avere determinati punti finali che richiedono un certo livello di autenticazione, come "admin" o "anonymous". Un attaccante potrebbe cercare di accedere ai punti finali consentiti per gli anonimi per eludere le restrizioni e ottenere accesso a dati o funzionalità sensibili.

Enumerazione

# Get only Function Apps
Get-AzFunctionApp

Riferimenti

Supporta HackTricks

Last updated