[vc_row][vc_column][vc_wp_text]

[xyz-ips snippet=”metadatatitle”]

[/vc_wp_text][vc_empty_space][/vc_column][/vc_row][vc_row][vc_column width=”2/3″][vc_column_text]

Abstract

Azure vs. Azure AD

[/vc_column_text][vc_empty_space][vc_column_text]

$a = Get-AzureADMSRoleDefinition | Where-object {$_.DisplayName -eq 'Company Administrator'}
$a.RolePermissions.AllowResourceActions

 

[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]

[/vc_column_text][vc_empty_space][vc_column_text]Get-AzRoleDefinition[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]

Azure AD Privilege Escalation via Service Principals

[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]Owners of applications have the ability to add ‘secrets’ or passwords (as well as certificates) to the application’s service principal so that the service principal can be logged in.[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]

[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]

[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]

Moving from Cloud to On-Premise

[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]To do this, we used the Azure Endpoint Management portal as our new user to upload the PowerShell script.[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]

In Intune, there’s no button to “execute” scripts, but they automatically execute when the machine is restarted and every hour. After a few minutes of uploading the script (which was a Cobalt Strike beacon payload), we successfully got a beacon back and moved from cloud to on-premise.

[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]

This can also be abused purely through PowerZure using the New-AzureIntuneScript and Restart-AzureVM functions.

[/vc_column_text][vc_empty_space][vc_column_text]
[/vc_column_text][vc_empty_space][vc_column_text]

Abusing Logic Apps

[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]One that particularly stood out was AzureAD.[/vc_column_text][vc_empty_space][vc_column_text]
[/vc_column_text][vc_empty_space][vc_column_text]

Unfortunately, there wasn’t any really juicy actions like adding a role to a user, but the ability to create a user was an interesting case for a backdoor and adding a user to a group could mean privilege escalation if certain permissions or roles are tied to that group.

[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]

The question then was “What privileges does this logic app action fire as?”. The answer is that logic apps use a connector. A connector is an API that hooks in an account to the logic app. Of the many services available, there’s many that have a connector, including Azure AD. The interesting part of this abuse was that when I logged into the connector, it persisted across accounts, meaning when I logged out and switched to another account, my original account was still logged into the connector on the logic app.

[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]

The abuse then, is that you’re a Contributor over a logic app which is using a connector, then you can effectively use that connector account to perform any available actions, provided the connector account has the correct role to do those actions.

[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]

Due to the sheer amount of actions available in a logic app, I chose not to implement this abuse into PowerZure at this time, however you can enumerate if a connector is being used using the Get-LogicAppConnector function.

[/vc_column_text][vc_empty_space][vc_column_text]

PowerZure 2.0

[/vc_column_text][vc_empty_space][vc_column_text][/vc_column_text][vc_empty_space][vc_column_text]

[/vc_column_text][vc_separator style=”shadow”][vc_column_text]Source: https://posts.specterops.io[/vc_column_text][/vc_column][vc_column width=”1/3″][vc_wp_text][xyz-ips snippet=”metadatatime”]

[/vc_wp_text][/vc_column][/vc_row]

Pin It on Pinterest