huggingfaceのDiffusersにおけるコードインジェクションの脆弱性
| Title |
huggingfaceのDiffusersにおけるコードインジェクションの脆弱性
|
| Summary |
Diffusersは事前学習済み拡散モデルのライブラリです。バージョン0.38.0以前、特にdiffusers 0.37.0では、trust_remote_code=Trueの保護機能を使用せずにHugging Face Hubリポジトリからパイプラインをロードする際にリモートコード実行が可能でした。pipeline_loading_utils.py内の_resolve_custom_pipeline_and_cls関数は、custom_pipelineパラメータに対してf"{custom_pipeline}.py"という文字列補間を行います。custom_pipelineがユーザーから提供されない場合、デフォルトはNoneであり、Pythonはこれを「None.py」という文字列として補間します。攻撃者がDiffusionPipelineをサブクラス化したクラスを含むNone.pyファイルを含むHubリポジトリを公開すると、そのファイルは標準的なDiffusionPipeline.from_pretrained()呼び出し時に追加のキーワード引数なしで自動的にダウンロードされ、実行されます。DiffusionPipeline.download()内のtrust_remote_codeチェックは、custom_pipelineが渡されなかったためにcustom_pipeline is not Noneの評価をFalseとしてバイパスされますが、実際にモジュールをロードする下流のコードはNone値を有効なファイル名に解決します。攻撃者はNone.pyファイルを含む悪意のあるモデルリポジトリと正規のパイプラインクラス名を参照する標準的なmodel_index.jsonを公開し、被害者がリポジトリに対してfrom_pretrainedを呼び出すだけで沈黙のうちに任意コードが実行されてしまいます。この脆弱性はバージョン0.38.0で修正されました。
|
| Possible impacts |
当該ソフトウェアが扱う全ての情報が外部に漏れる可能性があります。 また、当該ソフトウェアが扱う全ての情報が書き換えられる可能性があります。 さらに、当該ソフトウェアが完全に停止する可能性があります。 そして、この脆弱性を悪用した攻撃の影響は、他のソフトウェアには及びません。 |
| Solution |
正式な対策が公開されています。ベンダ情報を参照して適切な対策を実施してください。 |
| Publication Date |
May 14, 2026, midnight |
| Registration Date |
May 20, 2026, 1:22 p.m. |
| Last Update |
May 20, 2026, 1:22 p.m. |
|
CVSS3.0 : 重要
|
| Score |
8.8
|
| Vector |
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
Affected System
| huggingface |
|
Diffusers 0.38.0 未満
|
CVE (情報セキュリティ 共通脆弱性識別子)
CWE (共通脆弱性タイプ一覧)
ベンダー情報
Change Log
| No |
Changed Details |
Date of change |
| 1 |
[2026年05月20日] 掲載 |
May 20, 2026, 1:22 p.m. |
NVD Vulnerability Information
CVE-2026-44827
| Summary |
Diffusers is the a library for pretrained diffusion models. Prior to 0.38.0, diffusers 0.37.0 allows remote code execution without the trust_remote_code=True safeguard when loading pipelines from Hugging Face Hub repositories. The _resolve_custom_pipeline_and_cls function in pipeline_loading_utils.py performs string interpolation on the custom_pipeline parameter using f"{custom_pipeline}.py". When custom_pipeline is not supplied by the user, it defaults to None, which Python interpolates as the literal string "None.py". If an attacker publishes a Hub repository containing a file named None.py with a class that subclasses DiffusionPipeline, the file is automatically downloaded and executed during a standard DiffusionPipeline.from_pretrained() call with no additional keyword arguments. The trust_remote_code check in DiffusionPipeline.download() is bypassed because it evaluates custom_pipeline is not None as False (since the kwarg was never supplied), while the downstream code path that actually loads the module resolves the None value into a valid filename. An attacker can achieve silent arbitrary code execution by publishing a malicious model repository with a None.py file and a standard-looking model_index.json that references a legitimate pipeline class name, requiring only that a victim calls from_pretrained on the repository. This vulnerability is fixed in 0.38.0.
|
| Publication Date |
May 15, 2026, 2:16 a.m. |
| Registration Date |
May 15, 2026, 4:25 a.m. |
| Last Update |
May 19, 2026, 12:20 p.m. |
Affected software configurations
| Configuration1 |
or higher |
or less |
more than |
less than |
| cpe:2.3:a:huggingface:diffusers:*:*:*:*:*:python:*:* |
|
|
|
0.38.0 |
Related information, measures and tools
Common Vulnerabilities List