Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.