Az - Functions App Privesc
Last updated
Last updated
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Check the following page for more information:
Az - Function AppsThis permission allows to list the function, master and system keys, but not the host one, of the specified function with:
This permission allows to get the host key, of the specified function with:
This permission allows to create/update a function key to the specified function with:
This permission allows to create/update a master key to the specified function with:
This permission allows to create/update a system function key to the specified function with:
This permission allows to get the environmental variables of a function. Inside these variables it might be possible to find the default env variables AzureWebJobsStorage
or WEBSITE_CONTENTAZUREFILECONNECTIONSTRING
which actually contains an account key to access the blob storage of the function with FULL permissions.
Microsoft.Web/sites/publishxml/action, (Microsoft.Web/sites/basicPublishingCredentialsPolicies/write)
This permissions allows to list all the publishing profiles which basically contains basic auth credentials:
Method SCM
Then, you can access with these basic auth credentials to the SCM URL of your function app and get the values of the env variables:
Note that the SCM username is usually the char "$" followed by the name of the app, so: $<app-name>
.
And these env variables contains the AccountKey of the storage account storing the data of the function app, allowing to control that storage account.
If you see that those credentials are REDACTED, it's because you need to enable the SCM basic authentication option and for that you need the second permission (Microsoft.Web/sites/basicPublishingCredentialsPolicies/write):
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)