An active campaign against the Python Package Index is using a previously unreported evasion trick that security researchers have named DevGating: the malware only arms itself when the infected machine's installed Python dependencies match a profile the attacker has pre-computed. In effect, a developer's own environment becomes the decryption key for the payload.

According to The Hacker News, reporting on research published by Island, the campaign has been running since 25 September 2026 and has been split across four waves, delivering eight malicious PyPI packages in total. The attacker has been iterating on the technique with each wave, progressively tightening the conditions under which the payload unlocks. Island describes the operation as active and evolving.

The package names are in the original report, and we have chosen not to repeat them here: indicators in a rolling campaign typically age in days, while the mechanism is the durable story.

How DevGating differs from conventional supply-chain malware

Traditional malicious packages aim to execute on as many installs as possible. A payload that runs everywhere gets captured quickly: sandboxed analysis environments, automated behavioural scanners, and even hobby projects all produce a sample for reverse engineers to work with.

DevGating inverts that logic. Before dropping or activating anything, the package enumerates the host's installed dependencies and compares them against a target fingerprint, which Island's write-up presumably frames as a stack profile representative of a real development workstation or build agent. If the environment does not match, the package behaves benignly. Clean-environment sandboxes and bare test containers therefore always see harmless behaviour, while genuine developer machines and CI runners are the ones that trigger.

This selectivity is precisely what makes the technique dangerous to defenders. Because successive waves narrow the match conditions further, a shrinking fraction of installations will yield a capturable sample. "Install-and-watch" detection pipelines — which install a package in a pristine container and check for malicious activity — will increasingly return clean-but-wrong verdicts, and the absence of a detection will no longer imply safety.

A second, quieter consequence: a well-populated dependency graph, normally a sign of a healthy project, is repurposed as the credential that arms the malware. Anything that publicly leaks a team's stack — verbose build logs, exposed SBOMs, dependency lists in public repositories — lowers the attacker's bar for crafting a matching fingerprint.

Why it matters

Python's ecosystem is the largest in the world, and PyPI's trust-on-first-use model still places a heavy burden on consumers. DevGating demonstrates that the arms race has moved beyond simply hiding a payload inside a setup script; attackers are now modelling the victim's defence infrastructure and designing payloads that evade it by definition. For any organisation that relies on automated package scanning as a primary control, this is a direct challenge to the assumption that a clean scan means a clean package.

What defenders should do

  1. Pin and hash-verify dependencies. Lock files and hash pinning prevent silent substitution and make unexpected version changes visible in review.
  2. Test in more than one environment. Evaluate new packages both in a clean sandbox and in a realistic environment resembling your actual build agents, so environment-specific trigger behaviour has a chance to surface.
  3. Alert on unexpected version jumps in transitive dependencies, particularly for packages with little recent maintenance history.
  4. Scrutinise install-time behaviour. Legitimate packages have limited reason to enumerate the installed library set on a target system during installation; treat that as a signal worth investigating.
  5. Run dependency and install-time scanning inside CI, including against a realistic build image rather than a bare container alone.
  6. For teams running in-house CI/CD — including those in Hong Kong — consider mirroring PyPI through a private internal index, so public-package exposure is limited to an approved window, and allow-listing packages by publisher and namespace rather than relying on reactive blocklists. These are routine hygiene measures; combined, they attack the specific conditions DevGating depends on — an attacker-visible stack and an unguarded path from public registry to production build.

Treat the reported package list as a snapshot: Island's research is ongoing and further waves are likely, so subscribe to the source for updates rather than relying on a static blocklist.


一場針對 Python Package Index(PyPI)的活躍攻擊行動,正使用一種此前未被披露的規避技巧,安全研究人員將其命名為 DevGating:惡意軟件只有在受感染機器已安裝的 Python 依賴項符合攻擊者預先計算的特徵時,才會武裝起來。實際上,開發者自身的環境變成了有效載荷(payload)的解密密鑰。

據 The Hacker News 報道(基於 Island 公布的研究),該行動自 2026 年 9 月 25 日起持續運作,分為四個浪潮展開,合共投放了八個惡意 PyPI 軟件包。攻擊者在每個浪潮中不斷改進該技巧,逐步收緊有效載荷解鎖的條件。Island 形容該行動處於活躍且持續演變的狀態。

軟件包名稱載於原始報告中,我們選擇在此不作重複:在一場持續滾動的攻擊行動中,指標(indicator)通常數日便會失效,而機制本身才是持久的核心議題。

DevGating 與傳統供應鏈惡意軟件的分別

傳統惡意軟件包的目標是在盡可能多的安裝中執行。一個處處都能運行的有效載荷會很快被捕捉:沙盒分析環境、自動化行為掃描器,甚至業餘愛好項目,都會為逆向工程人員提供樣本。

DevGating 顛覆了這一邏輯。在投放或啟動任何東西之前,軟件包會列舉主機已安裝的依賴項,並將其與目標指紋比對——Island 的文章推測而言,將其界定為代表真實開發工作站或 build agent 的技術棧(stack)特徵。如果環境不相符,軟件包便表現出良性的行為。因此,乾淨環境的沙盒和裸測試容器永遠只會看到無害行為,而真正開發者的機器和 CI runner 才是觸發者。

這種選擇性正是該技巧對防禦者危險之處。由於後續浪潮不斷收窄匹配條件,能產生可捕捉樣本的安裝比例將持續縮小。「安裝並觀察」(install-and-watch)的偵測流程——即在乾淨容器中安裝軟件包並檢查惡意活動——將越來越多地回傳「看似乾淨但實際錯誤」的結果,未偵測到問題將不再等同於安全。

第二個較為隱蔽的後果:一個充實的 dependency graph——通常是項目健康的標誌——被挪用為武裝惡意軟件的憑證。任何公開洩露團隊技術棧的途徑——冗長的 build log、公開的 SBOM、公開 repository 中的依賴項清單——都會降低攻擊者製作相符指紋的門檻。

為何重要

Python 生態系統是全球最大的,而 PyPI 的「首次使用即信任」(trust-on-first-use)模式仍然對使用方構成沉重負擔。DevGating 表明,軍備競賽已不止於將有效載荷藏入 setup script 之中;攻擊者現在正在模擬受害者的防禦基礎設施,並設計出從定義上便能規避該防禦的有效載荷。對於任何依賴自動化軟件包掃描作為主要控制手段的機構而言,這直接挑戰了「掃描結果乾淨即代表軟件包乾淨」這一假設。

防禦者應採取的措施

  1. 鎖定並以雜湊值驗證依賴項。 Lock file 與 hash pinning 可防止靜默替換,並使審查中出現的意外版本變更無所遁形。
  2. 在不止一個環境中測試。 評估新軟件包時,既要在乾淨沙盒中進行,也要在貼近實際 build agent 的真實環境中進行,令因環境而異的觸發行為有機會浮現。
  3. 對傳遞依賴項(transitive dependencies)中意外的版本跳躍發出警報, 尤其是近期維護記錄較少的軟件包。
  4. 審查安裝時的行為。 合法軟件包在安裝過程中列舉目標系統內已安裝的函式庫組合並無充分理由;應將此視為值得調查的信號。
  5. 在 CI 內運行依賴項與安裝時掃描, 並須以真實 build image 而非僅以裸容器進行測試。
  6. 對於運行自家 CI/CD 的團隊——包括香港的團隊——可考慮通過私有內部 index 鏡像 PyPI, 使公開軟件包的接觸範圍限制在經批准的窗口之內,並以發佈者和 namespace 為依據實施軟件包允許清單(allow-list),而非依賴事後封鎖名單(blocklist)。這些屬例行的防護衛生措施;合併實施後,可直接打擊 DevGating 所依賴的特定條件——攻擊者可見的技術棧,以及從公開 registry 到 production build 之間缺乏防護的路徑。

請將所通報的軟件包清單視為快照:Island 的研究仍在進行,後續浪潮很可能出現,因此應訂閱來源以獲取最新消息,而非依賴一份靜態的封鎖名單。

新聞來源 / Original News Source