Security researchers at Island have disclosed an active and evolving supply-chain campaign against the Python Package Index (PyPI) that introduces a technique the industry hasn't had a clean name for until now: DevGating. In a DevGating attack, the malicious payload embedded in a package is encrypted or otherwise inert, and it only activates when the victim's environment contains a specific set of Python dependencies — the dependencies themselves act as the decryption key.
The campaign has been active since September 25, 2026, spans four distinct waves and eight malicious packages, and shows the operator iterating on evasion with each wave. That iterative behavior is the detail that should worry defenders most: this is not a one-shot typosquat. It's an adversary testing countermeasures against the open-source security ecosystem and refining tradecraft in production.
If your developers install Python packages, if your CI/CD pipelines pull from PyPI, or if your analysts' tooling depends on the Python ecosystem — you are in scope.
Why DevGating Breaks Traditional Defenses
Conventional malicious-package detection relies on static analysis of the package's source and behavioral sandboxing. DevGating defeats both:
- Static analysis fails because the payload is encrypted in the published package. Scanners reviewing the tarball or wheel see benign-looking code plus opaque ciphertext blobs.
- Sandbox analysis fails because the malicious code only executes when the target dependency stack is present. A clean analysis sandbox without the gated dependencies will never trigger the payload — the package looks clean in every dynamic test.
- The victim self-selects. The attacker targets environments with a particular dependency fingerprint — for example, financial tooling, crypto libraries, or specific framework versions. Only high-value victims that match the profile decrypt the payload. This is precision targeting, not spray-and-pray.
This mirrors the logic-bomb design of the SolarWinds SUNBURST build-injection and the staged delivery of the XZ Utils compromise, but implemented entirely at the dependency graph level — a layer most security tooling does not inspect.
Technical Analysis: The Attack Chain
Based on the Island disclosure, the campaign's attack chain looks like this:
- Package publication. The attacker publishes typosquatted or utility-lookalike packages to PyPI across four waves, iterating naming, obfuscation, and gating logic between waves.
- Installation via dependency resolution. A developer or CI system installs the malicious package directly, or it lands transitively through a poisoned dependency requirement.
- Environment fingerprinting at install or import time. The package enumerates the victim's installed packages — typically via
pkg_resources,importlib.metadata, or directpip listintrospection. - Gated decryption. The list of installed dependencies is hashed, combined, or otherwise transformed to derive a decryption key. Only if the environment matches the target profile does the payload decrypt.
- Payload execution. On matching victims, the decrypted second-stage executes — historically in campaigns of this type: credential theft (
.envfiles, AWS/GCP/Azure keys, SSH keys), developer token exfiltration, or a persistent implant.
What defenders can observe
Even though the payload is encrypted at rest, the gating logic itself is observable. Behaviors common to this class of attack:
pythonorpipprocesses reading the site-packages metadata of other packages (importlib.metadata.distributions(), scanningsite-packages/*/METADATA,*.dist-infodirectories)setup.py-style install hooks or post-import code performing hashing (SHA-256/MD5) over dependency name strings- Outbound network connections from
python.exe/pythonshortly afterpip installof a new or low-reputation package - Python code combining
base64,hashlib, andexec/evalin the same module — a classic encrypted-payload-with-derived-key pattern
Exploitation status
This is confirmed active in the wild — an ongoing campaign with four observed waves as of this writing. The affected packages have been reported through PyPI's abuse process, but removal from the index does not clean already-installed copies. Any developer workstation or build runner that installed one of the eight packages while it was live must be treated as potentially compromised.
No CVE applies to this campaign — it is a malicious-package operation, not a product vulnerability. Do not look for a CVE to drive your remediation; look for the behavior and the package provenance.
Detection & Response
SIGMA Rules
---
title: Python Dependency Enumeration Followed by Encoded Execution
type: rule
id: 2f8c4b71-9a3e-4d52-b6c7-1e0a5f9d8c23
status: experimental
description: Detects Python processes combining site-packages metadata enumeration with hashlib/base64 exec patterns, consistent with DevGating-style dependency-keyed payload decryption as observed in the 2026 PyPI campaign.
references:
- https://thehackernews.com/2026/12/8-malicious-pypi-packages-use-python.html
- https://attack.mitre.org/techniques/T1195/002/
- https://attack.mitre.org/techniques/T1027/
author: Security Arsenal
date: 2026/12/15
tags:
- attack.execution
- attack.defense_evasion
- attack.t1195.002
- attack.t1027
logsource:
category: process_creation
product: windows
detection:
selection_img:
Image|endswith:
- '\python.exe'
- '\pythonw.exe'
selection_cmd:
CommandLine|contains:
- 'importlib.metadata'
- 'pkg_resources'
- 'working_set'
- 'installed_distributions'
selection_crypto:
CommandLine|contains:
- 'hashlib'
- 'b64decode'
- 'exec('
- 'fromhex'
condition: selection_img and selection_cmd and selection_crypto
falsepositives:
- Legitimate plugin systems that enumerate installed packages (rare in one-liner command lines)
- Python-based installer utilities
level: high
---
title: Outbound Network Connection From Python Shortly After Package Install
id: 8d1e6a42-3c7b-4f19-a5d2-9b4e7c0f1a36
status: experimental
description: Detects python.exe establishing outbound connections, which is anomalous on developer workstations and build runners outside of expected package-index or API traffic. Target the post-install window in your SIEM correlation.
references:
- https://thehackernews.com/2026/12/8-malicious-pypi-packages-use-python.html
- https://attack.mitre.org/techniques/T1195/002/
- https://attack.mitre.org/techniques/T1071/001/
author: Security Arsenal
date: 2026/12/15
tags:
- attack.command_and_control
- attack.exfiltration
- attack.t1195.002
- attack.t1071.001
logsource:
category: network_connection
product: windows
detection:
selection:
Image|endswith:
- '\python.exe'
- '\pythonw.exe'
filter_known:
DestinationHostname|contains:
- 'pypi.org'
- 'pythonhosted.org'
- 'anaconda.com'
- 'github.com'
- '.azurewebsites.net'
- '.amazonaws.com'
- '.googleapis.com'
condition: selection and not filter_known
falsepositives:
- Python applications that legitimately call external APIs — build an allowlist per host role
- Jupyter/notebook traffic to kernel backends
level: medium
---
title: Pip Install of Low-Reputation or Typosquat-Pattern Package Names
id: 5c3a9f08-6d2e-4b71-8f4c-0a9d2e5b7c14
status: experimental
description: Detects pip installs of packages with naming patterns commonly used in PyPI typosquatting and dependency-confusion campaigns, including double-hyphened names, misspelled popular libraries, and version-pinned installs from non-standard indexes.
references:
- https://thehackernews.com/2026/12/8-malicious-pypi-packages-use-python.html
- https://attack.mitre.org/techniques/T1195/002/
author: Security Arsenal
date: 2026/12/15
tags:
- attack.initial_access
- attack.t1195.002
logsource:
category: process_creation
product: windows
detection:
selection_pip:
CommandLine|contains:
- 'pip install'
- 'pip3 install'
selection_suspicious:
CommandLine|contains:
- '--index-url http://'
- '--extra-index-url http://'
- '--trusted-host'
- 'install -r /tmp/'
condition: selection_pip and selection_suspicious
falsepositives:
- Internal package mirrors over plaintext (should be remediated anyway)
level: medium
KQL — Microsoft Sentinel / Defender
This hunt finds Python processes that enumerate installed package metadata and then spawn or network — the DevGating fingerprint on Windows endpoints and build agents. For Linux build runners ingested via Syslog/CEF, an equivalent Syslog query is included.
// Hunt: Python enumerating installed packages combined with decode/exec patterns (DevGating gating logic)
DeviceProcessEvents
| where TimeGenerated > ago(14d)
| where FileName in~ ("python.exe", "pythonw.exe", "python", "python3")
| where ProcessCommandLine has_any (
"importlib.metadata", "pkg_resources", "working_set", "installed_distributions", "dist-info"
)
and ProcessCommandLine has_any (
"hashlib", "b64decode", "fromhex", "exec(", "Fernet"
)
| project TimeGenerated, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessCommandLine, SHA256
| order by TimeGenerated desc;
// Hunt: Python making outbound connections within 30 minutes of a pip install on the same device
let installs = DeviceProcessEvents
| where TimeGenerated > ago(14d)
| where ProcessCommandLine has "pip install"
| extend InstallTime = TimeGenerated, DeviceId;
DeviceNetworkEvents
| where TimeGenerated > ago(14d)
| where InitiatingProcessFileName in~ ("python.exe", "pythonw.exe")
| join kind=inner installs on DeviceId
| where TimeGenerated between (InstallTime .. (InstallTime + 30m))
| where RemoteUrl !has_any ("pypi.org", "pythonhosted.org", "anaconda.com", "github.com")
| project TimeGenerated, DeviceName, RemoteUrl, RemoteIP, RemotePort, InitiatingProcessCommandLine, InstallTime
| order by TimeGenerated desc;
// Linux build runners (Syslog ingestion): python child processes after pip activity
Syslog
| where TimeGenerated > ago(14d)
| where SyslogMessage has_all ("python", "importlib.metadata")
or (SyslogMessage has "pip install" and SyslogMessage has_any ("--trusted-host", "--index-url http://"))
| project TimeGenerated, Computer, ProcessName, SyslogMessage
| order by TimeGenerated desc
Velociraptor VQL
Use this artifact to sweep your Python developer fleet and build runners for processes showing gating-logic behavior, and to enumerate recently modified site-packages content that arrived in the campaign window.
-- Hunt for Python processes exhibiting DevGating-style dependency enumeration
SELECT Pid, Ppid, Name, CommandLine, Exe, Username, CreateTime
FROM pslist()
WHERE (Name =~ '(?i)python' OR Exe =~ '(?i)python')
AND CommandLine =~ '(?i)(importlib\.metadata|pkg_resources|working_set|installed_distributions)'
AND CommandLine =~ '(?i)(hashlib|b64decode|fromhex|exec|Fernet)'
-- Enumerate recently installed site-packages dist-info directories (campaign window)
SELECT FullPath, Mtime, Size
FROM glob(globs='*/lib/python*/site-packages/*.dist-info/METADATA')
WHERE Mtime > parse(time='2026-09-25T00:00:00Z')
ORDER BY Mtime DESC
Remediation / Audit Script
Run this on developer workstations and CI runners to inventory installed packages, flag anything installed since the campaign start date, and check for the gating-logic patterns in installed source.
#!/bin/bash
# DevGating PyPI Campaign — Host Audit Script
# Run on Linux/macOS dev workstations and CI runners
REPORT="/tmp/devgating_audit_$(hostname)_$(date +%Y%m%d).txt"
CAMPAIGN_START="2026-09-25"
echo "=== DevGating PyPI Campaign Audit — $(hostname) — $(date) ===" | tee "$REPORT"
echo -e "\n[*] Python interpreters found:" | tee -a "$REPORT"
which python python3 pip pip3 2>/dev/null | tee -a "$REPORT"
echo -e "\n[*] All installed packages across site-packages:" | tee -a "$REPORT"
for py in python python3; do
command -v $py >/dev/null 2>&1 && $py -m pip list --format=freeze 2>/dev/null | tee -a "$REPORT"
done
echo -e "\n[*] site-packages content modified since campaign start ($CAMPAIGN_START):" | tee -a "$REPORT"
find ~/.local/lib /usr/lib/python3* /usr/local/lib/python3* \
-path "*/site-packages/*" -newermt "$CAMPAIGN_START" -name "*.py" \
2>/dev/null | head -200 | tee -a "$REPORT"
echo -e "\n[*] Scanning installed source for DevGating gating-logic patterns:" | tee -a "$REPORT"
grep -rl --include="*.py" -E "(importlib\.metadata|pkg_resources)" \
~/.local/lib /usr/local/lib/python3*/site-packages 2>/dev/null | \
while read -r f; do
if grep -qE "(hashlib|b64decode|Fernet|fromhex)" "$f"; then
echo " [SUSPICIOUS] $f" | tee -a "$REPORT"
fi
done
echo -e "\n[*] Recent pip install history (shell history artifacts):" | tee -a "$REPORT"
grep -h "pip install" ~/.bash_history ~/.zsh_history 2>/dev/null | tail -50 | tee -a "$REPORT"
echo -e "\n[*] Credential files potentially exposed (for scoping, not collection):" | tee -a "$REPORT"
ls -la ~/.aws/credentials ~/.ssh/id_* ~/.netrc ./.env 2>/dev/null | tee -a "$REPORT"
echo -e "\n=== Audit complete. Review $REPORT and escalate any SUSPICIOUS hits to IR. ==="
For Windows developer endpoints, deploy this via your RMM or as an Intune remediation:
# DevGating PyPI Campaign - Windows Endpoint Audit
$report = "$env:TEMP\devgating_audit_$env:COMPUTERNAME.txt"
$campaignStart = Get-Date '2026-09-25'
"=== DevGating Audit - $env:COMPUTERNAME - $(Get-Date) ===" | Out-File $report
"`n[*] Installed packages:" | Out-File $report -Append
& python -m pip list --format=freeze 2>$null | Out-File $report -Append
"`n[*] site-packages .py files modified since campaign start:" | Out-File $report -Append
$sitePackages = @(
"$env:LOCALAPPDATA\Programs\Python",
"$env:APPDATA\Python",
"C:\Python*"
) | ForEach-Object { Get-ChildItem $_ -Recurse -Filter 'site-packages' -Directory -ErrorAction SilentlyContinue }
foreach ($sp in $sitePackages) {
Get-ChildItem $sp.FullName -Recurse -Filter *.py -ErrorAction SilentlyContinue |
Where-Object { $_.LastWriteTime -gt $campaignStart } |
Select-Object -First 300 -ExpandProperty FullName | Out-File $report -Append
}
"`n[*] Scanning for gating-logic patterns (metadata enum + crypto + exec):" | Out-File $report -Append
foreach ($sp in $sitePackages) {
Get-ChildItem $sp.FullName -Recurse -Filter *.py -ErrorAction SilentlyContinue | ForEach-Object {
$c = Get-Content $_.FullName -Raw -ErrorAction SilentlyContinue
if ($c -match 'importlib.metadata|pkg_resources' -and $c -match 'hashlib|b64decode|Fernet' -and $c -match 'exec|eval') {
" [SUSPICIOUS] $($_.FullName)" | Out-File $report -Append
}
}
}
"`nAudit complete. Collect $report and escalate SUSPICIOUS hits." | Out-File $report -Append
Write-Output "Report written to $report"
Remediation & Hardening
1. Identify and purge exposure first. Removal from PyPI does nothing for machines that already installed the packages. Cross-reference your pip list inventories against the eight package names in the Island disclosure, then rebuild any affected environment from a known-good state — do not simply pip uninstall, because a decrypted second-stage may have established persistence outside the package directory.
2. Rotate developer credentials on any exposed host. Assume .env files, cloud provider keys (~/.aws, ~/.azure, ~/.config/gcloud), SSH keys, PyPI/GitHub tokens, and browser-stored credentials on affected machines are compromised. Rotate all of them.
3. Gate package installation at the pipeline level.
- Pin all dependencies by hash (
pip install --require-hashes -r requirements.txt) - Use a private package proxy (Artifactory, Nexus, devpi) that only allows packages that have passed a vetting workflow — quarantine new packages for a defined soak period before they reach production builds
- Disable
--extra-index-urland--trusted-hostin CI builds entirely; enforce via pip config and egress rules - Generate and enforce SBOMs (CycloneDX/SPDX) so you can answer "where is package X installed?" in minutes, not days
4. Egress-control your build runners. CI agents should only be able to reach pypi.org, files.pythonhosted.org, and your internal mirror. Any other destination from a build runner is an incident, not a log line. This single control would have neutered the exfiltration stage of most PyPI campaigns, this one included.
5. Treat dependency enumeration as a detection surface. Legitimate packages almost never need to inventory your installed packages, hash the list, and decrypt embedded blobs with the result. That behavioral chain — metadata enumeration → hash derivation → decrypt → exec — is high-fidelity when you can correlate it. Feed the audit script output and the KQL hunts above into a weekly detection review.
6. Monitor the campaign's evolution. Four waves in under three months means a fifth is coming. Subscribe to PyPI's security advisories, track Island's research updates, and consider feeding PyPI new-package RSS through a typosquat-similarity filter against your actual dependency tree.
The Bigger Lesson
DevGating is a maturation signal for supply-chain adversaries: they've learned that our scanners look at the package, not at the interaction between the package and its target environment. Your dependency graph is now part of your attack surface in a literal, cryptographic sense. The organizations that weather the next wave will be the ones that pinned hashes, proxied their package sources, locked down build-runner egress, and treated every new package in a build as a change-management event.
If you need help validating your supply-chain controls or hunting for exposure across your developer fleet, reach out.
Related Resources
Security Arsenal Penetration Testing Services AlertMonitor Platform Book a SOC Assessment vulnerability-management Intel Hub
Is your security operations ready?
Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.