/

CVE-2026-112264

Severity:

HIGH RISK

(7.8)

Command Injection (CWE-78) in BentoML Docker Builds

CVE-2026-112264

Awaiting Analysis

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Arbitrary command execution during Docker image builds

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

BentoML contains a Dockerfile instruction injection vulnerability in its legacy container build template. If an attacker can supply a crafted Bento configuration or imported Bento archive, newline characters in mapping keys may cause unintended Docker build instructions to be generated and executed.

BentoML contains a Dockerfile instruction injection vulnerability in its legacy container build template. If an attacker can supply a crafted Bento configuration or imported Bento archive, newline characters in mapping keys may cause unintended Docker build instructions to be generated and executed.

Affected context

The issue occurs in BentoML containerization workflows that use the legacy base.j2 template to render Dockerfiles. Risk is higher when untrusted or insufficiently validated bentofile.yaml files or imported Bento archives can influence docker.env mapping keys during image generation.

The issue occurs in BentoML containerization workflows that use the legacy base.j2 template to render Dockerfiles. Risk is higher when untrusted or insufficiently validated bentofile.yaml files or imported Bento archives can influence docker.env mapping keys during image generation.

Exploit preconditions

  • Attack surface: BentoML containerization and Dockerfile generation
  • Required access: Ability to provide or cause processing of a crafted Bento configuration or archive
  • Trigger point: Rendering the legacy Docker build template followed by the Docker image build
  • Why exploitation is possible: Newline-containing mapping keys can cross the intended data boundary and introduce additional Dockerfile instructions
  • Attack surface: BentoML containerization and Dockerfile generation
  • Required access: Ability to provide or cause processing of a crafted Bento configuration or archive
  • Trigger point: Rendering the legacy Docker build template followed by the Docker image build
  • Why exploitation is possible: Newline-containing mapping keys can cross the intended data boundary and introduce additional Dockerfile instructions

Why this happens

The vulnerability results from treating configuration-derived mapping keys as safe Dockerfile text without sufficient encoding or structural validation. When newline characters are rendered into a Dockerfile template, attacker-controlled data can alter the generated build instructions, mapping to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

The vulnerability results from treating configuration-derived mapping keys as safe Dockerfile text without sufficient encoding or structural validation. When newline characters are rendered into a Dockerfile template, attacker-controlled data can alter the generated build instructions, mapping to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

Potential impact

  • Arbitrary commands may execute in the Docker build environment
  • Build-time secrets could be exposed or misused
  • Generated images could be modified or poisoned
  • Build infrastructure credentials or files could be compromised
  • Downstream deployments may inherit malicious image content
  • Arbitrary commands may execute in the Docker build environment
  • Build-time secrets could be exposed or misused
  • Generated images could be modified or poisoned
  • Build infrastructure credentials or files could be compromised
  • Downstream deployments may inherit malicious image content

General mitigation guidance

Mitigation generally focuses on preserving strict separation between configuration data and generated build instructions.

Common defensive patterns include:

  • Replacing legacy template rendering with structured Dockerfile generation or safely encoded values
  • Rejecting control characters and newline characters in keys and other template-bound fields
  • Applying allowlists and schema validation before containerization
  • Avoiding exposure of sensitive build secrets to untrusted build contexts
  • Running builds with least privilege, isolated workers, and restricted network and filesystem access
  • Treating imported Bento archives and build metadata as untrusted input by default

Mitigation generally focuses on preserving strict separation between configuration data and generated build instructions.

Common defensive patterns include:

  • Replacing legacy template rendering with structured Dockerfile generation or safely encoded values
  • Rejecting control characters and newline characters in keys and other template-bound fields
  • Applying allowlists and schema validation before containerization
  • Avoiding exposure of sensitive build secrets to untrusted build contexts
  • Running builds with least privilege, isolated workers, and restricted network and filesystem access
  • Treating imported Bento archives and build metadata as untrusted input by default

How teams detect issues like this

Detection can include static analysis for user-controlled values interpolated into Dockerfile templates, especially where keys or values are rendered without encoding. Code review should flag template expressions that can emit Dockerfile directives, missing control-character validation, and build workflows that process untrusted archives. CI policies can inspect generated Dockerfiles for unexpected instructions and restrict secret availability during builds. Automated code-review and SAST tools may help identify these patterns.

Detection can include static analysis for user-controlled values interpolated into Dockerfile templates, especially where keys or values are rendered without encoding. Code review should flag template expressions that can emit Dockerfile directives, missing control-character validation, and build workflows that process untrusted archives. CI policies can inspect generated Dockerfiles for unexpected instructions and restrict secret availability during builds. Automated code-review and SAST tools may help identify these patterns.

Sources

SourceLink
github.comgithub.com/bentoml/BentoML/blob/v1.4.39/src/bentoml/_internal/bento/build_config.py
github.comgithub.com/bentoml/BentoML/blob/v1.4.39/src/bentoml/_internal/container/__init__.py
github.comgithub.com/bentoml/BentoML/blob/v1.4.39/src/bentoml/_internal/container/frontend/dockerfile/templates/base.j2
github.comgithub.com/bentoml/BentoML/blob/v1.4.39/src/bentoml/_internal/container/generate.py
github.comgithub.com/geo-chen/oss/blob/main/BentoML.md
vulncheck.comvulncheck.com/advisories/bentoml-through-1.4.39-dockerfile-instruction-injection-via-docker-env-keys

Frequently asked

questions

It may be exploitable through a remote workflow when an attacker can submit or cause processing of a crafted Bento configuration or archive. Exploitability depends on how BentoML inputs and container builds are exposed.

The attacker generally needs the ability to supply build metadata that reaches the vulnerable Dockerfile template. Direct host access is not necessarily required if an application accepts untrusted Bento artifacts.

Use structured Dockerfile generation or strictly encoded template values, and reject control characters in fields that influence Dockerfile content.

Treat build configuration as untrusted input, validate it against a strict schema, isolate build workers, minimize secret exposure, and inspect generated build instructions in CI.

It may be exploitable through a remote workflow when an attacker can submit or cause processing of a crafted Bento configuration or archive. Exploitability depends on how BentoML inputs and container builds are exposed.

The attacker generally needs the ability to supply build metadata that reaches the vulnerable Dockerfile template. Direct host access is not necessarily required if an application accepts untrusted Bento artifacts.

Use structured Dockerfile generation or strictly encoded template values, and reject control characters in fields that influence Dockerfile content.

Treat build configuration as untrusted input, validate it against a strict schema, isolate build workers, minimize secret exposure, and inspect generated build instructions in CI.

Find out what's already
exploitable in your codebase.