Kuboid
Open Luck·Kuboid.in
Black Hat2024
Open in YouTube ↗

Unveiling the Power of Intune: Leveraging Intune for Breaking Into Your Cloud and On-Premise

Black Hat2,513 views33:5412 months ago

This talk demonstrates multiple techniques for abusing Microsoft Intune to bypass security controls and gain unauthorized access to cloud and on-premise environments. The researcher highlights how the Intune enrollment process and the Intune Management Extension (SideCar) can be manipulated to exfiltrate sensitive configuration data, including VPN and Wi-Fi credentials. The presentation also introduces a new tool, Pytune, which automates these attack vectors, including the impersonation of devices to steal domain computer credentials. The findings emphasize the need for hardening Intune configurations and avoiding the exclusion of high-privileged resources from security policies.

Abusing Microsoft Intune to Bypass Conditional Access and Exfiltrate Credentials

TLDR: Microsoft Intune’s enrollment process and the Intune Management Extension (SideCar) contain design-level weaknesses that allow attackers to register rogue devices and exfiltrate sensitive configuration data. By impersonating the Intune Company Portal client, an attacker can bypass Conditional Access policies that require compliant devices. This research, presented at Black Hat 2024, provides a clear path for red teamers to compromise cloud and on-premise environments using the new Pytune tool.

Modern enterprise security relies heavily on the assumption that if a device is managed by Intune, it is inherently trustworthy. We build Conditional Access policies around this, blocking access to sensitive resources unless a device is marked as "compliant." This research shatters that assumption. By reverse-engineering the Intune enrollment protocol and the communication flow of the Intune Management Extension, it is possible to register arbitrary devices and trick the management server into treating them as legitimate corporate assets.

The Mechanics of the Enrollment Bypass

The core of this attack lies in the fact that the Intune enrollment process does not strictly validate the hardware identity of the device during the initial handshake. When a user registers a device, the Intune Company Portal client authenticates to Microsoft Entra ID and then requests an enrollment endpoint from Microsoft Graph.

The vulnerability exists because the enrollment service relies on the client to identify itself. By using roadtx to handle the initial authentication, an attacker can capture the necessary tokens and then use the Intune Company Portal client ID to initiate the enrollment. Because the service trusts the client ID, it does not enforce device compliance checks during the registration phase.

Once the rogue device is enrolled, it can participate in the OMA-DM (Open Mobile Alliance Device Management) protocol. This is where the real damage happens. The management server sends SyncML requests to the device to enforce policies. An attacker can respond to these requests, effectively "checking in" as a managed device. If a Conditional Access policy is configured to require a compliant device, the attacker simply needs to ensure their rogue device reports the expected compliance status, which is trivial once the communication channel is established.

Exfiltrating Credentials via SideCar

Beyond simple access, the Intune Management Extension, often referred to as SideCar, provides a massive attack surface. SideCar is responsible for pushing Win32 applications and PowerShell scripts to Windows endpoints. When an IT administrator deploys an application, the device downloads an encrypted .intunewin file.

The decryption key for these files is tied to the device’s certificate. Since our rogue device is now "managed," it possesses a valid device certificate. We can use this certificate to decrypt the .intunewin packages. In many enterprise environments, these packages contain sensitive installation scripts, including hardcoded local administrator credentials, VPN configuration files, and Wi-Fi pre-shared keys.

The following command demonstrates how the Pytune tool interacts with the SideCar gateway to pull these configurations:

python3 pytune.py download_apps -d Windows_pytune -r Windows_pytune_mdm.pfx

During testing, this technique consistently yielded sensitive configuration data. For a pentester, this is a goldmine. You are no longer just a user with a valid token; you are a managed endpoint with the ability to pull down the same software and scripts that the organization pushes to its own fleet.

Real-World Impact and Engagement Strategy

On a red team engagement, this technique changes the game. You no longer need to phish a user and then wait for them to log into a corporate-managed machine. You can perform the entire attack from a Linux box. If you have a set of stolen credentials, you can register your own "device," bypass the "Require compliant device" policy, and then use the SideCar extension to pull down internal tools or credentials that might be stored in deployment scripts.

This falls squarely under OWASP A01:2021-Broken Access Control. The system assumes that the device identity is immutable and verified, but the protocol allows for the registration of unauthorized devices that can then request and receive sensitive configuration data.

Hardening Your Environment

Defending against this is difficult because the behavior is largely "by design" in how Microsoft handles enrollment. However, you can significantly raise the cost of the attack. First, ensure that your Conditional Access policies are not just relying on device compliance. Require Multi-Factor Authentication (MFA) for all access, and do not exclude Intune from these policies.

Many organizations exclude Intune from MFA requirements to avoid breaking the enrollment flow for new users. This is a mistake. If you must have exclusions, use Application Filters to limit the scope of what those excluded applications can do. Finally, audit your Win32 application deployments. If you are pushing scripts that contain secrets, you are essentially distributing those secrets to every device in your fleet. Move those secrets to a dedicated secret management solution like Azure Key Vault.

The era of trusting a device simply because it shows up in your Intune console is over. If you are a researcher or a pentester, start looking at the OMA-DM traffic in your next engagement. You will likely find that the management plane is far more accessible than the documentation suggests.

Talk Type
research presentation
Difficulty
advanced
Has Demo Has Code Tool Released


Black Hat Europe 2024

52 talks · 2024
Browse conference →
Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in