Az - Azure App Service & Function Apps

Support HackTricks

App Service Basic Information

From the docs: Azure App Service एक HTTP-आधारित सेवा है जो वेब अनुप्रयोगों, REST APIs, और मोबाइल बैक एंड्स को होस्ट करने के लिए है। आप अपनी पसंदीदा भाषा में विकास कर सकते हैं, चाहे वह .NET, .NET Core, Java, Ruby, Node.js, PHP, या Python हो। अनुप्रयोग Windows और Linux-आधारित वातावरण पर आसानी से चलते हैं और स्केल करते हैं।

प्रत्येक ऐप एक सैंडबॉक्स के अंदर चलता है लेकिन अलगाव App Service योजनाओं पर निर्भर करता है

  • फ्री और शेयर किए गए स्तरों में ऐप साझा किए गए VMs पर चलते हैं

  • स्टैंडर्ड और प्रीमियम स्तरों में ऐप समर्पित VMs पर चलते हैं

ध्यान दें कि कोई भी उन अलगावों में से अन्य सामान्य वेब कमजोरियों (जैसे फ़ाइल अपलोड, या इंजेक्शन) को रोकता नहीं है। और यदि एक प्रबंधन पहचान का उपयोग किया जाता है, तो यह अपनी अनुमतियों को समझौता कर सकता है।

Enumeration

# 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>

क्रेडेंशियल प्राप्त करें और वेबऐप कोड तक पहुँच प्राप्त करें

# 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

वेबऐप के साथ डॉकर कंटेनर तक 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

Function Apps Basic Information

Azure Functions एक serverless समाधान है जो आपको कम कोड लिखने, कम बुनियादी ढांचे को बनाए रखने और लागत बचाने की अनुमति देता है। सर्वरों को तैनात करने और बनाए रखने की चिंता करने के बजाय, क्लाउड बुनियादी ढांचा आपके अनुप्रयोगों को चलाने के लिए आवश्यक सभी अद्यतन संसाधन प्रदान करता है।

Azure पोर्टल में, Azure Functions और Azure API Management के बीच एकीकरण को सुगम बनाया गया है, जिससे HTTP ट्रिगर फ़ंक्शन एंडपॉइंट्स को REST APIs के रूप में उजागर किया जा सकता है। इस तरीके से उजागर की गई APIs को OpenAPI परिभाषा का उपयोग करके वर्णित किया गया है, जो RESTful APIs के लिए एक मानक, भाषा-स्वतंत्र इंटरफ़ेस प्रदान करता है।

Function Apps प्रबंधित पहचान का समर्थन करते हैं।

इसके अलावा, Function App में कुछ एंडपॉइंट हो सकते हैं जिन्हें "admin" या "anonymous" जैसे एक निश्चित स्तर की प्रमाणीकरण की आवश्यकता होती है। एक हमलावर anonymous allowed endpoints तक पहुँचने की कोशिश कर सकता है ताकि प्रतिबंधों को बायपास किया जा सके और संवेदनशील डेटा या कार्यक्षमता तक पहुँच प्राप्त की जा सके।

Enumeration

# Get only Function Apps
Get-AzFunctionApp

संदर्भ

HackTricks का समर्थन करें

Last updated