Uncovering OAuth App Attacks: A Deep Dive into Malicious Service Principals and Tenants

2025-02-13

Matt Kiely, Principal Cybersecurity Researcher at Huntress, has spent six months researching OAuth app attacks, uncovering startling findings across millions of service principals and thousands of tenants. His research reveals the hidden dangers lurking within OAuth applications, which could potentially compromise your Microsoft 365 tenant.

The study highlights the prevalence of rogue apps that may be operating maliciously within your environment. To combat this, Kiely introduces Cazadora, an open-source tool designed to simplify and expedite auditing in Azure application environments.

Key Findings:

  • A significant percentage of tenants are infected with malicious OAuth apps.
  • Attackers exploit OAuth permissions to gain unauthorized access to sensitive data.
  • Cazadora provides a streamlined approach to identifying and mitigating these threats.

Practical Commands and Tools:

To audit your OAuth applications, you can use the following PowerShell commands:


<h1>Connect to Azure AD</h1>

Connect-AzureAD

<h1>List all OAuth applications</h1>

Get-AzureADApplication

<h1>Check service principals for suspicious permissions</h1>

Get-AzureADServicePrincipal | ForEach-Object { 
Get-AzureADServiceAppRoleAssignment -ObjectId $_.ObjectId 
} 

For Linux users, you can use `curl` to interact with Azure APIs:


<h1>Fetch OAuth app details using Azure REST API</h1>

curl -X GET -H "Authorization: Bearer <ACCESS_TOKEN>" \ 
https://graph.microsoft.com/v1.0/applications 

**What Undercode Say:**

OAuth app attacks represent a significant threat to modern cloud environments, particularly for organizations using Microsoft 365. The research by Matt Kiely underscores the importance of proactive auditing and monitoring of OAuth applications. Tools like Cazadora are invaluable for identifying rogue apps and mitigating risks.

To further secure your environment, consider implementing the following practices:

1. Regularly review and update OAuth app permissions.

  1. Use multi-factor authentication (MFA) to reduce the risk of unauthorized access.
  2. Monitor Azure AD logs for suspicious activity using commands like:

<h1>Retrieve Azure AD sign-in logs</h1>

Get-AzureADAuditSignInLogs -Filter "createdDateTime gt 2023-10-01" 

For Linux-based systems, integrate Azure monitoring with tools like `syslog` or `ELK Stack` for centralized logging.

**Additional Resources:**

By staying vigilant and leveraging the right tools, you can protect your organization from the hidden dangers of OAuth app attacks.

References:

Hackers Feeds, Undercode AIFeatured Image

Scroll to Top