Az - Unauthenticated Enum & Initial Entry
Tip
AWS 해킹 학습 및 실습:
HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 학습 및 실습:HackTricks Training GCP Red Team Expert (GRTE)
Az 해킹 학습 및 실습:HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks 지원하기
- 구독 플랜을 확인하세요!
- 참여하세요 💬 Discord group 또는 telegram group에 참여하거나 Twitter 🐦 @hacktricks_live를 팔로우하세요.
- PR을 제출하여 해킹 트릭을 공유하세요: HackTricks 및 HackTricks Cloud github repos.
Azure Tenant
Tenant Enumeration
공격자는 테넌트의 domain만 알고 있어도 조회해서 더 많은 정보를 수집할 수 있는 public Azure APIs가 몇 개 있습니다.
API를 직접 호출하거나 PowerShell 라이브러리 AADInternals (Install-Module AADInternals)을 사용할 수 있습니다:
- 테넌트 ID를 포함한 로그인 정보
Get-AADIntTenantID -Domain <domain>(main APIlogin.microsoftonline.com/<domain>/.well-known/openid-configuration)- 테넌트의 모든 유효 도메인
Get-AADIntTenantDomains -Domain <domain>(main APIautodiscover-s.outlook.com/autodiscover/autodiscover.svc)- 사용자의 로그인 정보.
NameSpaceType이Managed이면 EntraID가 사용된다는 의미입니다 Get-AADIntLoginInformation -UserName <UserName>(main APIlogin.microsoftonline.com/GetUserRealm.srf?login=<UserName>)
Azure 테넌트의 모든 정보를 AADInternals의 단 한 명령으로 조회할 수 있습니다:
# Doesn't work in macos because 'Resolve-DnsName' doesn't exist
Invoke-AADIntReconAsOutsider -DomainName corp.onmicrosoft.com | Format-Table
## Output Example of the Azure tenant info:
Tenant brand: Company Ltd
Tenant name: company
Tenant id: 1937e3ab-38de-a735-a830-3075ea7e5b39
DesktopSSO enabled: True
Name DNS MX SPF Type STS
---- --- -- --- ---- ---
company.com True True True Federated sts.company.com
company.mail.onmicrosoft.com True True True Managed
company.onmicrosoft.com True True True Managed
int.company.com False False False Managed
tenant의 이름, ID, 그리고 “brand” 이름에 대한 세부 정보를 확인할 수 있습니다. 또한 Desktop Single Sign-On (SSO), Seamless SSO라고도 불리는 기능의 상태가 표시됩니다. 활성화되어 있으면 이 기능은 대상 조직 내 특정 사용자의 존재(즉, enumeration)를 판별하는 데 도움이 됩니다.
또한 출력에는 대상 tenant와 연결된 모든 verified domains의 이름과 각 도메인의 identity types가 표시됩니다. Federated domains의 경우 일반적으로 ADFS 서버인 identity provider의 FQDN도 공개됩니다. “MX” 열은 이메일이 Exchange Online으로 라우팅되는지 여부를 표시하고, “SPF” 열은 Exchange Online이 이메일 발신자로 등록되어 있는지를 나타냅니다. 현재 reconnaissance 기능은 SPF records 내 “include” 문장을 파싱하지 않으므로 false negatives가 발생할 수 있다는 점에 유의하세요.
User Enumeration
Tip
tenant가 동일한 사용자에 대해 여러 이메일을 사용하더라도, username은 유일하다는 점에 유의하세요. 즉, 이는 사용자가 연관시킨 domain에서만 작동하며 다른 domains에서는 작동하지 않습니다.
tenant 내부에 username이 존재하는지 확인할 수 있습니다. 이에는 또한 guest users도 포함되며, 이들의 username 형식은 다음과 같습니다:
<email>#EXT#@<tenant name>.onmicrosoft.com
이 이메일은 사용자의 이메일 주소이며 “@”가 밑줄(“_”)로 대체되어 있습니다.
With AADInternals, 사용자가 존재하는지 여부를 쉽게 확인할 수 있습니다:
# Check does the user exist
Invoke-AADIntUserEnumerationAsOutsider -UserName "user@company.com"
원본 README.md 내용을 붙여 넣어 주세요. 파일 내용이 있어야 번역을 수행할 수 있습니다.
UserName Exists
-------- ------
user@company.com True
또한 한 줄에 하나의 이메일 주소가 포함된 텍스트 파일을 사용할 수도 있습니다:
user@company.com
user2@company.com
admin@company.com
admin2@company.com
external.user_gmail.com#EXT#@company.onmicrosoft.com
external.user_outlook.com#EXT#@company.onmicrosoft.com
# Invoke user enumeration
Get-Content .\users.txt | Invoke-AADIntUserEnumerationAsOutsider -Method Normal
현재 선택할 수 있는 4가지 다른 열거 방법이 있습니다. 자세한 내용은 Get-Help Invoke-AADIntUserEnumerationAsOutsider에서 확인할 수 있습니다:
It supports following enumeration methods: Normal, Login, Autologon, and RST2.
-
The Normal method seems currently work with all tenants. Previously it required Desktop SSO (aka Seamless SSO) to be enabled for at least one domain.
-
The Login method works with any tenant, but enumeration queries will be logged to Azure AD sign-in log as failed login events!
-
The Autologon method doesn’t seem to work with all tenants anymore. Probably requires that DesktopSSO or directory sync is enabled.
유효한 사용자 이름을 찾은 후에는 다음을 통해 사용자에 대한 정보를 얻을 수 있습니다:
Get-AADIntLoginInformation -UserName root@corp.onmicrosoft.com
이 o365spray 스크립트는 또한 이메일이 유효한지 확인할 수 있습니다.
git clone https://github.com/0xZDH/o365spray
cd o365spray
python3 -m pip install -r requirements.txt
# Check 1 email
python3 ./o365spray.py --enum -d carloshacktricks.onmicrosoft.com -u carlos
# Check a list of emails
python3 ./o365spray.py --enum -d carloshacktricks.onmicrosoft.com -U /tmp/users.txt
Microsoft Teams를 이용한 사용자 열거
또 다른 좋은 정보 출처는 Microsoft Teams입니다.
Microsoft Teams의 API는 사용자를 검색할 수 있게 합니다. 특히 “user search” 엔드포인트 externalsearchv3 및 searchUsers는 Teams에 등록된 사용자 계정에 대한 일반 정보를 요청하는 데 사용할 수 있습니다.
API 응답에 따라 존재하지 않는 사용자와 유효한 Teams 구독을 가진 기존 사용자를 구분할 수 있습니다.
스크립트 TeamsEnum은 주어진 사용자 이름 집합을 Teams API에 대해 검증하는 데 사용할 수 있지만, 이를 사용하려면 Teams에 접근할 수 있는 사용자 계정에 대한 액세스 권한이 필요합니다.
# Install
git clone https://github.com/lucidra-security/TeamsEnum
cd TeamsEnum
python3 -m pip install -r requirements.txt
# Login and ask for password
python3 ./TeamsEnum.py -a password -u <username> -f inputlist.txt -o teamsenum-output.json
번역할 README.md 원본 내용을 여기에 붙여 넣어 주세요. 원문을 받아야 해당 파일의 영어 텍스트를 한국어로 번역해 드릴 수 있습니다.
[-] user1@domain - Target user not found. Either the user does not exist, is not Teams-enrolled or is configured to not appear in search results (personal accounts only)
[+] user2@domain - User2 | Company (Away, Mobile)
[+] user3@domain - User3 | Company (Available, Desktop)
또한 다음과 같은 기존 사용자들의 상태 정보를 열거할 수 있습니다:
- Available
- Away
- DoNotDisturb
- Busy
- Offline
만약 부재중 메시지가 구성되어 있다면, TeamsEnum을 사용해 해당 메시지를 가져올 수도 있습니다. 출력 파일이 지정된 경우, 부재중 메시지들은 자동으로 JSON 파일에 저장됩니다:
jq . teamsenum-output.json
번역할 README.md 내용을 여기에 붙여넣어 주세요.
{
"email": "user2@domain",
"exists": true,
"info": [
{
"tenantId": "[REDACTED]",
"isShortProfile": false,
"accountEnabled": true,
"featureSettings": {
"coExistenceMode": "TeamsOnly"
},
"userPrincipalName": "user2@domain",
"givenName": "user2@domain",
"surname": "",
"email": "user2@domain",
"tenantName": "Company",
"displayName": "User2",
"type": "Federated",
"mri": "8:orgid:[REDACTED]",
"objectId": "[REDACTED]"
}
],
"presence": [
{
"mri": "8:orgid:[REDACTED]",
"presence": {
"sourceNetwork": "Federated",
"calendarData": {
"outOfOfficeNote": {
"message": "Dear sender. I am out of the office until March 23rd with limited access to my email. I will respond after my return.Kind regards, User2",
"publishTime": "2023-03-15T21:44:42.0649385Z",
"expiry": "2023-04-05T14:00:00Z"
},
"isOutOfOffice": true
},
"capabilities": ["Audio", "Video"],
"availability": "Away",
"activity": "Away",
"deviceType": "Mobile"
},
"etagMatch": false,
"etag": "[REDACTED]",
"status": 20000
}
]
}
Password Spraying / Brute-Force
Azure Services가 사용하는 도메인
또한 일반적인 azure 하위 도메인에서 Azure services exposed를 찾으려고 시도할 수도 있습니다. 이는 다음 post: 에 문서화된 것과 같습니다.
- App Services:
azurewebsites.net - App Services – Management:
scm.azurewebsites.net - App Services:
p.azurewebsites.net - App Services:
cloudapp.net - Storage Accounts-Files:
file.core.windows.net - Storage Accounts-Blobs:
blob.core.windows.net - Storage Accounts-Queues:
queue.core.windows.net - Storage Accounts-Tables:
table.core.windows.net - Databases-Redis:
redis.cache.windows.net - Databases-Cosmos DB:
documents.azure.com - Databases-MSSQL:
database.windows.net - Key Vaults:
vault.azure.net - Microsoft Hosted Domain:
onmicrosoft.com - Email:
mail.protection.outlook.com - SharePoint:
sharepoint.com - CDN:
azureedge.net - Search Appliance:
search.windows.net - API Services:
azure-api.net
You can use a method from MicroBust for such goal. This function will search the base domain name (and a few permutations) in several azure domains:
Import-Module .\MicroBurst\MicroBurst.psm1 -Verbose
Invoke-EnumerateAzureSubDomains -Base corp -Verbose
Phishing
- Common Phishing — credentials 확보 또는 OAuth Apps를 통한 방식
- Device Code Authentication Phishing
파일 시스템 Credentials
The **az cli**는 <HOME>/.Azure 내부에 많은 흥미로운 정보를 저장합니다:
- **
azureProfile.json**에는 과거에 로그인한 사용자에 대한 정보가 들어 있습니다 - **
clouds.config**에는 구독에 대한 정보가 들어 있습니다 - **
service_principal_entries.json**에는 애플리케이션 credentials(tenant id, clients and secret)가 들어 있습니다 - **
msal_token_cache.json**에는 access tokens and refresh tokens가 들어 있습니다
macOS와 linux에서는 이러한 파일들이 보호되지 않은 채 평문으로 저장되어 있다는 점에 유의하세요.
References
- https://aadinternals.com/post/just-looking/
- https://www.securesystems.de/blog/a-fresh-look-at-user-enumeration-in-microsoft-teams/
- https://www.netspi.com/blog/technical-blog/cloud-penetration-testing/enumerating-azure-services/
Tip
AWS 해킹 학습 및 실습:
HackTricks Training AWS Red Team Expert (ARTE)
GCP 해킹 학습 및 실습:HackTricks Training GCP Red Team Expert (GRTE)
Az 해킹 학습 및 실습:HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks 지원하기
- 구독 플랜을 확인하세요!
- 참여하세요 💬 Discord group 또는 telegram group에 참여하거나 Twitter 🐦 @hacktricks_live를 팔로우하세요.
- PR을 제출하여 해킹 트릭을 공유하세요: HackTricks 및 HackTricks Cloud github repos.
HackTricks Cloud

