Hackers Use Device Code Phishing to Replay Sessions and Register MFA for Persistence + Video

Listen to this Post

Featured Image

Introduction:

The cybersecurity landscape has witnessed a paradigm shift as threat actors move away from malware-laden attacks toward sophisticated identity-based intrusions. The emergence of the Helix data extortion group—operating without deploying a single piece of malware—represents a dangerous evolution in cyber extortion. By exploiting human trust through vishing and abusing legitimate OAuth device code authentication flows, Helix silently compromises corporate Microsoft 365 environments, replays stolen sessions, and registers their own MFA methods for long-term, nearly invisible persistence.

Learning Objectives:

  • Understand the technical mechanics of OAuth device code phishing and how attackers abuse legitimate authentication flows.
  • Learn how Helix operators use vishing, residential proxies, and session replay to bypass MFA and evade detection.
  • Master practical detection, response, and mitigation strategies, including Conditional Access policies and session termination procedures.

You Should Know:

1. Understanding the OAuth Device Code Authentication Flow

The OAuth 2.0 Device Authorization Grant (RFC 8628) is a legitimate authentication flow designed for input-constrained devices such as smart TVs, printers, and IoT gadgets that cannot support full web browsers. The flow works as follows:

  • The attacker initiates a POST request to Microsoft’s device authorization endpoint (login.microsoft.com/common/oauth2/v2.0/devicecode) with a chosen client_id.
  • The endpoint responds with a `user_code` (short alphanumeric string), a device_code, a verification_uri, and a 15-minute expiration window.
  • The victim is tricked into navigating to the `verification_uri` (typically microsoft.com/devicelogin) and entering the user_code.
  • Once the victim authenticates (including MFA), Microsoft issues a session token, an access_token, a refresh_token, and an `id_token` to the attacker-controlled application.

The critical vulnerability lies in the fact that the attacker never needs the victim’s password or MFA code—the victim performs the authentication themselves, and the tokens are delivered to the attacker’s application.

Step‑by‑step guide for security professionals to understand and test this flow:

Step 1: Simulate a device code request using curl:

curl -X POST https://login.microsoftonline.com/common/oauth2/v2.0/devicecode \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id=YOUR_CLIENT_ID&scope=https://graph.microsoft.com/.default"

Step 2: The response will contain user_code, device_code, and verification_uri. An attacker would then send the `user_code` and `verification_uri` to the victim via phishing.

Step 3: Once the victim authenticates, the attacker polls the token endpoint:

curl -X POST https://login.microsoftonline.com/common/oauth2/v2.0/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id=YOUR_CLIENT_ID&device_code=DEVICE_CODE&grant_type=urn:ietf:params:oauth:grant-type:device_code"

Step 4: The response contains `access_token` and refresh_token. The attacker can now replay these tokens from any location.

  1. The Helix Attack Chain: From Vishing to Data Exfiltration

Helix operators conduct extensive reconnaissance on target organizations, allowing them to impersonate direct managers during vishing calls. The attack chain unfolds in four distinct phases:

Phase 1 – Initial Access: The attacker guides the victim into entering a Microsoft device code into their browser during a phone call. No password is ever requested, and the victim’s MFA challenge is completed by the victim themselves.

Phase 2 – Session Replay and MFA Registration: Armed with the stolen session token, the attacker replays it from an unmanaged device. To avoid triggering “impossible travel” alerts, they use residential proxies geographically matched to the victim’s real city. Within minutes, the operator quietly registers a new MFA app to the compromised account—providing durable, nearly invisible persistence.

Phase 3 – Dwell and Reconnaissance: With a secure foothold, the attacker enters a dwell phase lasting hours to over a week, interactively browsing SharePoint sites and cloud storage to understand the environment’s value.

Phase 4 – Automated Exfiltration: Using Python-based tools, attackers run wildcard searches to inventory all reachable SharePoint files before executing massive bulk downloads to external servers.

Step‑by‑step guide for defenders to detect and respond:

Step 1: Monitor Entra ID sign-in logs for device code flow authentications from unusual locations:

 Azure CLI command to query sign-in logs
az monitor activity-log list --query "[?contains(operationName.value, 'devicecode')]"

Step 2: Investigate new MFA registration events. In Microsoft Entra ID, search for “Add MFA” or “Register security info” events occurring shortly after a device code authentication.

Step 3: Use PowerShell to identify all active sessions for a compromised account:

Get-MgUserAuthenticationMethod -UserId "[email protected]"

Step 4: Terminate all active sessions immediately:

 Revoke all refresh tokens for a user
Revoke-MgUserSignInSession -UserId "[email protected]"

3. Indicators of Compromise and Threat Intelligence

The following IOCs have been associated with Helix operations:

| Artifact | Type | Details |

|-|||

| 179.43.185[.]230 | IP Address | Exfiltration IP |
| 179.43.185[.]226 | IP Address | Previously associated with BlackFile |

| oskeysync[.]com | Domain | Phishing domain |

Note: IP addresses and domains are intentionally defanged. Re-fang only within controlled threat intelligence platforms such as MISP, VirusTotal, or your SIEM.

For Linux-based threat hunting, use the following commands to investigate potential device code abuse:

Check for suspicious OAuth token requests in proxy logs:

grep -i "devicecode" /var/log/nginx/access.log

Analyze network connections to known malicious IPs:

grep -E "179.43.185.(230|226)" /var/log/syslog

Monitor for unusual SharePoint activity using `grep` on audit logs:

grep -i "sharepoint" /var/log/audit/audit.log | grep -E "download|exfil"
  1. Mitigation: Blocking Device Code Flow and Hardening Identity Defenses

The strongest mitigation against device code phishing is blocking the OAuth device authorization grant flow outright using Conditional Access Authentication Flows in Microsoft Entra ID.

Step‑by‑step guide to implement this control:

Step 1: Navigate to Microsoft Entra ID → Security → Conditional Access → Authentication Flows.

Step 2: Select “Device Code Flow” and set it to “Block”.

Step 3: Create exclusions for legitimate use cases (e.g., service accounts that require device code authentication).

Step 4: Enforce the policy and monitor for any authentication attempts.

Step 5: For organizations that cannot block the flow entirely, implement risk-based conditional access:
– Require compliant devices
– Enforce location-based policies
– Use sign-in risk detection

Additional hardening measures:

Disable legacy authentication protocols using Conditional Access policies to prevent token replay from unmanaged devices.

Implement Continuous Access Evaluation (CAE) in Microsoft Entra ID to revoke sessions in near-real-time when risk is detected.

Deploy user education specifically focused on device code phishing—users should never enter codes from unsolicited phone calls, regardless of the caller’s claimed identity.

5. Windows and Linux Commands for Incident Response

Windows (PowerShell) – Revoke all sessions and force re-authentication:

 Revoke all refresh tokens for a specific user
Revoke-AzureADUserAllRefreshToken -ObjectId "[email protected]"

Force password reset and MFA re-registration
Set-AzureADUserPassword -ObjectId "[email protected]" -ForceChangePasswordNextLogin $true

Windows (PowerShell) – Identify newly registered MFA methods:

Get-MgUserAuthenticationMethod -UserId "[email protected]" | Where-Object {$_.CreatedDateTime -gt (Get-Date).AddHours(-24)}

Linux – Monitor for suspicious OAuth token exchanges using tcpdump:

sudo tcpdump -i any -1 -A "host login.microsoftonline.com and port 443" -c 100

Linux – Parse audit logs for SharePoint data exfiltration attempts:

sudo ausearch -m USER_CMD -c python | grep -i sharepoint

Linux – Check for unexpected Python processes running data collection scripts:

ps aux | grep python | grep -E "sharepoint|exfil|download"

What Undercode Say:

  • Identity is the new perimeter. Helix demonstrates that traditional endpoint security is ineffective against attacks that use legitimate credentials and protocols. Security teams must shift focus to identity-centric threat detection.

  • Device code flow is a silent backdoor. The OAuth device code flow allows attackers to bypass MFA without ever obtaining credentials. Blocking this flow via Conditional Access is the single most effective mitigation.

  • Session replay is persistent. Once a session token is stolen, it can be replayed from anywhere—even after password resets. Token revocation and Continuous Access Evaluation are essential for containment.

  • Vishing is the new phishing. Social engineering remains the most effective attack vector. Organizations must train employees to recognize and report unsolicited authentication requests, regardless of the communication channel.

Analysis: The Helix group represents a maturation of the cyber extortion ecosystem. By abandoning malware in favor of identity abuse, they achieve higher success rates with lower detection risk. Their use of shared infrastructure with BlackFile and ShinyHunters suggests a consolidation of criminal capabilities. The dwell phase—lasting up to a week—indicates a methodical approach to data selection, maximizing extortion leverage. For defenders, the window of opportunity to respond is frighteningly short: once MFA is bypassed and a session is captured, data exfiltration can begin within minutes. This demands automated response capabilities and real-time visibility into authentication events.

Prediction:

-1 The Helix attack model will be rapidly adopted by other extortion groups, leading to a surge in identity-based attacks across all cloud providers. Organizations that delay implementing Conditional Access controls will face escalating breach risks.

-1 The effectiveness of device code phishing will drive Microsoft and other identity providers to reevaluate the security of the OAuth device code flow, potentially leading to deprecation or mandatory administrative enablement.

+1 Increased awareness and adoption of Continuous Access Evaluation and token revocation mechanisms will shorten attacker dwell times, reducing the volume of data exfiltration.

+1 The shift toward identity-based attacks will accelerate investment in AI-driven identity threat detection and response (ITDR) solutions, creating new opportunities for cybersecurity innovation.

▶️ Related Video (82% Match):

🎯Let’s Practice For Free:

🎓 Live Courses & Certifications:

Join Undercode Academy for Verified Certifications

🚀 Request a Custom Project:

Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands

IT/Security Reporter URL:

Reported By: Varshu25 Hackers – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow UndercodeTesting & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin | 🦋BlueSky