# Install dependenciespipinstall'dsnap[cli]'brewinstallvagrantbrewinstallvirtualbox# Get snapshot from imagemkdirsnap_wordir; cdsnap_workdirdsnapinit## Download a snapshot of the volume of that instance## If no snapshot existed it will try to create onedsnapget<instance-id>dsnap--profiledefault--regioneu-west-1geti-0d706e33814c1ef9a## Other way to get a snapshotdsnaplist#List snapshotsdsnapgetsnap-0dbb0347f47e38b96#Download snapshot directly# Run with vagrantIMAGE="<download_file>.img"vagrantup#Run image with vagrant+virtuaboxIMAGE="<download_file>.img"vagrantssh#Access the VMvagrantdestroy#To destoy# Run with dockergitclonehttps://github.com/RhinoSecurityLabs/dsnap.gitcddsnapmakedocker/buildIMAGE="<download_file>.img"makedocker/run#With the snapshot downloaded
참고 : dsnap은 공개 스냅샷을 다운로드할 수 없게 합니다. 이를 우회하기 위해 개인 계정에 스냅샷을 복사하고 해당 스냅샷을 다운로드할 수 있습니다:
# Copy the snapshotaws ec2 copy-snapshot --source-region us-east-2 --source-snapshot-id snap-09cf5d9801f231c57 --destination-region us-east-2 --description "copy of snap-09cf5d9801f231c57"
# View the snapshot infoawsec2describe-snapshots--owner-idsself--regionus-east-2# Download the snapshot. The ID is the copy from your accountdsnap--regionus-east-2getsnap-027da41be451109da# Delete the snapshot after downloadingawsec2delete-snapshot--snapshot-idsnap-027da41be451109da--regionus-east-2
단계 2: 생성된 볼륨을 마우스 오른쪽 버튼으로 클릭하여 "볼륨 연결" 옵션을 선택합니다.
단계 3: 인스턴스 텍스트 상자에서 인스턴스를 선택합니다.
이 작업을 수행하려면 다음 명령을 사용하세요:
EBS 볼륨을 연결합니다.
단계 4: EC2 인스턴스에 로그인하고 lsblk 명령을 사용하여 사용 가능한 디스크를 나열합니다.
단계 5: sudo file -s /dev/xvdf 명령을 사용하여 볼륨에 데이터가 있는지 확인합니다.
위 명령의 출력이 "/dev/xvdf: data"를 보여주면 볼륨이 비어 있다는 것을 의미합니다.
단계 6: sudo mkfs -t ext4 /dev/xvdf 명령을 사용하여 볼륨을 ext4 파일 시스템으로 포맷합니다. 또는 sudo mkfs -t xfs /dev/xvdf 명령을 사용하여 xfs 형식을 사용할 수도 있습니다. ext4 또는 xfs 중 하나를 사용해야 합니다.
단계 7: 새로운 ext4 볼륨을 마운트할 디렉토리를 만듭니다. 예를 들어 "newvolume"이라는 이름을 사용할 수 있습니다.
이 작업을 수행하려면 sudo mkdir /newvolume 명령을 사용하세요.
단계 8: sudo mount /dev/xvdf /newvolume/ 명령을 사용하여 볼륨을 "newvolume" 디렉토리에 마운트합니다.
단계 9: "newvolume" 디렉토리로 이동하여 디스크 공간을 확인하여 볼륨 마운트를 유효성 검사합니다.
이 작업을 수행하려면 다음 명령을 사용하세요:
/newvolume로 디렉토리 변경합니다.
df -h . 명령을 사용하여 디스크 공간을 확인합니다. 이 명령의 출력은 "newvolume" 디렉토리의 빈 공간을 보여야 합니다.
Pacu를 사용하여 ebs__explore_snapshots 모듈을 사용하여 이 작업을 수행할 수 있습니다.
AWS에서 스냅샷 확인 (cli 사용)
awsec2create-volume--availability-zoneus-west-2a--regionus-west-2--snapshot-id<snap-0b49342abd1bdcb89># Attach new volume to instanceawsec2attach-volume--device/dev/sdh--instance-id<INSTANCE-ID>--volume-id<VOLUME-ID># mount the snapshot from within the VMsudofile-s/dev/sdh/dev/sdh:symboliclinkto`xvdh'sudo file -s /dev/xvdh/dev/xvdh: x86 boot sector; partition 1: ID=0xee, starthead 0, startsector 1, 16777215 sectors, extended partition table (last)\011, code offset 0x63
lsblk /dev/xvdhNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTxvdh 202:112 0 8G 0 disk├─xvdh1 202:113 0 7.9G 0 part├─xvdh14 202:126 0 4M 0 part└─xvdh15 202:127 0 106M 0 partsudo mount /dev/xvdh1 /mntls /mnt
그림자 복사
EC2:CreateSnapshot 권한을 가진 모든 AWS 사용자는 도메인 컨트롤러의 스냅샷을 생성하여 해당 인스턴스에 연결하고 Impacket의 secretsdump 프로젝트에서 사용하기 위해 NTDS.dit 및 SYSTEM 레지스트리 하이브 파일을 내보내어 모든 도메인 사용자의 해시를 도용할 수 있습니다.