Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Machine Learning Scripts #44

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

xybytes
Copy link

@xybytes xybytes commented Jan 8, 2025

Hi,

I believe this would be a good addition to the repository.

Context

Azure Machine Learning is a robust platform designed for machine learning that facilitates the fine-tuning and deployment of language models. Many companies are currently using it, and its adoption is expected to grow significantly. In the future, penetration testers will likely find themselves in situations where they need to evaluate this service. The scripts available can be used for enumeration and potential lateral movement within Azure Machine Learning.

Description

In the Az directory, you can find two PowerShell scripts. The first, Get-AzMachineLearningData.ps1, is designed to enumerate Azure Machine Learning resources. This function provides detailed information about an Azure ML Workspace, including compute instances, resources, models, keys, jobs, endpoints, and more. It operates similarly to Get-AzBatchAccountData.ps1. The second script, Invoke-AzMachineLearningApi.ps1, is inspired by the research Breaking ML Services: Finding 0-days in Azure Machine Learning by Nitesh Surana. This script illustrates how an attacker with access to a computer instance could interact with the backend API. Specifically, the attacker could retrieve storage account keys, workspace data, and the managed identity access token for the instance. To interact with the API, the attacker requires the instance's certificate and private key, which are used by the agent for authentication with the file share and are located in /mnt/batch/task/startup/certs/. By creating a PFX file, the script can extract the managed identity access token, workspace details, and the AccountKeyJWE. To decrypt the AccountKeyJWE you need AZ_LS_ENCRYPTED_SYMMETRIC_KEY and AZ_BATCHAI_CLUSTER_PRIVATE_KEY_PEM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant