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

Tip

AWS Hacking’i öğrenin ve pratik yapın:HackTricks Training AWS Red Team Expert (ARTE)
GCP Hacking’i öğrenin ve pratik yapın: HackTricks Training GCP Red Team Expert (GRTE)
Az Hacking’i öğrenin ve pratik yapın: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks'i Destekleyin

Bu Hizmetler Neden Önemli

Azure AI Foundry, Microsoft’un GenAI uygulamaları inşa etmek için sunduğu çatı yapısıdır. Bir hub, AI projelerini, Azure ML workspaces, compute, data stores, registries, prompt flow varlıklarını ve Azure OpenAI ve Azure AI Search gibi downstream servislere bağlantıları bir araya getirir. Her bileşen genellikle şu öğeleri açığa çıkarır:

  • Long-lived API keys (OpenAI, Search, data connectors) Azure Key Vault veya workspace connection objects içinde çoğaltılmış halde bulunabilir.
  • Managed Identities (MI); deployments, vector indexing jobs, model evaluation pipelines ve Git/GitHub Enterprise operasyonlarını kontrol eder.
  • Cross-service links (storage accounts, container registries, Application Insights, Log Analytics) hub/project izinlerini devralır.
  • Multi-tenant connectors (Hugging Face, Azure Data Lake, Event Hubs) upstream kimlik bilgilerini veya tokenları leak edebilir.

Bu nedenle tek bir hub/project’in ele geçirilmesi, downstream managed identities, compute kümeleri, online endpoints ve prompt flow’larda referans verilen herhangi bir search index veya OpenAI deployment üzerinde kontrol anlamına gelebilir.

Temel Bileşenler & Güvenlik Yüzeyi

  • AI Hub (Microsoft.MachineLearningServices/hubs): Bölge, managed network, system datastores, varsayılan Key Vault, Container Registry, Log Analytics ve hub-seviyesi kimlikleri tanımlayan üst düzey nesne. Ele geçirilmiş bir hub, saldırganın yeni projeler, registries veya user-assigned identities enjekte etmesine izin verir.
  • AI Projects (Microsoft.MachineLearningServices/workspaces): Prompt flows, data assets, environments, component pipelines ve online/batch endpoints barındırır. Projects hub kaynaklarını miras alır ve kendi storage, kv ve MI ile override edebilir. Her workspace, sırları /connections ve /datastores altında saklar.
  • Managed Compute & Endpoints: Managed online endpoints, batch endpoints, serverless endpoints, AKS/ACI deployments ve on-demand inference serverlarını içerir. Bu runtime’lar içindeki Azure Instance Metadata Service (IMDS) üzerinden alınan tokenlar genellikle workspace/project MI rol atamalarını taşır (yaygın olarak Contributor veya Owner).
  • AI Registries & Model Catalog: Modellerin, environment’ların, component’ların, verinin ve değerlendirme sonuçlarının bölge bazlı paylaşımına izin verir. Registries otomatik olarak GitHub/Azure DevOps ile senkronize edilebilir; bu da PAT’ların connection tanımlarına gömülmüş olabileceği anlamına gelir.
  • Azure OpenAI (Microsoft.CognitiveServices/accounts with kind=OpenAI): GPT aile modellerini sağlar. Erişim rol atamaları + admin/query keys ile kontrol edilir. Birçok Foundry prompt flow, oluşturulan anahtarları compute job’lardan erişilebilir secrets veya environment variable olarak saklar.
  • Azure AI Search (Microsoft.Search/searchServices): Vector/index depolama tipik olarak bir project connection içinde saklanan Search admin key üzerinden bağlanır. Index verisi hassas embedding’ler, alınmış dokümanlar veya ham eğitim korpuslarını içerebilir.

Güvenlikle İlgili Mimari

Managed Identities & Rol Atamaları

  • AI hubs/projects system-assigned veya user-assigned identities etkinleştirebilir. Bu kimlikler genellikle storage accounts, key vaults, container registries, Azure OpenAI kaynakları, Azure AI Search servisleri, Event Hubs, Cosmos DB veya custom API’ler üzerinde roller taşır.
  • Online endpoints project MI’yi miras alır veya deployment başına özel bir user-assigned MI ile override edilebilir.
  • Prompt Flow connections ve Automated Agents DefaultAzureCredential aracılığıyla token isteyebilir; compute’dan metadata endpoint’i yakalamak lateral movement için tokenlar sağlar.

Ağ Sınırları

  • Hubs/projects publicNetworkAccess, private endpoints, Managed VNet ve **managedOutbound** kurallarını destekler. Yanlış yapılandırılmış allowInternetOutbound` veya açık scoring endpoint’leri doğrudan exfiltration’a izin verebilir.
  • Azure OpenAI ve AI Search firewall rules, Private Endpoint Connections (PEC), shared private link resources ve trustedClientCertificates destekler. Public erişim etkinleştirildiğinde bu servisler anahtarı bilen herhangi bir source IP’den gelen istekleri kabul eder.

Veri & Gizli Depolar

  • Varsayılan hub/project dağıtımları gizli bir managed resource group içinde bir storage account, Azure Container Registry, Key Vault, Application Insights ve Log Analytics workspace oluşturur (pattern: mlw-<workspace>-rg).
  • Workspace datastores, blob/data lake container’lara referans verir ve SAS token’ları, service principal secret’ları veya storage access key’leri embed edebilir.
  • Workspace connections (Azure OpenAI, AI Search, Cognitive Services, Git, Hugging Face vb. için) kimlik bilgilerini workspace Key Vault içinde tutar ve connection listeleme sırasında yönetim düzleminde bunları ortaya çıkarır (değerler base64-encoded JSON şeklindedir).
  • AI Search admin keys index’ler, skillset’ler, data source’lar üzerinde tam okuma/yazma erişimi sağlar ve RAG sistemlerini besleyen dokümanları döndürebilir.

İzleme & Tedarik Zinciri

  • AI Foundry kod ve prompt flow varlıkları için GitHub/Azure DevOps entegrasyonunu destekler. OAuth token’ları veya PAT’lar Key Vault + connection metadata içinde yer alır.
  • Model Catalog Hugging Face artifact’lerini mirrorlayabilir. Eğer trust_remote_code=true ise deployment sırasında rastgele Python kodu çalıştırılabilir.
  • Data/feature pipeline’ları Application Insights veya Log Analytics’e log atar ve connection string’leri ortaya çıkarabilir.

az ile Keşif

# 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']"

Değerlendirme Sırasında Nelere Dikkat Edilmeli

  • Identity scope: Projeler genellikle birden çok servise eklenmiş güçlü bir user-assigned identity’yi tekrar kullanır. Herhangi bir managed compute’tan IMDS token’larını ele geçirmek bu ayrıcalıkları miras alır.
  • Connection objects: Base64 payload gizli anahtarın yanı sıra metadata (endpoint URL, API version) içerir. Birçok ekip burada OpenAI + Search admin anahtarlarını sık döndürmek yerine bırakır.
  • Git & external source connectors: PATs veya OAuth refresh token’ları, pipeline’ları/prompt akışlarını tanımlayan koda push erişimi sağlayabilir.
  • Datastores & data assets: Aylarca geçerli SAS token’ları sağlayabilir; data asset’ler müşteri PII’sine, embeddings’e veya eğitim korpuslarına işaret edebilir.
  • Managed Network overrides: allowInternetOutbound=true veya publicNetworkAccess=Enabled olması, job’lar/endpoint’lerden secrets’ların kolayca sızdırılmasını sağlar.
  • Hub-managed resource group: storage account (<workspace>storage), container registry, KV ve Log Analytics’i içerir. Bu RG’ye erişim genellikle portal gizli olsa bile full takeover anlamına gelir.

Referanslar

Tip

AWS Hacking’i öğrenin ve pratik yapın:HackTricks Training AWS Red Team Expert (ARTE)
GCP Hacking’i öğrenin ve pratik yapın: HackTricks Training GCP Red Team Expert (GRTE)
Az Hacking’i öğrenin ve pratik yapın: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks'i Destekleyin