New to Claude Skills? Learn how to install them →

mukul975 on GitHub

Detecting Suspicious OAuth Consent

Free

Identify risky OAuth application consent grants in Azure AD.

Get this skill

Free · Opens the source repo

What Detecting Suspicious OAuth Consent does

This skill is designed for security professionals who need to detect and analyze suspicious OAuth application consent grants within Azure Active Directory (Azure AD) or Microsoft Entra ID. By leveraging the Microsoft Graph API, the skill systematically enumerates OAuth2 permission grants and scrutinizes application permissions to identify any that may be excessively broad or potentially harmful. It also reviews directory audit logs to track consent events, allowing for a comprehensive assessment of application risk based on publisher verification status and the scope of permissions granted.

The skill operates by first authenticating to Microsoft Graph using the MSAL client credentials flow. Once authenticated, it retrieves all OAuth2 permission grants and lists service principals along with their assigned permissions. By querying the directory audit logs for consent events, it flags applications that request high-risk permissions—such as Mail.Read or Files.ReadWrite.All—and checks the verification status of each application publisher. This structured approach not only helps in identifying illicit consent grant attacks but also provides a risk report with remediation recommendations to enhance security posture.

This tool is particularly useful for security operations center (SOC) analysts, incident response teams, and organizations looking to bolster their cloud security measures. It can be employed during security investigations, to build detection rules, or to validate existing security monitoring coverage against known attack techniques. By automating the detection of risky consent grants, it saves time and improves the accuracy of threat assessments in cloud environments.

Overall, this skill is an essential addition for any team focused on maintaining the integrity of their Azure AD or Microsoft Entra ID environments, ensuring that they can proactively manage and mitigate the risks associated with OAuth application permissions.

When to use it

Use this skill when investigating potential security incidents related to OAuth application consent or when developing detection rules for threat hunting.

When not to use it

This skill is not suitable for environments without Azure AD or Microsoft Entra ID, or for users without the necessary permissions to access Microsoft Graph API.

What you can build with it

Security Incident Investigation

Use this skill to investigate incidents related to OAuth application consent and identify potential security breaches.

Building Detection Rules

Leverage the skill to create detection rules for threat hunting queries targeting OAuth consent risks.

Validating Security Coverage

Employ this tool to assess and validate your security monitoring coverage against known OAuth application consent attack techniques.

How to install Detecting Suspicious OAuth Consent

View source

1. Install with the skills CLI

npx skills add mukul975/anthropic-cybersecurity-skills/detecting-suspicious-oauth-application-consent --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by mukul975

Detecting Suspicious OAuth Application Consent

Overview

Illicit consent grant attacks trick users into granting excessive permissions to malicious OAuth applications in Azure AD / Microsoft Entra ID. This skill uses the Microsoft Graph API to enumerate OAuth2 permission grants, analyze application permissions for overly broad scopes, review directory audit logs for consent events, and flag high-risk applications based on publisher verification status and permission scope.

When to Use

  • When investigating security incidents that require detecting suspicious oauth application consent
  • When building detection rules or threat hunting queries for this domain
  • When SOC analysts need structured procedures for this analysis type
  • When validating security monitoring coverage for related attack techniques

Prerequisites

  • Azure AD / Entra ID tenant with Global Reader or Security Reader role
  • Microsoft Graph API access with Application.Read.All, AuditLog.Read.All, Directory.Read.All
  • Python 3.9+ with msal, requests
  • App registration with client secret or certificate for authentication

Steps

  1. Authenticate to Microsoft Graph using MSAL client credentials flow
  2. Enumerate all OAuth2 permission grants via /oauth2PermissionGrants
  3. List service principals and their assigned application permissions
  4. Query directory audit logs for Consent to application events
  5. Flag applications with high-risk scopes (Mail.Read, Files.ReadWrite.All, etc.)
  6. Check publisher verification status for each application
  7. Generate risk report with remediation recommendations

Expected Output

  • JSON report listing all OAuth apps with granted permissions, risk scores, unverified publishers, and suspicious consent patterns
  • Audit trail of consent grant events with user and IP details

Frequently asked questions about Detecting Suspicious OAuth Consent

Similar skills