Module
OpenAEV
How-to guide

Run actions through Microsoft Defender for Endpoint

Let OpenAEV run attack actions on the devices Microsoft Defender for Endpoint protects, through Live Response, without installing the OpenAEV agent.

OpenAEVEnterprise EditionFor platform engineers and security validation engineers

The Microsoft Defender for Endpoint (MDE) executor runs OpenAEV implants through the Defender sensor already on your devices. OpenAEV installs nothing: it imports the onboarded devices of the device groups you choose, then, for each inject, opens a Live Response session on the device and runs a script of your Live Response library that starts the implant. This page prepares Microsoft Entra ID and Defender, deploys the executor in OpenAEV and checks that the devices show up. How EDR executors work, and when to prefer the OpenAEV agent, is in Choose between the OpenAEV agent and your EDR.

OPENAEVMICROSOFT DEFENDERDEVICEMDE executorSigns in as an Entra applicationEndpointsOne per onboarded deviceDefender APIMachines, Advanced HuntingLive Response scriptDecodes the commandImplantFrom a SYSTEM task on Windows
  1. MDE executor → Defender API: list devices
  2. MDE executor → Endpoints: imports
  3. Defender API → Live Response script: Live Response
  4. Live Response script → Implant: starts
  5. Implant → Endpoints: results
OpenAEV imports the onboarded devices of your device groups, then opens a Live Response session that runs your library script, which starts the implant

Before you start

  • OpenAEV runs with an Enterprise Edition license, and your role has the Manage tenant settings capability.
  • In Microsoft Entra ID, you can register an application and grant admin consent. In the Microsoft Defender portal, you can change the advanced features and upload to the Live Response library.
  • The devices reach the OpenAEV URL over HTTPS: see How an EDR executor works.

Prepare Microsoft Entra ID and Defender

Register an application

OpenAEV signs in to the Defender API as an application, with the client credentials flow.

  1. In Microsoft Entra ID > App registrations, click New registration and register the application.
  2. Keep its Directory (tenant) ID and Application (client) ID.
  3. In Certificates & secrets, create a client secret and keep its value.
  4. In API permissions, add these application permissions of WindowsDefenderATP, then click Grant admin consent:
PermissionWhy OpenAEV needs it
Machine.Read.AllList the devices and their device group, to import them
Machine.LiveResponse.AllRun the Live Response script that starts the implant
AdvancedQuery.Read.AllRead the recent activity of each device, to tell which devices are up

They must be application permissions, not delegated ones: OpenAEV works without a signed-in user. Without AdvancedQuery.Read.All, OpenAEV falls back on the sensor's health status, which tells less reliably whether a device is reachable.

Turn on Live Response

In the Microsoft Defender portal, go to Settings > Endpoints > Advanced features and turn on:

  • Live Response;
  • Live Response for servers, when you target Windows Server or Linux servers;
  • Live Response unsigned script execution: the OpenAEV scripts are not signed, and without this option every inject fails at the Live Response step.

Upload the two scripts

OpenAEV passes the whole command as one Base64 argument to one of two scripts of the Live Response library, which decode it and run it. Upload both to the library, and turn on the parameters option in the upload dialog for each one, so that both show Has parameters: Yes. Without it, MDE runs the script without the command and every inject fails.

openaev-subprocessor.ps1, for Windows:

if ($args.Count -lt 1 -or [string]::IsNullOrEmpty($args[0])) {
    Write-Error "OpenAEV subprocessor: no argument received (expected Base64 command as first parameter)"
    exit 1
}
$decoded = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($args[0]))
Invoke-Expression $decoded

openaev-subprocessor.sh, for Linux and macOS:

#!/bin/sh

if [ -z "$1" ]; then
    echo "OpenAEV subprocessor: no argument received (expected Base64 command as first parameter)" >&2
    exit 1
fi
echo "$1" | base64 -d | sh

Keep them as they are: in PowerShell, the command must come through $args[0], and a parameter named $Args breaks it.

Find the IDs of your device groups

To import only some devices, OpenAEV needs the numeric ID (rbacGroupId) of their device groups. The Defender portal shows the group names only, under Settings > Endpoints > Permissions > Device groups, so read the IDs from the devices with the same application:

$tenant = $env:MDE_TENANT_ID
$client = $env:MDE_CLIENT_ID
$secret = $env:MDE_CLIENT_SECRET

$token = (Invoke-RestMethod -Method Post `
  -Uri "https://login.microsoftonline.com/$tenant/oauth2/v2.0/token" `
  -Body @{
    grant_type    = 'client_credentials'
    client_id     = $client
    client_secret = $secret
    scope         = 'https://api.securitycenter.microsoft.com/.default'
  }).access_token

$machines = Invoke-RestMethod `
  -Uri 'https://api.securitycenter.microsoft.com/api/machines?$select=rbacGroupId,rbacGroupName' `
  -Headers @{ Authorization = "Bearer $token" }

$machines.value | Select-Object rbacGroupName, rbacGroupId -Unique | Sort-Object rbacGroupName | Format-Table -AutoSize

Keep the URL in single quotes, so that PowerShell does not read $select as a variable. A group shows only once it holds a device that MDE has seen. UnassignedGroup holds the devices of no custom group.

Deploy the executor in OpenAEV

  1. Open Integrations, then the Available tab.

  2. Open Microsoft Defender for Endpoint Executor and click Deploy. The Create a new connector instance panel opens.

  3. Fill in the form. Each field is named after its configuration key:

    FieldWhat to enter
    Display nameThe executor's name in OpenAEV, Microsoft Defender for Endpoint by default
    Executor Mde Azure Tenant IdThe Directory (tenant) ID of the application
    Executor Mde Client Id and Executor Mde Client SecretIts Application (client) ID and its client secret
    Executor Mde Windows Script Name and Executor Mde Unix Script NameThe names of the two scripts in the library, openaev-subprocessor.ps1 and openaev-subprocessor.sh by default
  4. Open Advanced options. In Executor Mde Device Group, enter the IDs of your device groups, separated by commas: left empty, OpenAEV imports every onboarded device of the tenant. The other options keep their defaults, from the executor.mde block: the Microsoft URLs, an import every 20 minutes, and 10 devices per batch of 5 seconds, since the Live Response API limits calls more strictly than other EDRs.

  5. Click Create.

  6. In the Deployed tab, open the executor and click Start.

The Microsoft Defender for Endpoint executor is set up in the interface only: the keys of its configuration block never create it.

OpenAEV 3.261118.0

Check that it works

Within a minute of the start, open Assets: the devices of your groups show in the Endpoints list, with Microsoft Defender for Endpoint in their Executors column, and Asset groups has a group named after each device group. Only devices whose onboarding status is Onboarded are imported: devices that Defender discovered but does not protect have no sensor to run Live Response.

An agent is active when its device showed activity in Advanced Hunting recently: within 70 minutes plus one import interval, so 90 minutes with the defaults. A device that goes offline shows as inactive within about two hours. Keep the import interval under one hour, or agents age out between two imports.

Each inject is a Live Response action, which you find in the Defender portal:

  • in Action center > History, with Live response as the action type and the API as its source;
  • on the device's Timeline and in its Live Response session log;
  • in Advanced hunting, on DeviceProcessEvents, with the scheduled task, the implant and the commands of the actions.

On Windows, a Live Response session ends every process it started. So the implant starts from a scheduled task of the SYSTEM account, OpenAEV-Inject-<inject>-Agent-<agent>, which deletes itself when the implant ends.

Troubleshoot

What you seeWhat to check
Every inject fails at the Live Response stepLive Response unsigned script execution is on, both scripts are in the library under the names of the form with Has parameters: Yes, and Machine.LiveResponse.All has admin consent
Devices are missingThe device group IDs, the Onboarded status of the devices, and that they report to Defender
Devices show as inactiveAdvancedQuery.Read.All has admin consent; the platform's log warns when it falls back on the health status
An inject times out on an active deviceLive Response runs only while the sensor is connected: on an offline device, the action stays Pending in Action center > History. MDE allows one Live Response session per device, so OpenAEV cancels an action pending for more than 30 minutes before it sends the next one
The inject is in error but has outputThe status comes from the action itself: a command that exits with an error, or writes to the error output, marks the trace in error even though the executor ran it. Read the exit code and the output in the trace
ExampleRun the Velvet Harbor simulation on the Spanish hotels

The front-desk workstations of Grand Meridian's Spanish hotels are protected by Microsoft Defender for Endpoint, in a device group named Front desk - Spain. The platform engineer registers the application OpenAEV executor, grants the three permissions, turns on the three Live Response features and uploads both scripts. The script above lists the groups:

rbacGroupName        rbacGroupId
-------------        -----------
Front desk - Spain           412
UnassignedGroup              366

In OpenAEV, the form gets:

FieldValue
Display nameMeridian EDR - Spain
Executor Mde Azure Tenant IdThe directory ID, kept in the vault as MDE_TENANT_ID
Executor Mde Client IdThe application ID, kept as MDE_CLIENT_ID
Executor Mde Client SecretThe secret, kept as MDE_CLIENT_SECRET
Executor Mde Device Group412

After Start, the workstations of Front desk - Spain show in Assets with the Meridian EDR - Spain executor. The Velvet Harbor simulation targets the asset group of the same name, and each PowerShell action shows in Advanced Hunting next to the alert Defender raised.

What's next

NextRun actions through Palo Alto Cortex
OpenAEV
Adversarial exposure validation: scenarios, simulations, atomic tests.

Published

Overview
Use
Build dashboards of your validation results
OverviewCreate the widgets of a dashboard
Check one attack technique with an atomic testConnect OpenAEV to OpenCTI to test security coveragesHow collectors measure what your security tools saw
How injectors deliver your injects
OverviewBuilt-in injectors and their injects
Install the OpenAEV agent on your endpointsReview what your injects discovered
Run a simulation and read its results
OverviewShare simulation results in a report
Set up your profile