GCP - Filestore Post Exploitation

htARTE (HackTricks AWS Red Team Expert)를 통해 AWS 해킹을 처음부터 전문가까지 배워보세요!

HackTricks를 지원하는 다른 방법:

Filestore

Filestore에 대한 자세한 정보는 다음을 참조하세요:

pageGCP - Filestore Enum

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를 지원하는 다른 방법:

最終更新