| タイトル | huggingfaceのDiffusersにおけるコードインジェクションの脆弱性 |
|---|---|
| 概要 | 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で修正されました。 |
| 想定される影響 | 当該ソフトウェアが扱う全ての情報が外部に漏れる可能性があります。 また、当該ソフトウェアが扱う全ての情報が書き換えられる可能性があります。 さらに、当該ソフトウェアが完全に停止する可能性があります。 そして、この脆弱性を悪用した攻撃の影響は、他のソフトウェアには及びません。 |
| 対策 | 正式な対策が公開されています。ベンダ情報を参照して適切な対策を実施してください。 |
| 公表日 | 2026年5月14日0:00 |
| 登録日 | 2026年5月20日13:22 |
| 最終更新日 | 2026年5月20日13:22 |
| CVSS3.0 : 重要 | |
| スコア | 8.8 |
|---|---|
| ベクター | CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| huggingface |
| Diffusers 0.38.0 未満 |
| No | 変更内容 | 変更日 |
|---|---|---|
| 1 | [2026年05月20日] 掲載 |
2026年5月20日13:22 |
| 概要 | 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. |
|---|---|
| 公表日 | 2026年5月15日2:16 |
| 登録日 | 2026年5月15日4:25 |
| 最終更新日 | 2026年5月19日12:20 |
| 構成1 | 以上 | 以下 | より上 | 未満 | |
| cpe:2.3:a:huggingface:diffusers:*:*:*:*:*:python:*:* | 0.38.0 | ||||