Translated ['src/pentesting-cloud/aws-security/aws-privilege-escalation/

This commit is contained in:
Translator
2025-01-05 22:58:03 +00:00
parent 3f050b1d2b
commit 83063f718e
5 changed files with 296 additions and 25 deletions

View File

@@ -0,0 +1,109 @@
# Az - Static Web Apps
{{#include ../../../banners/hacktricks-training.md}}
## Static Web Apps Basic Information
Azure Static Web Apps एक क्लाउड सेवा है जो **GitHub जैसे रिपॉजिटरी से स्वचालित CI/CD के साथ स्थिर वेब ऐप्स को होस्ट करने** के लिए है। यह वैश्विक सामग्री वितरण, सर्वरलेस बैकएंड, और अंतर्निहित HTTPS प्रदान करता है, जिससे यह सुरक्षित और स्केलेबल बनता है। हालाँकि, जोखिमों में गलत कॉन्फ़िगर किया गया CORS, अपर्याप्त प्रमाणीकरण, और सामग्री में छेड़छाड़ शामिल हैं, जो यदि सही तरीके से प्रबंधित नहीं किया गया तो ऐप्स को XSS और डेटा लीक जैसे हमलों के लिए उजागर कर सकते हैं।
> [!TIP]
> जब एक स्थिर ऐप बनाया जाता है, तो आप **डिप्लॉयमेंट प्राधिकरण नीति** के बीच **डिप्लॉयमेंट टोकन** और **GitHub Actions वर्कफ़्लो** चुन सकते हैं।
### Web App Authentication
वेब ऐप तक पहुँचने के लिए **एक पासवर्ड कॉन्फ़िगर करना** संभव है। वेब कंसोल इसे केवल स्टेजिंग वातावरण या स्टेजिंग और उत्पादन दोनों को सुरक्षित करने के लिए कॉन्फ़िगर करने की अनुमति देता है।
यह इस तरह है कि लेखन के समय एक पासवर्ड-संरक्षित वेब ऐप कैसा दिखता है:
<figure><img src="../../../images/azure_static_password.png" alt=""><figcaption></figcaption></figure>
यह देखना संभव है **यदि कोई पासवर्ड उपयोग किया जा रहा है** और कौन से वातावरण सुरक्षित हैं:
```bash
az rest --method GET \
--url "/subscriptions/<subscription-id>/resourceGroups/Resource_Group_1/providers/Microsoft.Web/staticSites/<app-name>/config/basicAuth?api-version=2024-04-01"
```
हालांकि, यह **पासवर्ड को स्पष्ट पाठ में नहीं दिखाएगा**, केवल कुछ इस तरह: `"password": "**********************"`
### Routes
Routes **यह परिभाषित करते हैं कि आने वाले HTTP अनुरोधों को कैसे संभाला जाता है** एक स्थिर वेब ऐप के भीतर। **`staticwebapp.config.json`** फ़ाइल में कॉन्फ़िगर किए गए, वे URL पुनर्लेखन, पुनर्निर्देश, पहुँच प्रतिबंध, और भूमिका-आधारित प्राधिकरण को नियंत्रित करते हैं, उचित संसाधन प्रबंधन और सुरक्षा सुनिश्चित करते हैं।
कुछ उदाहरण:
```json
{
"routes": [
{
"route": "/",
"rewrite": "/index.html"
},
{
"route": "/about",
"rewrite": "/about.html"
},
{
"route": "/api/*",
"allowedRoles": ["authenticated"]
},
{
"route": "/admin",
"redirect": "/login",
"statusCode": 302
}
],
"navigationFallback": {
"rewrite": "/index.html",
"exclude": ["/api/*", "/assets/*"]
}
}
```
## Enumeration
```bash
# List Static Webapps
az staticwebapp list --output table
# Get Static Webapp details
az staticwebapp show --name <name> --resource-group <res-group> --output table
# Get appsettings
az staticwebapp appsettings list --name <name>
# Get env information
az staticwebapp environment list --name <name>
az staticwebapp environment functions --name <name>
# Get API key
az staticwebapp secrets list --name <name>
# Get invited users
az staticwebapp users list --name <name>
# Get database connections
az rest --method GET \
--url "https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<res-group>/providers/Microsoft.Web/staticSites/<app-name>/databaseConnections?api-version=2021-03-01"
## Once you have the database connection name ("default" by default) you can get the connection string with the credentials
az rest --method POST \
--url "https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<res-group>/providers/Microsoft.Web/staticSites/<app-name>/databaseConnections/default/show?api-version=2021-03-01"
```
## Web Apps बनाने के उदाहरण
आप निम्नलिखित लिंक में एक अच्छा उदाहरण पा सकते हैं: [https://learn.microsoft.com/en-us/azure/static-web-apps/get-started-portal?tabs=react&pivots=github](https://learn.microsoft.com/en-us/azure/static-web-apps/get-started-portal?tabs=react&pivots=github)
1. रिपॉजिटरी https://github.com/staticwebdev/react-basic/generate को अपने GitHub खाते में फोर्क करें और इसका नाम `my-first-static-web-app` रखें
2. Azure पोर्टल में एक Static Web App बनाएं, Github एक्सेस कॉन्फ़िगर करें और पहले फोर्क की गई नई रिपॉजिटरी का चयन करें
3. इसे बनाएं, और कुछ मिनट प्रतीक्षा करें, और अपनी नई पृष्ठ की जांच करें!
## पोस्ट एक्सप्लोइटेशन
{{#ref}}
../az-privilege-escalation/az-static-web-apps-post-exploitation.md
{{#endref}}
## संदर्भ
- [https://learn.microsoft.com/en-in/azure/app-service/overview](https://learn.microsoft.com/en-in/azure/app-service/overview)
- [https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans](https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans)
{{#include ../../../banners/hacktricks-training.md}}