跳到主要內容

FaceHugger漏洞:Hugging Face Diffusers恐遭遠端執行程式碼 | FaceHugger Flaw: Hugging Face Diffusers Faces RCE Risk

By Kit 小克 | AI Tool Observer | 2026-08-04

🇹🇼 FaceHugger漏洞:Hugging Face Diffusers恐遭遠端執行程式碼

FaceHugger 是資安團隊 Zafran Labs 於 2026 年 8 月揭露的一組漏洞代號,鎖定 Hugging Face 熱門圖像生成套件 Diffusers,只要載入惡意打造的模型儲存庫,就可能在你的機器上遠端執行任意程式碼。這波揭露一共包含三個 CVE,影響的是幾乎所有 AI 開發者都在用的 from_pretrained() 載入流程,凸顯 AI 供應鏈安全的老問題又出現新變種。

FaceHugger 漏洞到底是什麼?

FaceHugger 泛指三個能繞過 Diffusers 安全機制的漏洞:CVE-2026-44827(CVSS 8.8)、CVE-2026-45804(CVSS 7.5)與 CVE-2026-44513(CVSS 8.8),核心問題都指向同一個機制失靈——trust_remote_code 安全開關本該擋下未經審核的自訂程式碼,卻被繞過了。

trust_remote_code 為什麼會失效?

Diffusers 原本設計是:沒指定 custom_pipeline 時,載入器會去找一個叫 None.py 的檔案,但檢查存在性時走的是另一條程式碼路徑,沒把 None.py 算進去。結果只要儲存庫裡真的塞一個叫 None.py 的檔案,即使 trust_remote_code=False(也是預設值),攻擊者的程式碼還是會在你載入模型時被執行。另一個變種則是利用 hf_hub_downloadsnapshot_download 兩次 HTTP 呼叫之間約 0.3 秒的競態視窗,偷天換日置換設定檔。

誰會受影響?該怎麼修?

只要你的專案、CI/CD 流程或容器映像檔中有呼叫 Diffusers 載入來路不明的模型儲存庫,就在風險範圍內——一次中毒的模型載入,就足以讓攻擊者拿到企業內網的初始立足點,而不只是單一應用程式受害。好消息是,Diffusers 官方已在 0.38.0 版修補完畢(2026 年 5 月釋出)。實務建議:

  • 立刻升級到 Diffusers 0.38.0 或以上版本
  • 不要對不熟悉來源的 Hub 儲存庫使用 trust_remote_code=True
  • CI/CD 與容器建置流程中鎖定套件版本,避免自動拉取未驗證的模型
  • 盤點現有專案是否有引用第三方 Diffusers pipeline,逐一檢查更新

Kit 小克怎麼看

這次 FaceHugger 再次證明,AI 供應鏈的攻擊面不只在模型權重本身,連「載入模型」這個動作都可能是後門。Hugging Face 生態系規模龐大,任何一個安全開關失靈都是全網開發者共同承擔的風險。如果你的專案還在用舊版 Diffusers,這次真的別拖,先升級再說。好不好用,試了才知道。


🇺🇸 FaceHugger Flaw: Hugging Face Diffusers Faces RCE Risk

FaceHugger is the name security firm Zafran Labs gave to a set of vulnerabilities disclosed in August 2026, targeting Hugging Face's popular Diffusers library for image generation. Loading a maliciously crafted model repository can trigger remote code execution on your machine — and three CVEs are involved, all hitting the near-universal from_pretrained() loading path used across the AI developer ecosystem.

What exactly is the FaceHugger flaw?

FaceHugger covers three bugs that bypass Diffusers' safety checks: CVE-2026-44827 (CVSS 8.8), CVE-2026-45804 (CVSS 7.5), and CVE-2026-44513 (CVSS 8.8). All three trace back to the same failure point — the trust_remote_code safeguard, meant to block unreviewed custom code, doesn't actually block it.

Why does trust_remote_code fail here?

When no custom_pipeline is specified, Diffusers' loader looks for a file literally named None.py — but the existence check runs through a different code path that never flags that filename. Drop a file called None.py into a repo, and it executes on load even with trust_remote_code=False (the default). A second variant abuses a roughly 0.3-second race window between the hf_hub_download and snapshot_download calls to swap in a malicious config before the full download completes.

Who's affected, and how do you fix it?

Any project, CI/CD pipeline, or container image that loads Diffusers models from repos you don't fully control is at risk — a single poisoned model load can hand an attacker a foothold deep inside your network, not just compromise one app. The fix: Diffusers patched all three issues in version 0.38.0, released May 2026. Practical steps:

  • Upgrade to Diffusers 0.38.0 or later immediately
  • Never set trust_remote_code=True for repos from sources you don't fully trust
  • Pin dependency versions in CI/CD and container builds to avoid pulling unverified models automatically
  • Audit existing projects for any third-party Diffusers pipelines and update them

Kit's take

FaceHugger is another reminder that the AI supply chain attack surface isn't just model weights — the act of loading a model can itself be the backdoor. Hugging Face's ecosystem is massive, so one broken safety switch becomes a shared risk for every downstream developer. If you're still on an old Diffusers version, don't wait — upgrade first, ask questions later. 好不好用,試了才知道 (You won't know if it's good until you try it).

Sources / 資料來源

常見問題 FAQ

FaceHugger 漏洞會影響哪些人?

任何在專案、CI/CD 或容器映像中使用 Hugging Face Diffusers 載入外部模型儲存庫的開發者都在風險範圍內,尤其是載入不熟悉來源的模型時。

要怎麼確認自己有沒有中招?

檢查專案使用的 Diffusers 版本,若低於 0.38.0 就有暴露風險;盤點是否曾用 trust_remote_code=True 載入第三方 pipeline。

升級到 0.38.0 就完全安全了嗎?

官方已在 0.38.0 修補三個 CVE 對應的漏洞路徑,升級是目前最直接有效的防護方式,同時建議搭配鎖定版本與來源審查等供應鏈防護措施。

trust_remote_code=False 不是預設就安全嗎?

理論上是,但 FaceHugger 正是證明即使設為 False(或不設定),攻擊者仍能透過 None.py 檔名漏洞或競態條件繞過此安全機制。

延伸閱讀 / Related Articles


AI 工具觀察站 — 每日精選 AI Agent 與工具趨勢
AI Tool Observer — Daily curated AI Agent & tool trends

留言

這個網誌中的熱門文章

Cursor vs GitHub Copilot vs Claude Code:AI 程式助手大比拼 | AI Coding Assistants Compared: Cursor vs GitHub Copilot vs Claude Code

Google Ironwood TPU v7 推理專用晶片解析:效能追平 NVIDIA、成本低 44%,AI 晶片戰爭正式開打 | Google Ironwood TPU v7 Explained: Matching NVIDIA Performance at 44% Lower Cost — The AI Chip War Heats Up

Claude Code 實測:AI 幫你寫程式到底行不行? | Claude Code Review: Can AI Really Code for You?