Az - Azure App Service & Function Apps

Az - Azure App Service & Function Apps

जीरो से हीरो तक AWS हैकिंग सीखें htARTE (HackTricks AWS Red Team Expert)!

HackTricks का समर्थन करने के अन्य तरीके:

App Service Basic Information

दस्तावेज़ से: Azure App Service एक HTTP-आधारित सेवा है जो वेब एप्लिकेशन, REST API और मोबाइल बैक एंड्स को होस्ट करने के लिए है। आप अपनी पसंदीदा भाषा में विकसित कर सकते हैं, जैसे .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 App Services and Function Apps
Get-AzWebApp
# Get only App Services
Get-AzWebApp | ?{$_.Kind -notmatch "functionapp"}

```bash #!/bin/bash

Get all App Service and Function Apps

Define Azure subscription ID

azure_subscription="your_subscription_id"

Log in to Azure

az login

Select Azure subscription

az account set --subscription $azure_subscription

Get all App Services in the specified subscription

list_app_services=$(az appservice list --query "[].{appServiceName: name, group: resourceGroup}" -o tsv)

Iterate over each App Service

echo "$list_app_services" | while IFS=$'\t' read -r appServiceName group; do

Get the type of the App Service

service_type=$(az appservice show --name $appServiceName --resource-group $group --query "kind" -o tsv)

Check if it is a Function App and print its name

if [ "$service_type" == "functionapp" ]; then echo "Function App Name: $appServiceName" fi done

#### प्राप्त क्रेडेंशियल और वेबऐप कोड तक पहुंचें
```bash
# 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

एसएसएच के माध्यम से वेबऐप के साथ डॉकर कंटेनर तक पहुंचें:

# 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

फंक्शन ऐप्स की मूल जानकारी

एज़्यूर फंक्शन्स एक सर्वरलेस समाधान है जो आपको कम कोड लिखने, कम इंफ्रास्ट्रक्चर रखने और खर्चे में बचत करने की अनुमति देता है। सर्वर्स को डिप्लॉय और रखने की चिंता की बजाय, क्लाउड इंफ्रास्ट्रक्चर सभी नवीनतम संसाधन प्रदान करता है जो आपके एप्लिकेशन को चलाने के लिए आवश्यक हैं।

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

फंक्शन ऐप्स मैनेज़्ड आइडेंटिटी का समर्थन करते हैं।

इसके अतिरिक्त, फंक्शन एप्प में कुछ एंडपॉइंट्स हो सकते हैं जिन्हें कुछ स्तर की प्रमाणिकरण आवश्यक हो सकती है, जैसे "एडमिन" या "अनामत". एक हमलावर अनामत अनुमत एंडपॉइंट्स तक पहुंचने की कोशिश कर सकता है ताकि प्रतिबंधों को छलकर संवेदनशील डेटा या कार्यक्षमता तक पहुंच सके।

गणना

# Get only Function Apps
Get-AzFunctionApp

संदर्भ

जानें AWS हैकिंग को शून्य से हीरो तक htARTE (HackTricks AWS Red Team Expert)!

HackTricks का समर्थन करने के अन्य तरीके:

Last updated