Az - File Shares
Reading time: 7 minutes
tip
AWS 해킹 배우기 및 연습하기:HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기: HackTricks Training GCP Red Team Expert (GRTE)
Azure 해킹 배우기 및 연습하기:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks 지원하기
- 구독 계획 확인하기!
- **💬 Discord 그룹 또는 텔레그램 그룹에 참여하거나 Twitter 🐦 @hacktricks_live를 팔로우하세요.
- HackTricks 및 HackTricks Cloud 깃허브 리포지토리에 PR을 제출하여 해킹 트릭을 공유하세요.
기본 정보
Azure Files는 표준 SMB (Server Message Block) 및 NFS (Network File System) 프로토콜을 통해 접근할 수 있는 공유 파일 저장소를 제공하는 완전 관리형 클라우드 파일 저장 서비스입니다. 주 프로토콜로는 SMB가 사용되지만 NFS Azure 파일 공유는 Windows에서 지원되지 않습니다 (자세한 내용은 docs 참조). 여러 가상 머신(VM) 또는 온프레미스 시스템에서 동시에 접근할 수 있는 고가용성 네트워크 파일 공유를 생성할 수 있어 환경 간 원활한 파일 공유를 가능하게 합니다.
액세스 계층
- 트랜잭션 최적화: 트랜잭션이 많은 작업에 최적화되어 있습니다.
- 핫: 트랜잭션과 저장소 간 균형을 이룹니다.
- 쿨: 저장소에 비용 효율적입니다.
- 프리미엄: 저지연 및 IOPS 집약적인 작업에 최적화된 고성능 파일 저장소입니다.
백업
- 일일 백업: 매일 지정된 시간(예: 19.30 UTC)에 백업 지점이 생성되며 1일에서 200일 동안 저장됩니다.
- 주간 백업: 매주 지정된 날과 시간(일요일 19.30)에 백업 지점이 생성되며 1주에서 200주 동안 저장됩니다.
- 월간 백업: 매월 지정된 날과 시간(예: 첫 번째 일요일 19.30)에 백업 지점이 생성되며 1개월에서 120개월 동안 저장됩니다.
- 연간 백업: 매년 지정된 날과 시간(예: 1월 첫 번째 일요일 19.30)에 백업 지점이 생성되며 1년에서 10년 동안 저장됩니다.
- 수동 백업 및 스냅샷을 언제든지 수행할 수 있습니다. 이 맥락에서 백업과 스냅샷은 실제로 동일합니다.
SMB를 통한 지원되는 인증
- 온프레미스 AD DS 인증: 온프레미스 Active Directory 자격 증명을 사용하여 Microsoft Entra ID와 동기화된 신원 기반 액세스를 제공합니다. 온프레미스 AD DS에 대한 네트워크 연결이 필요합니다.
- Microsoft Entra 도메인 서비스 인증: Microsoft Entra 자격 증명을 사용하여 액세스를 제공하기 위해 Microsoft Entra 도메인 서비스(클라우드 기반 AD)를 활용합니다.
- 하이브리드 ID를 위한 Microsoft Entra Kerberos: Microsoft Entra 사용자가 Kerberos를 사용하여 인터넷을 통해 Azure 파일 공유를 인증할 수 있게 합니다. 온프레미스 도메인 컨트롤러에 대한 연결 없이 하이브리드 Microsoft Entra 가입 또는 Microsoft Entra 가입 VM을 지원합니다. 그러나 클라우드 전용 ID는 지원하지 않습니다.
- Linux 클라이언트를 위한 AD Kerberos 인증: Linux 클라이언트가 온프레미스 AD DS 또는 Microsoft Entra 도메인 서비스를 통해 SMB 인증을 위해 Kerberos를 사용할 수 있게 합니다.
열거
# Get storage accounts
az storage account list #Get the account name from here
# List file shares
az storage share list --account-name <name>
az storage share-rm list --storage-account <name> # To see the deleted ones too --include-deleted
# Get dirs/files inside the share
az storage file list --account-name <name> --share-name <share-name>
## If type is "dir", you can continue enumerating files inside of it
az storage file list --account-name <name> --share-name <prev_dir/share-name>
# Download a complete share (with directories and files inside of them)
az storage file download-batch -d . --source <share-name> --account-name <name>
# List snapshots
az storage share snapshot --name <share-name>
# List file shares, including deleted ones
az rest --method GET \
--url "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{storageAccountName}/fileServices/default/shares?%24skipToken=&%24maxpagesize=20&%24filter=&%24expand=deleted&api-version=2019-06-01"
# Get snapshots/backups
az storage share list --account-name <name> --include-snapshots --query "[?snapshot != null]"
# List contents of a snapshot/backup
az storage file list --account-name <name> --share-name <share-name> --snapshot <snapshot-version> #e.g. "2024-11-25T11:26:59.0000000Z"
# Download snapshot/backup
az storage file download-batch -d . --account-name <name> --source <share-name> --snapshot <snapshot-version>
note
기본적으로 az
cli는 계정 키를 사용하여 키에 서명하고 작업을 수행합니다. Entra ID 주체 권한을 사용하려면 --auth-mode login --enable-file-backup-request-intent
매개변수를 사용하십시오.
tip
사용할 계정 키를 나타내려면 --account-key
매개변수를 사용하십시오.
SAS 토큰을 사용하여 액세스하려면 --sas-token
매개변수를 사용하십시오.
연결
다음은 작성 시점에 Azure에서 제안한 파일 공유에 연결하기 위한 스크립트입니다:
<STORAGE-ACCOUNT>
, <ACCESS-KEY>
및 <FILE-SHARE-NAME>
자리 표시자를 교체해야 합니다.
$connectTestResult = Test-NetConnection -ComputerName filescontainersrdtfgvhb.file.core.windows.net -Port 445
if ($connectTestResult.TcpTestSucceeded) {
# Save the password so the drive will persist on reboot
cmd.exe /C "cmdkey /add:`"<STORAGE-ACCOUNT>.file.core.windows.net`" /user:`"localhost\<STORAGE-ACCOUNT>`" /pass:`"<ACCESS-KEY>`""
# Mount the drive
New-PSDrive -Name Z -PSProvider FileSystem -Root "\\<STORAGE-ACCOUNT>.file.core.windows.net\<FILE-SHARE-NAME>" -Persist
} else {
Write-Error -Message "Unable to reach the Azure storage account via port 445. Check to make sure your organization or ISP is not blocking port 445, or use Azure P2S VPN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port."
}
정기 저장소 열거 (액세스 키, SAS...)
권한 상승
저장소 권한 상승과 동일:
포스트 익스플로잇
Az - File Share Post Exploitation
지속성
저장소 지속성과 동일:
tip
AWS 해킹 배우기 및 연습하기:HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 배우기 및 연습하기: HackTricks Training GCP Red Team Expert (GRTE)
Azure 해킹 배우기 및 연습하기:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks 지원하기
- 구독 계획 확인하기!
- **💬 Discord 그룹 또는 텔레그램 그룹에 참여하거나 Twitter 🐦 @hacktricks_live를 팔로우하세요.
- HackTricks 및 HackTricks Cloud 깃허브 리포지토리에 PR을 제출하여 해킹 트릭을 공유하세요.