A sophisticated and increasing wave of cyberattacks now targets software developers through a little-known yet legitimate GitHub feature: the OAuth 2.0 Device Code Flow.
Security experts, notably from Praetorian, have warned that threat actors are leveraging this mechanism to trick developers into surrendering access to their most sensitive code repositories and CI/CD pipelines.
The attacks pose a substantial risk to intellectual property and could facilitate large-scale supply chain attacks.
The Attack Methodology: From Device Codes to Rogue Tokens
At the heart of the attack is GitHub’s device code authentication, designed to help users log in on devices with limited input, such as smart TVs or IoT devices.
The process is straightforward: a device requests a short-lived code and a verification URL from GitHub’s OAuth service. T
The user enters the code in a browser to authenticate the device, which then fetches an access token on their behalf.
This flow is legitimate and necessary, but crucially, it doesn’t guarantee that the person generating the code is the same person authenticating it.
Attackers have found ways to exploit this vulnerability. Here’s how the attack typically unfolds:

- Step 1: Code Generation
The attacker uses GitHub’s OAuth API to request a device code, scoped with powerful permissions such as user, repository, and workflow access. - Step 2: Social Engineering
They deliver the device code and verification URL to the target (often via phone, email, or SMS), masquerading as IT or support staff. - Step 3: User Authentication
The victim, believing the request is legitimate, visits the verification URL and enters the code, essentially authorizing the attacker’s device to act on their behalf. - Step 4: Token Retrieval
The attacker retrieves the OAuth token, granting them long-term, elevated access to the victim’s GitHub resources. - Step 5: Exploitation
With the token, the attacker can exfiltrate private code, manipulate CI/CD workflows, access secrets, and even initiate supply chain attacks by backdooring repositories.
Recent case studies highlight highly effective campaigns.
In one example, attackers used compromised internal access to proxy device code requests to an organization’s GitHub Enterprise, then leveraged phone-based impersonation to trick developers into authorizing access.
Another variant, “GitPhish,” automates the entire process, generating fresh device codes on demand via a professional-looking GitHub Pages site, ensuring every victim receives a valid, live code.
Defensive Strategies: Detection and Prevention Remain Critical
Currently, there is no way to outright disable device code flow on GitHub. As a result, technical controls and vigilant monitoring are critical:
- Audit Log Awareness:
Monitor GitHub’s audit logs for unauthorized OAuth authorizations (org_credential_authorization.grant events). Pay special attention to suspicious token scopes and multiple rapid events. - Network Monitoring:
Watch for unusual spikes in visits to github.com/login/device, which may indicate a phishing campaign. - IP Allow-Listing:
Restrict access to the GitHub organization to known, trusted IP addresses, though this may break CI/CD workflows if not carefully managed. - Post-Grant Behavior:
Look for abnormal activity, such as excessive repository cloning or secret scanning, mainly if it occurs after a new OAuth authorization.
According to the Report, Security experts urge organizations to prepare robust detection and response playbooks.
With threat actors rapidly adopting GitHub device code phishing, the risk to developer environments and supply chains is clear.
Developers and security teams must remain vigilant, as the modern threat landscape offers no certainty except that the call is coming from within your own GitHub organization.
Find this News Interesting! Follow us on Google News, LinkedIn, & X to Get Instant Updates