Query Details
// regreSSHion - Remote Unauthenticated Code Execution Vulnerability in OpenSSH server // https://www.linkedin.com/posts/activity-7213658125323681793-p0wl/ // Azure Resource Graph KQL Query to check Azure Linux server running OpenSSH: resources | where type =~ 'Microsoft.Compute/virtualMachines' | extend osType = properties.storageProfile.osDisk.osType | where osType =~ 'Linux' | mvexpand sshKey = properties.osProfile.linuxConfiguration.ssh.publicKeys | where sshKey.keyData contains 'ssh-rsa' or sshKey.keyData contains 'ssh-dss' | project name, location, osType, sshKey.keyData // Microsoft Defender for Endpoint device discovery capabilities KQL to detect Linux machines (probably with SSH enabled) connected to on-prem & cloud environments (Not onboarded to MDE) to further identify any other possible attack surface. DeviceInfo | where OnboardingStatus != "Onboarded" | where OSPlatform == "Linux" | where DeviceName != "" | where DeviceCategory == "Endpoint"
This query is designed to identify Azure Linux virtual machines running OpenSSH and detect Linux machines that are not onboarded to Microsoft Defender for Endpoint (MDE). Here's a simplified summary:
Azure Resource Graph Query:
Microsoft Defender for Endpoint Query:
In essence, the query helps in identifying potential security risks by locating Linux servers with SSH keys in Azure and detecting Linux endpoints that are not protected by MDE.

Steven Lim
Released: August 2, 2024
Tables
Keywords
Operators