Az - AI Foundry, AI Hubs, Azure OpenAI & AI Search

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 지원하기

이들 서비스가 중요한 이유

Azure AI Foundry는 GenAI 애플리케이션을 구축하기 위한 Microsoft의 통합 플랫폼입니다. 하나의 hub는 AI projects, Azure ML workspaces, compute, data stores, registries, prompt flow 자산들과 Azure OpenAIAzure AI Search 같은 하위 서비스로의 연결을 집계합니다. 각 구성요소는 일반적으로 다음을 노출합니다:

  • Long-lived API keys (OpenAI, Search, data connectors) 가 Azure Key Vault 또는 workspace connection 객체 내부에 복제되어 저장됩니다.
  • Managed Identities (MI) 는 배포, 벡터 인덱싱 작업, 모델 평가 파이프라인, 그리고 Git/GitHub Enterprise 작업을 제어합니다.
  • Cross-service links (storage accounts, container registries, Application Insights, Log Analytics) 는 hub/project 권한을 상속합니다.
  • Multi-tenant connectors (Hugging Face, Azure Data Lake, Event Hubs) 는 상류 자격증명이나 토큰을 leak할 수 있습니다.

단일 hub/project가 탈취되면 downstream managed identities, compute 클러스터, online endpoints 및 prompt flows에서 참조하는 모든 search index나 OpenAI 배포에 대한 제어를 의미할 수 있습니다.

핵심 구성요소 및 보안 표면

  • AI Hub (Microsoft.MachineLearningServices/hubs): 리전, managed network, system datastores, 기본 Key Vault, Container Registry, Log Analytics 및 hub-레벨 아이덴티티를 정의하는 최상위 객체입니다. 허가되지 않은 접근으로 hub가 손상되면 공격자는 새로운 projects, registries 또는 user-assigned identities를 주입할 수 있습니다.
  • AI Projects (Microsoft.MachineLearningServices/workspaces): prompt flows, data assets, environments, component pipelines 및 online/batch endpoints를 호스팅합니다. Projects는 hub 리소스를 상속하며 자체 storage, kv, MI로 오버라이드할 수도 있습니다. 각 workspace는 /connections/datastores 아래에 비밀을 저장합니다.
  • Managed Compute & Endpoints: managed online endpoints, batch endpoints, serverless endpoints, AKS/ACI 배포 및 온디맨드 추론 서버를 포함합니다. 이러한 런타임 내부에서 Azure Instance Metadata Service (IMDS)로부터 가져온 토큰은 보통 workspace/project MI 역할 할당(일반적으로 Contributor 또는 Owner)을 가집니다.
  • AI Registries & Model Catalog: 모델, environments, components, 데이터 및 평가 결과의 리전 범위 공유를 허용합니다. Registries는 GitHub/Azure DevOps와 자동 동기화할 수 있어 PATs가 connection 정의 안에 포함될 수 있습니다.
  • Azure OpenAI (Microsoft.CognitiveServices/accounts with kind=OpenAI): GPT 계열 모델을 제공합니다. 접근은 역할 할당 + admin/query keys로 제어됩니다. 많은 Foundry prompt flows는 생성된 키를 compute 작업에서 접근 가능한 비밀이나 환경변수로 유지합니다.
  • Azure AI Search (Microsoft.Search/searchServices): 벡터/인덱스 저장소는 일반적으로 프로젝트 connection에 저장된 Search admin key로 연결됩니다. 인덱스 데이터는 민감한 임베딩, 검색된 문서 또는 원시 학습 코퍼스를 포함할 수 있습니다.

보안 관련 아키텍처

Managed Identities & Role Assignments

  • AI hubs/projects는 system-assigned 또는 user-assigned identities를 활성화할 수 있습니다. 이 아이덴티티들은 보통 storage accounts, Key Vaults, container registries, Azure OpenAI 리소스, Azure AI Search 서비스, Event Hubs, Cosmos DB 또는 커스텀 API에 대한 역할을 가집니다.
  • Online endpoints는 프로젝트 MI를 상속하거나 배포당 전용 user-assigned MI로 오버라이드할 수 있습니다.
  • Prompt Flow connections 및 Automated Agents는 DefaultAzureCredential을 통해 토큰을 요청할 수 있습니다; compute에서 metadata endpoint를 캡처하면 횡적 이동을 위한 토큰을 얻을 수 있습니다.

Network Boundaries

  • Hubs/projects는 publicNetworkAccess, private endpoints, Managed VNet 및 **managedOutbound** 규칙을 지원합니다. 잘못 설정된 allowInternetOutbound` 또는 공개된 scoring endpoints는 직접적인 데이터 유출을 허용할 수 있습니다.
  • Azure OpenAI와 AI Search는 firewall rules, Private Endpoint Connections (PEC), shared private link resources, 및 trustedClientCertificates를 지원합니다. public access가 활성화되면 이들 서비스는 키를 알고 있는 모든 소스 IP의 요청을 수락합니다.

Data & Secret Stores

  • 기본 hub/project 배포는 숨겨진 managed resource group(패턴: mlw-<workspace>-rg) 내부에 storage account, Azure Container Registry, Key Vault, Application Insights, 및 Log Analytics 워크스페이스를 생성합니다.
  • Workspace datastores는 blob/data lake 컨테이너를 참조하며 SAS 토큰, service principal 비밀 또는 storage access keys를 포함할 수 있습니다.
  • Workspace connections(Azure OpenAI, AI Search, Cognitive Services, Git, Hugging Face 등)는 자격증명을 workspace Key Vault에 보관하고, 연결을 나열할 때 관리 평면을 통해 이를 노출합니다(값은 base64-encoded JSON입니다).
  • AI Search admin keys는 인덱스, skillsets, data sources에 대한 전체 읽기/쓰기 접근을 제공하며 RAG 시스템에 공급되는 문서를 검색할 수 있습니다.

Monitoring & Supply Chain

  • AI Foundry는 코드 및 prompt flow 자산을 위해 GitHub/Azure DevOps 통합을 지원합니다. OAuth 토큰이나 PATs는 Key Vault 및 connection metadata에 저장됩니다.
  • Model Catalog는 Hugging Face 아티팩트를 미러할 수 있습니다. trust_remote_code=true이면 배포 중에 임의의 Python 코드가 실행됩니다.
  • 데이터/피처 파이프라인은 Application Insights 또는 Log Analytics에 로그를 남기며 connection strings를 노출할 수 있습니다.

az로 열거

# Install the Azure ML / AI CLI extension (if missing)
az extension add --name ml

# Enumerate AI Hubs (workspaces with kind=hub) and inspect properties
az ml workspace list --filtered-kinds hub --resource-group <RG> --query "[].{name:name, location:location, rg:resourceGroup}" -o table
az resource show --name <HUB> --resource-group <RG> \
--resource-type Microsoft.MachineLearningServices/workspaces \
--query "{location:location, publicNetworkAccess:properties.publicNetworkAccess, identity:identity, managedResourceGroup:properties.managedResourceGroup}" -o jsonc

# Enumerate AI Projects (kind=project) under a hub or RG
az resource list --resource-type Microsoft.MachineLearningServices/workspaces --query "[].{name:name, rg:resourceGroup, location:location}" -o table
az ml workspace list --filtered-kinds project --resource-group <RG> \
--query "[?contains(properties.hubArmId, '/workspaces/<HUB>')].{name:name, rg:resourceGroup, location:location}"

# Show workspace level settings (managed identity, storage, key vault, container registry)
az ml workspace show --name <WS> --resource-group <RG> \
--query "{managedNetwork:properties.managedNetwork, storageAccount:properties.storageAccount, containerRegistry:properties.containerRegistry, keyVault:properties.keyVault, identity:identity}"

# List workspace connections (OpenAI, AI Search, Git, data sources)
az ml connection list --workspace-name <WS> --resource-group <RG> --populate-secrets -o table
az ml connection show --workspace-name <WS> --resource-group <RG> --name <CONNECTION>
# For REST (returns base64 encoded secrets)
az rest --method GET \
--url "https://management.azure.com/subscriptions/<SUB>/resourceGroups/<RG>/providers/Microsoft.MachineLearningServices/workspaces/<WS>/connections/<CONN>?api-version=2024-04-01"

# Enumerate datastores and extract credentials/SAS
az ml datastore list --workspace-name <WS> --resource-group <RG>
az ml datastore show --name <DATASTORE> --workspace-name <WS> --resource-group <RG>

# List managed online/batch endpoints and deployments (capture identity per deployment)
az ml online-endpoint list --workspace-name <WS> --resource-group <RG>
az ml online-endpoint show --name <ENDPOINT> --workspace-name <WS> --resource-group <RG>
az ml online-deployment show --name <DEPLOYMENT> --endpoint-name <ENDPOINT> --workspace-name <WS> --resource-group <RG> \
--query "{identity:identity, environment:properties.environmentId, codeConfiguration:properties.codeConfiguration}"

# Discover prompt flows, components, environments, data assets
az ml component list --workspace-name <WS> --resource-group <RG>
az ml data list --workspace-name <WS> --resource-group <RG> --type uri_folder
az ml environment list --workspace-name <WS> --resource-group <RG>
az ml job list --workspace-name <WS> --resource-group <RG> --type pipeline

# List hub/project managed identities and their role assignments
az identity list --resource-group <RG>
az role assignment list --assignee <MI-PRINCIPAL-ID> --all

# Azure OpenAI resources (filter kind==OpenAI)
az resource list --resource-type Microsoft.CognitiveServices/accounts \
--query "[?kind=='OpenAI'].{name:name, rg:resourceGroup, location:location}" -o table
az cognitiveservices account list --resource-group <RG> \
--query "[?kind=='OpenAI'].{name:name, location:location}" -o table
az cognitiveservices account show --name <AOAI-NAME> --resource-group <RG>
az cognitiveservices account keys list --name <AOAI-NAME> --resource-group <RG>
az cognitiveservices account deployment list --name <AOAI-NAME> --resource-group <RG>
az cognitiveservices account network-rule list --name <AOAI-NAME> --resource-group <RG>

# Azure AI Search services
az search service list --resource-group <RG>
az search service show --name <SEARCH-NAME> --resource-group <RG> \
--query "{sku:sku.name, publicNetworkAccess:properties.publicNetworkAccess, privateEndpoints:properties.privateEndpointConnections}"
az search admin-key show --service-name <SEARCH-NAME> --resource-group <RG>
az search query-key list --service-name <SEARCH-NAME> --resource-group <RG>
az search shared-private-link-resource list --service-name <SEARCH-NAME> --resource-group <RG>

# AI Search data-plane (requires admin key in header)
az rest --method GET \
--url "https://<SEARCH-NAME>.search.windows.net/indexes?api-version=2024-07-01" \
--headers "api-key=<ADMIN-KEY>"
az rest --method GET \
--url "https://<SEARCH-NAME>.search.windows.net/datasources?api-version=2024-07-01" \
--headers "api-key=<ADMIN-KEY>"
az rest --method GET \
--url "https://<SEARCH-NAME>.search.windows.net/indexers?api-version=2024-07-01" \
--headers "api-key=<ADMIN-KEY>"

# Linkage between workspaces and search / openAI (REST helper)
az rest --method GET \
--url "https://management.azure.com/subscriptions/<SUB>/resourceGroups/<RG>/providers/Microsoft.MachineLearningServices/workspaces/<WS>/connections?api-version=2024-04-01" \
--query "value[?properties.target=='AzureAiSearch' || properties.target=='AzureOpenAI']"

평가 중 확인할 항목

  • Identity scope: 프로젝트에서는 여러 서비스에 연결된 강력한 user-assigned identity를 재사용하는 경우가 많습니다. 어떤 managed compute에서든 IMDS 토큰을 획득하면 해당 권한을 그대로 상속합니다.
  • Connection objects: Base64 페이로드에는 secret과 메타데이터(endpoint URL, API version)가 포함됩니다. 많은 팀이 여기 OpenAI + Search admin keys를 자주 회전시키지 않고 그대로 둡니다.
  • Git & external source connectors: PATs 또는 OAuth refresh tokens가 pipeline/프롬프트 흐름을 정의하는 코드에 대한 push 접근을 허용할 수 있습니다.
  • Datastores & data assets: 몇 달간 유효한 SAS tokens를 제공합니다; data assets는 고객 PII, embeddings 또는 학습 코퍼스를 가리킬 수 있습니다.
  • Managed Network overrides: allowInternetOutbound=true 또는 publicNetworkAccess=Enabled 설정은 jobs/endpoints에서 비밀을 손쉽게 유출할 수 있게 만듭니다.
  • Hub-managed resource group: storage account (<workspace>storage), container registry, KV, 및 Log Analytics를 포함합니다. 포털에서 숨겨져 있어도 해당 RG에 접근하면 종종 full takeover를 의미합니다.

References

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 지원하기