mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-17 15:21:52 -08:00
Translated ['src/pentesting-cloud/aws-security/aws-privilege-escalation/
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
# Az - Statische Web-Apps
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
## Grundinformationen zu statischen Web-Apps
|
||||
|
||||
Azure Static Web Apps ist ein Cloud-Dienst zum Hosten von **statischen Web-Apps mit automatischem CI/CD aus Repositories wie GitHub**. Es bietet globale Inhaltsbereitstellung, serverlose Backends und integriertes HTTPS, was es sicher und skalierbar macht. Zu den Risiken gehören jedoch falsch konfigurierte CORS, unzureichende Authentifizierung und Inhaltsmanipulation, die Apps Angriffen wie XSS und Datenlecks aussetzen können, wenn sie nicht ordnungsgemäß verwaltet werden.
|
||||
|
||||
> [!TIP]
|
||||
> Wenn eine statische App erstellt wird, können Sie die **Bereitstellungsautorisierungspolitik** zwischen **Bereitstellungstoken** und **GitHub Actions-Workflow** wählen.
|
||||
|
||||
|
||||
### Web-App-Authentifizierung
|
||||
|
||||
Es ist möglich, **ein Passwort zu konfigurieren**, um auf die Web-App zuzugreifen. Die Web-Konsole ermöglicht es, dies so zu konfigurieren, dass nur Staging-Umgebungen oder sowohl Staging- als auch Produktionsumgebungen geschützt werden.
|
||||
|
||||
So sieht eine passwortgeschützte Web-App zum Zeitpunkt des Schreibens aus:
|
||||
|
||||
<figure><img src="../../../images/azure_static_password.png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
|
||||
Es ist möglich zu sehen, **ob ein Passwort verwendet wird** und welche Umgebungen geschützt sind mit:
|
||||
```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"
|
||||
```
|
||||
Allerdings **wird das das Passwort nicht im Klartext anzeigen**, sondern nur etwas wie: `"password": "**********************"`.
|
||||
|
||||
### Routen
|
||||
|
||||
Routen definieren **wie eingehende HTTP-Anfragen innerhalb einer statischen Webanwendung behandelt werden**. Konfiguriert in der **`staticwebapp.config.json`**-Datei, steuern sie URL-Umschreibungen, Weiterleitungen, Zugriffsrestriktionen und rollenbasierte Autorisierung, um eine ordnungsgemäße Ressourcenverwaltung und Sicherheit zu gewährleisten.
|
||||
|
||||
Einige Beispiele:
|
||||
```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/*"]
|
||||
}
|
||||
}
|
||||
```
|
||||
## Aufzählung
|
||||
```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"
|
||||
```
|
||||
## Beispiele zur Erstellung von Webanwendungen
|
||||
|
||||
Sie finden ein schönes Beispiel zur Erstellung einer Webanwendung im folgenden Link: [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. Forken Sie das Repository https://github.com/staticwebdev/react-basic/generate in Ihr GitHub-Konto und benennen Sie es in `my-first-static-web-app`
|
||||
2. Erstellen Sie im Azure-Portal eine Static Web App, indem Sie den Zugriff auf GitHub konfigurieren und das zuvor geforkte neue Repository auswählen
|
||||
3. Erstellen Sie es, warten Sie einige Minuten und überprüfen Sie Ihre neue Seite!
|
||||
|
||||
## Post-Exploitation
|
||||
|
||||
{{#ref}}
|
||||
../az-privilege-escalation/az-static-web-apps-post-exploitation.md
|
||||
{{#endref}}
|
||||
|
||||
## Referenzen
|
||||
|
||||
- [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}}
|
||||
Reference in New Issue
Block a user