Back to Intelligence

PolinRider: North Korea-Linked Campaign Poisons 7,600+ GitHub Repositories — Detection and Defense Guide

SA
Security Arsenal Team
November 28, 2026
11 min read

What Happened

Security researchers at Apiiro have uncovered a large-scale repository-poisoning campaign — tracked as PolinRider — attributed to North Korea-linked threat actors. The operation has compromised over 7,600 GitHub repositories, in some cases planting a Python loader capable of retrieving and executing next-stage malicious code. Evidence indicates the activity may have been running since February 2025, meaning this is not a smash-and-grab operation — it is a patient, long-dwell supply-chain effort.

The detail that should concern every defender is the account profile. Per Apiiro researcher Shmulik Cohen: "These are real developers, not throwaway accounts. 6,541 of the 7,609 repos (86%) belong to" legitimate developer identities. That distinction matters operationally. Typosquatted packages and disposable accounts are easy to discount; poisoned code living under the names of credible, established developers inherits trust by default. Developers clone it. CI systems build it. Junior engineers pip install and run setup.py without reading it. The trust fabric of open source is the delivery mechanism.

There is no CVE here — this is not a vulnerability in a product you can patch. It is abuse of a legitimate platform and the social/technical trust relationships built on top of it. That makes detection engineering and developer-workflow hardening your primary controls.

Who Is at Risk

  • Software development organizations whose engineers clone, fork, or build from third-party GitHub repositories.
  • DevOps/platform teams whose CI/CD pipelines pull dependencies or build scripts from public repos without pinning or review.
  • Any organization with developer workstations that have egress to GitHub and PyPI — because that is exactly the path the loader uses.

If your developers build from public source, assume exposure until proven otherwise.

Technical Analysis

Campaign Overview

AttributeDetail
Campaign namePolinRider
AttributionNorth Korea (DPRK)-linked threat actors
Scale7,609 compromised repositories; 6,541 (86%) tied to legitimate developer accounts
Payload mechanismPython loader embedded in repository content, delivering next-stage malicious code
Activity windowEvidence of operation dating back to at least February 2025
Disclosed byApiiro (researcher Shmulik Cohen)
CVENone — abuse of a legitimate platform, not a software vulnerability
CISA KEVNot applicable (no CVE)
Exploitation statusConfirmed active, in the wild, long-dwell campaign

Attack Chain — Defender's View

Based on the reported behavior, the kill chain looks like this:

  1. Poisoning: Malicious code — a Python loader — is planted inside a legitimate developer's repository (embedded in source files, setup scripts, build helpers, or supporting modules). Because the account is established, the repo passes casual scrutiny and may already have stars, forks, and downstream consumers.
  2. Delivery: A victim clones or pulls the repository, or a CI job checks it out. Execution typically occurs when a developer runs a setup/build step (python setup.py install, pip install ., running a helper script, or importing a poisoned module).
  3. Loader execution: The embedded Python loader runs — classically a small inline or staged script that decodes obfuscated content (e.g., Base64) and reaches out to actor-controlled infrastructure.
  4. Second stage: The loader downloads and executes the next-stage payload — in DPRK developer-targeting operations this has historically meant credential/session theft, browser data theft, and persistent implants targeting developers' wallets, tokens, and build secrets.
  5. Expansion: Stolen developer credentials (GitHub PATs, SSH keys, cloud tokens) enable poisoning of additional repositories under real identities — which is precisely how you get to 86% legitimate-account ownership. The campaign feeds itself.

Why This Technique Works

A Python loader is a near-perfect weapon against developers:

  • Python is ubiquitous on dev machines and build runners; python.exe executing a script is normal activity that blends into baseline noise.
  • Inline execution (python -c "...") leaves minimal file-system footprint and defeats naive signature-based AV.
  • Egress to GitHub/PyPI/raw content hosts is expected and rarely inspected on dev workstations.
  • Repo trust is transitive: developers who would never run a random EXE will happily execute a setup script from a repo with 400 stars.

Attribution Context

North Korea-linked actors have a well-documented operational pattern of targeting software developers with poisoned tools, fake job-related packages, and malicious npm/PyPI/GitHub content — operationally consistent with the long-running effort to generate revenue and steal credentials/crypto assets. PolinRider's scale (7,600+ repos) and longevity (likely active since February 2025) indicate a resourced, disciplined actor — treat this as a persistent campaign, not an event.

Detection & Response

The detections below target the observable behaviors of a Python loader executing on a developer workstation or build runner: inline Python execution with download/decode primitives, Python running from user-writable staging paths, and build tooling spawning scripted interpreters. They are written to be high-signal, not broad — deploy them and tune the false-positive notes for your environment.

Sigma Rules

YAML
---
title: Python Inline Command with Download-Decode Primitives
description: Detects python.exe/pythonw.exe invoked with an inline (-c) command containing download or decode primitives consistent with a staged Python loader retrieving next-stage code.
references:
  - https://attack.mitre.org/techniques/T1059/006/
  - https://attack.mitre.org/techniques/T1105/
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.execution
  - attack.t1059.006
  - attack.command_and_control
  - attack.t1105
logsource:
  category: process_creation
  product: windows
detection:
  selection_image:
    Image|endswith:
      - '\python.exe'
      - '\pythonw.exe'
  selection_inline:
    CommandLine|contains:
      - ' -c '
      - '-c "'
      - "-c '"
  selection_dl:
    CommandLine|contains:
      - 'urllib.request'
      - 'urlopen'
      - 'base64.b64decode'
      - 'requests.get'
      - 'exec('
  condition: selection_image and selection_inline and selection_dl
falsepositives:
  - Legitimate developer one-liners and automation scripts; whitelist known internal tooling
level: high
---
title: Python Execution from User-Writable Staging Directory
description: Detects the Python interpreter executing a script or payload from user-writable staging locations (Temp, Roaming, Public) consistent with a loader dropping and running a second-stage payload.
references:
  - https://attack.mitre.org/techniques/T1059/006/
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.execution
  - attack.t1059.006
logsource:
  category: process_creation
  product: windows
detection:
  selection_image:
    Image|endswith:
      - '\python.exe'
      - '\pythonw.exe'
  selection_path:
    CommandLine|contains:
      - 'AppData\Local\Temp'
      - 'AppData\Roaming'
      - '\Windows\Temp\'
      - 'C:\Users\Public\'
  condition: selection_image and selection_path
falsepositives:
  - Installer bootstrapper scripts and some legitimate dev tools run from Temp; correlate with parent process and unsigned binaries
level: medium
---
title: Build Tool Spawning Inline Python Interpreter
description: Detects git.exe, build runners, or editors spawning python.exe with an inline command - an execution pattern consistent with a poisoned repository's setup/build hook running an embedded loader.
references:
  - https://attack.mitre.org/techniques/T1059/006/
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.execution
  - attack.t1059.006
logsource:
  category: process_creation
  product: windows
detection:
  selection_parent:
    ParentImage|endswith:
      - '\git.exe'
      - '\code.exe'
      - '\cmd.exe'
      - '\powershell.exe'
      - '\msbuild.exe'
  selection_image:
    Image|endswith:
      - '\python.exe'
      - '\pythonw.exe'
  selection_inline:
    CommandLine|contains:
      - ' -c '
  condition: selection_parent and selection_image and selection_inline
falsepositives:
  - Legitimate build scripts using inline Python; uncommon in most environments - baseline before alerting
level: high

KQL — Microsoft Sentinel / Defender

Hunt for the loader behavior and, critically, join process execution to outbound network activity — a Python process making a raw outbound connection within seconds of an inline/decode execution is the highest-confidence signal on a developer workstation.

KQL — Microsoft Sentinel / Defender
// Hunt 1: Inline Python execution with download/decode primitives, joined to outbound connections
let Lookback = 14d;
let SuspiciousPython = DeviceProcessEvents
| where Timestamp >= ago(Lookback)
| where FileName in~ ("python.exe", "pythonw.exe", "python3.exe")
| where ProcessCommandLine has_any ("urllib.request", "urlopen", "base64.b64decode", "requests.get", "exec(")
   or (ProcessCommandLine has " -c " and ProcessCommandLine has "http");
SuspiciousPython
| join kind=leftouter (
    DeviceNetworkEvents
    | where Timestamp >= ago(Lookback)
    | where InitiatingProcessFileName in~ ("python.exe", "pythonw.exe", "python3.exe")
    | where RemoteUrl !has_any ("pypi.org", "pythonhosted.org", "github.com", "microsoft.com")
    | project TimeGenerated, DeviceId, RemoteUrl, RemoteIP, InitiatingProcessId, InitiatingProcessCreationTime
) on $left.DeviceId == $right.DeviceId and $left.ProcessId == $right.InitiatingProcessId
| project Timestamp, DeviceName, AccountName, ProcessCommandLine, RemoteUrl, RemoteIP, InitiatingProcessCreationTime
| order by Timestamp desc;

// Hunt 2: git clone/pull followed within 10 minutes by Python execution on the same device (poisoned repo checkout)
DeviceProcessEvents
| where Timestamp >= ago(Lookback)
| where FileName =~ "git.exe" and ProcessCommandLine has_any ("clone", "pull", "fetch")
| join kind=inner (
    DeviceProcessEvents
    | where Timestamp >= ago(Lookback)
    | where FileName in~ ("python.exe", "pythonw.exe", "python3.exe")
) on DeviceId
| where (Timestamp1 - Timestamp) between (0min .. 10min)
| project GitTime = Timestamp, GitCommand = ProcessCommandLine, PythonTime = Timestamp1, PythonCommand = ProcessCommandLine1, DeviceName, AccountName;

Velociraptor VQL

VQL — Velociraptor
-- Hunt for Python loader processes and their live network connections on Windows endpoints
SELECT Pid, Name, CommandLine, Exe, Username, CreateTime
FROM pslist()
WHERE Name =~ 'python(w)?(3)?\\.exe'
  AND (CommandLine =~ 'urllib|urlopen|b64decode|requests\\.get|exec\\(|-c .*http'
       OR CommandLine =~ 'AppData\\\\(Local\\\\Temp|Roaming)|Windows\\\\Temp|Users\\\\Public')
VQL — Velociraptor
-- Correlate Python processes to outbound socket connections (exclude expected package endpoints)
SELECT Pid, Name, CommandLine,
       netstat.Pid AS NPid, netstat.RemoteAddrIP AS RemoteIP,
       netstat.RemoteAddrPort AS RemotePort, netstat.State
FROM pslist()
WHERE Name =~ 'python(w)?(3)?\\.exe'
  AND CommandLine =~ '-c |b64decode|urllib'

Remediation Script

The following PowerShell script scans a directory of cloned repositories for Python files exhibiting loader characteristics (download-and-exec primitives, base64-decoded execution, obfuscation indicators) and flags suspicious git remotes. Run it across developer workstations' source folders and CI workspace caches.

PowerShell
# PolinRider repo-scan: hunt for Python loader indicators in cloned repositories
# Usage: .\Invoke-RepoLoaderScan.ps1 -Root "C:\Users\<dev>\source" -OutCsv ".\loader-findings.csv"

param(
    [Parameter(Mandatory=$true)][string]$Root,
    [string]$OutCsv = ".\polinrider-scan-findings.csv"
)

$loaderPatterns = @(
    'base64\.b64decode',
    'urllib\.request',
    'urlopen\(',
    'requests\.get\(.*\)\.(text|content)',
    'exec\(',
    'eval\(',
    'subprocess\.(run|Popen|call)',
    'marshal\.loads',
    'zlib\.decompress',
    'codecs\.decode\(.*hex'
)

$findings = @()

Get-ChildItem -Path $Root -Recurse -Filter "*.py" -ErrorAction SilentlyContinue | ForEach-Object {
    try {
        $content = Get-Content $_.FullName -Raw -ErrorAction Stop
        $hits = @()
        foreach ($p in $loaderPatterns) {
            if ($content -match $p) { $hits += $p }
        }
        # Flag high-signal combos: decode/download primitives combined with exec/eval
        $combo = ($hits -match 'b64decode|urlopen|urllib|requests\.get').Count -gt 0 -and
                 ($hits -match 'exec\(|eval\(|marshal\.loads').Count -gt 0
        if ($combo) {
            $findings += [PSCustomObject]@{
                File = $_.FullName
                LastWrite = $_.LastWriteTime
                MatchedPatterns = ($hits -join ';')
                Severity = 'HIGH'
            }
        } elseif ($hits.Count -ge 3) {
            $findings += [PSCustomObject]@{
                File = $_.FullName
                LastWrite = $_.LastWriteTime
                MatchedPatterns = ($hits -join ';')
                Severity = 'REVIEW'
            }
        }
    } catch {}
}

# Flag suspicious git remotes (non-org remotes on recently-modified repos)
Get-ChildItem -Path $Root -Recurse -Directory -Filter ".git" -Hidden -ErrorAction SilentlyContinue | ForEach-Object {
    $repoDir = Split-Path $_.FullName -Parent
    $config = Join-Path $_.FullName "config"
    if (Test-Path $config) {
        $remote = Select-String -Path $config -Pattern 'url\s*=\s*(.+)' |
                  ForEach-Object { $_.Matches.Groups[1].Value.Trim() }
        $findings += [PSCustomObject]@{
            File = $repoDir
            LastWrite = (Get-Item $repoDir).LastWriteTime
            MatchedPatterns = "REMOTE: $remote"
            Severity = 'INFO'
        }
    }
}

$findings | Export-Csv -Path $OutCsv -NoTypeInformation
Write-Host "[+] Scan complete. $($findings.Count) findings written to $OutCsv"
$findings | Where-Object Severity -eq 'HIGH' | Format-Table -AutoSize

Remediation

Because there is no patch for repository poisoning, remediation is a combination of exposure elimination, credential hygiene, and workflow hardening. Prioritize in this order:

1. Immediate — Contain Suspected Exposure

  • Isolate any workstation or build runner that cloned or built from a repository matching campaign indicators, and run the detections above before reimaging. If a HIGH finding from the scan script is present, treat the host as compromised and initiate IR procedures.
  • Block and hunt egress from developer machines and CI runners to unknown destinations. Python processes have no business making outbound connections beyond package indexes and your internal artifact repository.
  • Do not execute setup.py, install hooks, or helper scripts from untrusted repos without review. Build in sandboxed, ephemeral containers with no secret access.

2. Credential Rotation — Assume Developer Identity Is the Target

The campaign's 86% legitimate-account ratio tells you the actor is harvesting and abusing real developer identities. If any exposure is confirmed:

  • Rotate GitHub PATs, SSH keys, OAuth tokens, and any cloud/CI secrets reachable from affected hosts.
  • Audit the GitHub security log (Settings → Security → Security log) for anomalous sessions, new PATs, and unexpected repository changes.
  • Enforce phishing-resistant MFA (FIDO2/passkeys) on all developer GitHub accounts and require it org-wide via SSO.

3. Repository and Pipeline Hardening

  • Pin dependencies to immutable versions/hashes; pull packages through an internal artifact proxy/mirror with allowlisting rather than direct-to-PyPI.
  • Enable secret scanning, push protection, and Dependabot alerts on your GitHub organization; review new contributors and unexpected commits to build/setup files.
  • Require code review for any change touching setup scripts, build hooks, or CI definitions — these are the loader's preferred hiding places.
  • Report suspected poisoned repositories to GitHub abuse reporting and cross-reference against Apiiro's published research for the campaign's repository list and indicators.

4. Detection Posture

  • Deploy the Sigma rules above to your endpoint telemetry; deploy the KQL hunts as scheduled analytics in Sentinel for your developer fleet.
  • Add Python outbound-connection alerting as a standing analytic on dev workstations and build runners — it is one of the highest-value, lowest-noise signals for this exact threat class.

References

Bottom line: PolinRider weaponizes trust in open-source code at industrial scale, using real developer identities as camouflage. You cannot patch this — you detect the loader's behavior, harden the build workflow, and treat developer credentials as the crown jewels they clearly are to DPRK operators.

Related Resources

Security Arsenal Incident Response Services AlertMonitor Platform Book a SOC Assessment incident-response Intel Hub

Is your security operations ready?

Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.