Az - Logic Apps Post Exploitation

Tip

学习并练习 AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
学习并练习 GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
学习并练习 Az Hacking: HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks

Logic Apps 数据库后渗透

有关逻辑应用的更多信息,请查看:

Az - Logic Apps

Microsoft.Logic/workflows/read, Microsoft.Logic/workflows/write && Microsoft.ManagedIdentity/userAssignedIdentities/assign/action

通过这些权限,您可以修改逻辑应用工作流并管理其身份。具体而言,您可以将系统分配和用户分配的托管身份分配或移除到工作流,这使得逻辑应用能够在没有显式凭据的情况下进行身份验证并访问其他 Azure 资源。

az logic workflow identity remove/assign \
--name <workflow_name> \
--resource-group <resource_group_name> \
--system-assigned true \
--user-assigned "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<identity_name>"

此外,仅使用 Microsoft.Logic/workflows/write,您可以更改一些配置,例如允许的入站 IP 地址或运行历史保留天数:

az rest --method PUT \
--uri "https://management.azure.com/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.Logic/workflows/<workflow_name>?api-version=2019-05-01" \
--headers "Content-Type=application/json" \
--body '{
"location": "<location>",
"properties": {
"state": "Enabled",
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"triggers": {
"<trigger_name>": {
"type": "Request",
"kind": "Http"
}
},
"actions": {},
"outputs": {}
},
"runtimeConfiguration": {
"lifetime": {
"unit": "day",
"count": <count>
}
},
"accessControl": {
"triggers": {
"allowedCallerIpAddresses": []
},
"actions": {
"allowedCallerIpAddresses": []
}
}
}
}'

Microsoft.Web/sites/read, Microsoft.Web/sites/write

拥有这些权限,您可以创建或更新托管在应用服务计划上的逻辑应用。这包括修改设置,例如启用或禁用 HTTPS 强制执行。

az logicapp update \
--resource-group <resource_group_name> \
--name <logic_app_name> \
--set httpsOnly=false

Microsoft.Web/sites/stop/action, Microsoft.Web/sites/start/action || Microsoft.Web/sites/restart/action

拥有此权限,您可以启动/停止/重启一个 web 应用,包括托管在应用服务计划上的 Logic Apps。此操作确保之前停止的应用程序重新上线并恢复其功能。这可能会干扰工作流程,触发意外操作,或通过意外启动、停止或重启 Logic Apps 导致停机。

az webapp start/stop/restart \
--name <logic_app_name> \
--resource-group <resource_group_name>

Microsoft.Web/sites/config/list/action, Microsoft.Web/sites/read && Microsoft.Web/sites/config/write

通过此权限,您可以配置或修改 Web 应用的设置,包括托管在应用服务计划上的逻辑应用。这允许更改应用设置、连接字符串、身份验证配置等。

az logicapp config appsettings set \
--name <logic_app_name> \
--resource-group <resource_group_name> \
--settings "<key>=<value>"

Microsoft.Logic/integrationAccounts/write

拥有此权限,您可以创建、更新或删除 Azure Logic Apps 集成帐户。这包括管理集成帐户级别的配置,如映射、模式、合作伙伴、协议等。

az logic integration-account create \
--resource-group <resource_group_name> \
--name <integration_account_name> \
--location <location> \
--sku <Standard|Free> \
--state Enabled

Microsoft.Resources/subscriptions/resourcegroups/read && Microsoft.Logic/integrationAccounts/batchConfigurations/write

通过此权限,您可以在 Azure Logic Apps 集成帐户中创建或修改批处理配置。批处理配置定义了 Logic Apps 如何处理和分组传入消息以进行批处理。

az logic integration-account batch-configuration create \
--resource-group <resource_group_name> \
--integration-account-name <integration_account_name> \
--name <batch_configuration_name> \
--release-criteria '{
"messageCount": 100,
"batchSize": 1048576,
}'

Microsoft.Resources/subscriptions/resourcegroups/read && Microsoft.Logic/integrationAccounts/maps/write

拥有此权限,您可以在 Azure Logic Apps 集成帐户中创建或修改映射。映射用于将数据从一种格式转换为另一种格式,从而实现不同系统和应用程序之间的无缝集成。

az logic integration-account map create \
--resource-group <resource_group_name> \
--integration-account-name <integration_account_name> \
--name <map_name> \
--map-type <Xslt|Xslt20|Xslt30> \
--content-type application/xml \
--map-content map-content.xslt

Microsoft.Resources/subscriptions/resourcegroups/read && Microsoft.Logic/integrationAccounts/partners/write

通过此权限,您可以在 Azure Logic Apps 集成帐户中创建或修改合作伙伴。合作伙伴代表参与企业对企业 (B2B) 工作流的实体或系统。

az logic integration-account partner create \
--resource-group <resource_group_name> \
--integration-account-name <integration_account_name> \
--name <partner_name> \
--partner-type <partner-type> \
--content '{
"b2b": {
"businessIdentities": [
{
"qualifier": "ZZ",
"value": "TradingPartner1"
}
]
}
}'

Microsoft.Resources/subscriptions/resourcegroups/read && Microsoft.Logic/integrationAccounts/sessions/write

拥有此权限,您可以在 Azure Logic Apps 集成帐户中创建或修改会话。会话用于 B2B 工作流,以在定义的时间段内对消息进行分组并跟踪相关交易。

az logic integration-account session create \
--resource-group <resource_group_name> \
--integration-account-name <integration_account_name> \
--name <session_name> \
--content '{
"properties": {
"sessionId": "session123",
"data": {
"key1": "value1",
"key2": "value2"
}
}
}'

Microsoft.Logic/workflows/regenerateAccessKey/action

具有此权限的用户能够重新生成 Logic App 访问密钥,如果被滥用,可能会导致服务中断。

az rest --method POST \
--uri "https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Logic/workflows/<workflow-name>/regenerateAccessKey?api-version=<api-version>" \
--body '{"keyType": "<key-type>"}' \
--headers "Content-Type=application/json"

“*/delete”

凭借这些权限,您可以删除与 Azure Logic Apps 相关的资源

Tip

学习并练习 AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
学习并练习 GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
学习并练习 Az Hacking: HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks