Az - AI Foundry, AI Hubs, Azure OpenAI & AI Search
Tip
Μάθετε & εξασκηθείτε στο AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Μάθετε & εξασκηθείτε στο GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Μάθετε & εξασκηθείτε στο Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
Υποστηρίξτε το HackTricks
- Δείτε τα subscription plans!
- Εγγραφείτε στο 💬 Discord group ή την telegram group ή ακολουθήστε μας στο Twitter 🐦 @hacktricks_live.
- Μοιραστείτε τα hacking tricks υποβάλλοντας PRs στα HackTricks και HackTricks Cloud github repos.
Γιατί αυτές οι υπηρεσίες έχουν σημασία
Azure AI Foundry είναι η ομπρέλα της Microsoft για την κατασκευή εφαρμογών GenAI. Ένας hub συγκεντρώνει AI projects, Azure ML workspaces, compute, data stores, registries, prompt flow assets, και συνδέσεις προς downstream υπηρεσίες όπως Azure OpenAI και Azure AI Search. Κάθε συστατικό συνήθως εκθέτει:
- Long-lived API keys (OpenAI, Search, data connectors) αντιγραφόμενα μέσα σε Azure Key Vault ή αντικείμενα workspace connection.
- Managed Identities (MI) που ελέγχουν deployments, vector indexing jobs, model evaluation pipelines, και Git/GitHub Enterprise operations.
- Cross-service links (storage accounts, container registries, Application Insights, Log Analytics) που κληρονομούν δικαιώματα του hub/project.
- Multi-tenant connectors (Hugging Face, Azure Data Lake, Event Hubs) που μπορεί να leak upstream credentials ή tokens.
Η παραβίαση ενός μεμονωμένου hub/project μπορεί επομένως να σημαίνει έλεγχο επί downstream managed identities, compute clusters, online endpoints, και οποιωνδήποτε search indexes ή OpenAI deployments που αναφέρονται από prompt flows.
Core Components & Security Surface
- AI Hub (
Microsoft.MachineLearningServices/hubs): Αντικείμενο υψηλού επιπέδου που ορίζει region, managed network, system datastores, default Key Vault, Container Registry, Log Analytics, και hub-level identities. Ένας compromised 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 αποθηκεύει secrets υπό/connectionsκαι/datastores. - Managed Compute & Endpoints: Περιλαμβάνει managed online endpoints, batch endpoints, serverless endpoints, AKS/ACI deployments, και on-demand inference servers. Tokens που λαμβάνονται από Azure Instance Metadata Service (IMDS) μέσα σε αυτά τα runtimes συνήθως φέρουν τις workspace/project MI role assignments (συνήθως
ContributorήOwner). - AI Registries & Model Catalog: Επιτρέπουν region-scoped sharing μοντέλων, environments, components, data, και evaluation results. Registries μπορούν να συγχρονίζονται αυτόματα σε GitHub/Azure DevOps, πράγμα που σημαίνει ότι PATs μπορεί να είναι ενσωματωμένα μέσα σε connection definitions.
- Azure OpenAI (
Microsoft.CognitiveServices/accountswithkind=OpenAI): Παρέχει GPT family models. Η πρόσβαση ελέγχεται μέσω role assignments + admin/query keys. Πολλές Foundry prompt flows κρατούν τα παραγόμενα keys ως secrets ή environment variables προσβάσιμα από compute jobs. - Azure AI Search (
Microsoft.Search/searchServices): Vector/index storage συνήθως συνδεδεμένο μέσω Search admin key αποθηκευμένου σε ένα project connection. Τα δεδομένα του index μπορεί να περιέχουν ευαίσθητα embeddings, ανακτημένα έγγραφα, ή raw training corpora.
Security-Relevant Architecture
Managed Identities & Role Assignments
- AI hubs/projects μπορούν να ενεργοποιήσουν system-assigned ή user-assigned identities. Αυτές οι ταυτότητες συνήθως έχουν ρόλους σε storage accounts, key vaults, container registries, Azure OpenAI resources, Azure AI Search services, Event Hubs, Cosmos DB, ή custom APIs.
- Online endpoints κληρονομούν το project MI ή μπορούν να παρακάμψουν με ένα dedicated user-assigned MI ανά deployment.
- Prompt Flow connections και Automated Agents μπορούν να αιτηθούν tokens μέσω του
DefaultAzureCredential; η σύλληψη του metadata endpoint από compute δίνει tokens για lateral movement.
Network Boundaries
- Hubs/projects υποστηρίζουν
publicNetworkAccess, private endpoints, Managed VNet και **managedOutbound** κανόνες. Λανθασμένα διαμορφωμένοallowInternetOutbound` ή ανοιχτά scoring endpoints επιτρέπουν άμεση exfiltration. - Azure OpenAI και AI Search υποστηρίζουν firewall rules, Private Endpoint Connections (PEC), shared private link resources, και
trustedClientCertificates. Όταν είναι ενεργοποιημένη η δημόσια πρόσβαση, αυτές οι υπηρεσίες δέχονται αιτήματα από οποιαδήποτε source IP που γνωρίζει το key.
Data & Secret Stores
- Οι προεπιλεγμένες hub/project αναπτύξεις δημιουργούν ένα storage account, Azure Container Registry, Key Vault, Application Insights, και Log Analytics workspace μέσα σε ένα hidden managed resource group (pattern:
mlw-<workspace>-rg). - Workspace datastores αναφέρονται σε blob/data lake containers και μπορούν να ενσωματώνουν SAS tokens, service principal secrets, ή storage access keys.
- Workspace connections (για Azure OpenAI, AI Search, Cognitive Services, Git, Hugging Face, κ.λπ.) κρατούν credentials στο workspace Key Vault και εμφανίζουν τα μέσω του management plane όταν γίνεται listing της connection (τιμές είναι base64-encoded JSON).
- AI Search admin keys παρέχουν πλήρη read/write πρόσβαση σε indexes, skillsets, data sources, και μπορούν να ανακτήσουν documents που τροφοδοτούν RAG systems.
Monitoring & Supply Chain
- AI Foundry υποστηρίζει GitHub/Azure DevOps integration για code και prompt flow assets. OAuth tokens ή PATs ζουν στο Key Vault + connection metadata.
- Model Catalog μπορεί να καθρεφτίζει Hugging Face artifacts. Αν
trust_remote_code=true, arbitrary Python εκτελείται κατά την ανάπτυξη. - Data/feature pipelines καταγράφουν σε Application Insights ή Log Analytics, εκθέτοντας connection strings.
Enumeration with 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: Projects often reuse a powerful user-assigned identity attached to multiple services. Capturing IMDS tokens from any managed compute inherits those privileges.
- Connection objects: Base64 payload includes the secret plus metadata (endpoint URL, API version). Many teams leave OpenAI + Search admin keys here rather than rotating frequently.
- Git & external source connectors: PATs or OAuth refresh tokens may allow push access to code that defines pipelines/prompt flows.
- Datastores & data assets: Provide SAS tokens valid for months; data assets may point to customer PII, embeddings, or training corpora.
- Managed Network overrides:
allowInternetOutbound=trueorpublicNetworkAccess=Enabledmakes it trivial to exfiltrate secrets from jobs/endpoints. - Hub-managed resource group: Contains the storage account (
<workspace>storage), container registry, KV, and Log Analytics. Access to that RG often means full takeover even if portal hides it.
Αναφορές
- Azure AI Foundry architecture
- Azure Machine Learning CLI v2
- Azure OpenAI security controls
- Azure AI Search security
Tip
Μάθετε & εξασκηθείτε στο AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Μάθετε & εξασκηθείτε στο GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Μάθετε & εξασκηθείτε στο Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
Υποστηρίξτε το HackTricks
- Δείτε τα subscription plans!
- Εγγραφείτε στο 💬 Discord group ή την telegram group ή ακολουθήστε μας στο Twitter 🐦 @hacktricks_live.
- Μοιραστείτε τα hacking tricks υποβάλλοντας PRs στα HackTricks και HackTricks Cloud github repos.
HackTricks Cloud

