{"id":"CVE-2026-44513","aliases":["CVE-2026-44513","GHSA-98h9-4798-4q5v","PYSEC-2026-40"],"related":[],"kind":"vulnerability","state":"published","title":"Diffusers: `trust_remote_code` bypass via `custom_pipeline` and local custom components","summary":"Diffusers is the a library for  pretrained diffusion models. Prior to 0.38.0, a trust_remote_code bypass in DiffusionPipeline.from_pretrained allows arbitrary remote code execution despite the user passing trust_remote_code=False (or omitting it, which is the default). The vulnerability has three variants, all sharing the same root cause — the trust_remote_code gate was implemented inside DiffusionPipeline.download() rather than at the actual dynamic-module load site, so any code path that bypassed or short-circuited download() also bypassed the security check. DiffusionPipeline.from_pretrained('repoA', custom_pipeline='attacker/repoB', trust_remote_code=False) — the gate evaluated against repoA's file list rather than repoB's, so repoB's pipeline.py was loaded and executed. DiffusionPipeline.from_pretrained('/local/snapshot', custom_pipeline='attacker/repoB', trust_remote_code=False) — the local-path branch never invoked download(), so the gate was never reached and remote code from repoB executed. DiffusionPipeline.from_pretrained('/local/snapshot', trust_remote_code=False) where the snapshot contains custom component files (e.g. unet/my_unet_model.py) referenced from model_index.json — same root cause; the local path skipped download() and custom component code executed. This vulnerability is fixed in 0.38.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Diffusers is the a library for  pretrained diffusion models. Prior to 0.38.0, a trust_remote_code bypass in DiffusionPipeline.from_pretrained allows arbitrary remote code execution despite the user passing trust_remote_code=False (or omitting it, which is the default). The vulnerability has three variants, all sharing the same root cause — the trust_remote_code gate was implemented inside DiffusionPipeline.download() rather than at the actual dynamic-module load site, so any code path that bypassed or short-circuited download() also bypassed the security check. DiffusionPipeline.from_pretrained('repoA', custom_pipeline='attacker/repoB', trust_remote_code=False) — the gate evaluated against repoA's file list rather than repoB's, so repoB's pipeline.py was loaded and executed. DiffusionPipeline.from_pretrained('/local/snapshot', custom_pipeline='attacker/repoB', trust_remote_code=False) — the local-path branch never invoked download(), so the gate was never reached and remote code from repoB executed. DiffusionPipeline.from_pretrained('/local/snapshot', trust_remote_code=False) where the snapshot contains custom component files (e.g. unet/my_unet_model.py) referenced from model_index.json — same root cause; the local path skipped download() and custom component code executed. This vulnerability is fixed in 0.38.0.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nA `trust_remote_code` bypass in `DiffusionPipeline.from_pretrained` allows arbitrary remote code execution despite the user passing `trust_remote_code=False` (or omitting it, which is the default). The vulnerability has three variants, all sharing the same root cause — the `trust_remote_code` gate was implemented inside `DiffusionPipeline.download()` rather than at the actual dynamic-module load site, so any code path that bypassed or short-circuited `download()` also bypassed the security check:\n\n1. **Cross-repo `custom_pipeline`.** `DiffusionPipeline.from_pretrained('repoA', custom_pipeline='attacker/repoB', trust_remote_code=False)` — the gate evaluated against `repoA`'s file list rather than `repoB`'s, so `repoB`'s `pipeline.py` was loaded and executed.\n2. **Local snapshot + Hub `custom_pipeline`.** `DiffusionPipeline.from_pretrained('/local/snapshot', custom_pipeline='attacker/repoB', trust_remote_code=False)` — the local-path branch never invoked `download()`, so the gate was never reached and remote code from `repoB` executed.\n3. **Local snapshot with custom components.** `DiffusionPipeline.from_pretrained('/local/snapshot', trust_remote_code=False)` where the snapshot contains custom component files (e.g. `unet/my_unet_model.py`) referenced from `model_index.json` — same root cause; the local path skipped `download()` and custom component code executed.\n\nSilent remote code execution on the victim's machine. Anyone calling `DiffusionPipeline.from_pretrained` with custom pipelines is impacted.\n\n### Patches\n\nYes. Fixed in **diffusers 0.38.0** via [PR #13448](https://github.com/huggingface/diffusers/pull/13448). All users on versions `< 0.38.0` should upgrade:\n\n```bash\npip install --upgrade \"diffusers>=0.38.0\"\n```\n\nThe fix moves the `trust_remote_code` gate out of `DiffusionPipeline.download()` and into `get_cached_module_file` in `src/diffusers/utils/dynamic_modules_utils.py`, which is the actual chokepoint for every dynamic module load (local, Hub, or community mirror). All three variants now raise `ValueError` instead of executing untrusted code.\n\n### Workarounds\n\nIf upgrading immediately is not possible:\n\n- Only call `from_pretrained` with `pretrained_model_name_or_path`, `custom_pipeline`, and local snapshot directories from fully trusted sources that have been audited.\n- Do not pass `custom_pipeline=` pointing at a Hub repository different from the primary `pretrained_model_name_or_path` before reading its `pipeline.py`.\n- Before calling `from_pretrained` on a local snapshot, inspect the snapshot for unexpected `*.py` files, especially under component subdirectories (`unet/`, `scheduler/`, etc.) and at the snapshot root.\n\nThese are mitigations, not fixes — the only complete remediation is upgrading to 0.38.0.\n\n### Resources\n\n- **Fix:** https://github.com/huggingface/diffusers/pull/13448\n- **Original issue:** https://github.com/huggingface/diffusers/issues/13446\n- **Release notes:** https://github.com/huggingface/diffusers/releases/tag/v0.38.0\n- **CWE-94:** https://cwe.mitre.org/data/definitions/94.html","format":"markdown","source":"ghsa"},{"lang":"es","text":"Diffusers es la biblioteca para modelos de difusión preentrenados. Antes de la versión 0.38.0, una omisión de ’trust_remote_code’ en DiffusionPipeline.from_pretrained permite la ejecución remota de código arbitraria a pesar de que el usuario pase ’trust_remote_code=False’ (o lo omita, que es el valor predeterminado). La vulnerabilidad tiene tres variantes, todas compartiendo la misma causa raíz - la compuerta de ’trust_remote_code’ se implementó dentro de DiffusionPipeline.download() en lugar de en el sitio real de carga del módulo dinámico, por lo que cualquier ruta de código que omitiera o cortocircuitara download() también omitía la verificación de seguridad. DiffusionPipeline.from_pretrained(’repoA’, custom_pipeline=’atacante/repoB’, trust_remote_code=False) - la compuerta evaluó la lista de archivos de repoA en lugar de la de repoB, por lo que el pipeline.py de repoB fue cargado y ejecutado. DiffusionPipeline.from_pretrained(’/local/snapshot’, custom_pipeline=’atacante/repoB’, trust_remote_code=False) - la rama de ruta local nunca invocó download(), por lo que la compuerta nunca fue alcanzada y el código remoto de repoB se ejecutó. DiffusionPipeline.from_pretrained(’/local/snapshot’, trust_remote_code=False) donde la instantánea contiene archivos de componentes personalizados (p. ej., unet/my_unet_model.py) referenciados desde model_index.json - misma causa raíz; la ruta local omitió download() y el código del componente personalizado se ejecutó. Esta vulnerabilidad está corregida en la versión 0.38.0.","source":"nvd"}],"published":"2026-05-07T05:31:17.000Z","modified":"2026-10-26T14:10:00.130Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"},{"scorer":"redhat-SADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"}],"cwes":["CWE-94","CWE-358"],"affected":[{"ranges":[{"version":"< 0.38.0","status":"affected"}],"vendor":"huggingface","product":"diffusers","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"1787077779","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"Red Hat OpenShift AI 3.4","package":"rhoai/odh-th06-cuda130-torch210-py312-rhel9","cpe":"cpe:/a:redhat:openshift_ai:3.4::el9","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"1787076481","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"Red Hat OpenShift AI 3.4","package":"rhoai/odh-th06-rocm64-torch291-py312-rhel9","cpe":"cpe:/a:redhat:openshift_ai:3.4::el9","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"1786611803","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"Red Hat OpenShift AI 3.4","package":"rhoai/odh-training-cuda128-torch29-py312-rhel9","cpe":"cpe:/a:redhat:openshift_ai:3.4::el9","source":"cvelist"},{"ranges":[{"type":"rpm","introduced":"1786611435","fixed":"*","status":"unaffected"}],"vendor":"Red Hat","product":"Red Hat OpenShift AI 3.4","package":"rhoai/odh-training-rocm64-torch29-py312-rhel9","cpe":"cpe:/a:redhat:openshift_ai:3.4::el9","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat AI Inference Server","package":"rhaiis/vllm-cpu-rhel9","cpe":"cpe:/a:redhat:ai_inference_server:3","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat AI Inference Server","package":"rhaiis/vllm-cuda-rhel9","cpe":"cpe:/a:redhat:ai_inference_server:3","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat AI Inference Server","package":"rhaiis/vllm-rocm-rhel9","cpe":"cpe:/a:redhat:ai_inference_server:3","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat AI Inference Server","package":"rhaiis/vllm-tpu-rhel9","cpe":"cpe:/a:redhat:ai_inference_server:3","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat AI Inference Server","package":"rhaii/vllm-cpu-rhel9","cpe":"cpe:/a:redhat:ai_inference_server:3","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat AI Inference Server","package":"rhaii/vllm-cuda-rhel9","cpe":"cpe:/a:redhat:ai_inference_server:3","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux AI (RHEL AI) 3","package":"rhelai3/bootc-aws-cuda-rhel9","cpe":"cpe:/a:redhat:enterprise_linux_ai:3","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux AI (RHEL AI) 3","package":"rhelai3/bootc-azure-cuda-rhel9","cpe":"cpe:/a:redhat:enterprise_linux_ai:3","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux AI (RHEL AI) 3","package":"rhelai3/bootc-cuda-rhel9","cpe":"cpe:/a:redhat:enterprise_linux_ai:3","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Enterprise Linux AI (RHEL AI) 3","package":"rhelai3/bootc-gcp-cuda-rhel9","cpe":"cpe:/a:redhat:enterprise_linux_ai:3","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat OpenShift AI (RHOAI)","package":"rhoai/odh-openvino-model-server-rhel9","cpe":"cpe:/a:redhat:openshift_ai","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat OpenShift AI (RHOAI)","package":"rhoai/odh-th06-cuda130-torch291-py312-rhel9","cpe":"cpe:/a:redhat:openshift_ai","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.38.0"}],"ecosystem":"PyPI","package":"diffusers","purl":"pkg:pypi/diffusers","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.38.0"}],"vendor":"huggingface","product":"diffusers","cpe":"cpe:2.3:a:huggingface:diffusers:*:*:*:*:*:python:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.38.0"}],"ecosystem":"PyPI","package":"diffusers","purl":"pkg:pypi/diffusers","source":"pysec"}],"references":[{"url":"https://github.com/huggingface/diffusers/security/advisories/GHSA-98h9-4798-4q5v","tags":["evidence","exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://access.redhat.com/security/cve/CVE-2026-44513","tags":["vdb-entry","x-refsource-redhat"],"sources":["cvelist","nvd"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2477507","tags":["issue-tracking","x-refsource-redhat"],"sources":["cvelist","nvd"]},{"url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-44513.json","tags":["x-sadp-csaf-vex"],"sources":["cvelist","nvd"]},{"url":"https://access.redhat.com/errata/RHSA-2026:60520","tags":["vendor-advisory","x-refsource-redhat"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-44513","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/huggingface/diffusers/issues/13446","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/huggingface/diffusers/pull/13448","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/huggingface/diffusers/commit/a37f6f8394ac2a7ee8360c3abea811efe54512b1","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/huggingface/diffusers","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/huggingface/diffusers/releases/tag/v0.38.0","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/diffusers/PYSEC-2026-40.yaml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-05-14T17:38:51.150Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-44513","url":"https://www.cve.org/CVERecord?id=CVE-2026-44513","licence":"CVE Terms of Use","modified":"2026-08-28T12:04:31.466Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-98h9-4798-4q5v","url":"https://github.com/advisories/GHSA-98h9-4798-4q5v","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:05.118Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-44513","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-44513","licence":"Public domain","modified":"2026-10-26T14:10:00.130Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-40","url":"https://osv.dev/vulnerability/PYSEC-2026-40","licence":"CC-BY-4.0","modified":"2026-05-20T09:18:56.669Z"}],"updatedAt":"2026-11-25T22:59:21.730Z","epss":{"score":0.01071,"percentile":0.6583,"date":"2026-12-01T12:00:22.000Z"}}