/

CVE-2026-24123

Severity:

HIGH RISK

(7.4)

Path Traversal in BentoML

CVE-2026-24123

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Sensitive Data Exposure and Supply-Chain Compromise

Severity:

HIGH RISK

(7.4)

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

A path traversal issue in BentoML's bentofile.yaml configuration allows attacker-controlled file path fields to reference arbitrary locations on the builder's filesystem.

If a victim builds a malicious BentoML project, sensitive files can be silently bundled into the resulting bento artifact, potentially exposing secrets via registries or downstream deployments.

Affected context

This vulnerability impacts workflows where:

  • Developers or CI systems consume untrusted or shared BentoML projects.
  • The bentofile.yaml file is accepted without strict validation or sanitization.
  • Build processes run with access to sensitive files (e.g., SSH keys, cloud credentials, environment configuration).
  • Generated bento artifacts are later stored in registries, shared with other teams, or deployed to production.

The issue is triggered when the BentoML tooling processes certain file path fields in bentofile.yaml and includes referenced files into the bento archive without enforcing safe path constraints.

Exploit preconditions

  • Attack surface: The build pipeline that consumes and builds BentoML projects using bentofile.yaml.
  • Required access: Ability to provide or modify a bentofile.yaml consumed by a victim (e.g., via a repository contribution, shared template, or downloaded example).
  • Trigger point: Execution of bentoml build or equivalent build command that processes:
  • description
  • docker.setup_script
  • docker.dockerfile_template
  • conda.environment_yml
  • Why exploitation is possible: The build logic treats these path fields as trusted and follows paths that can traverse directories (e.g., ../ segments), allowing access to files outside the intended project root, which are then embedded into the bento archive.

Why this happens

The underlying bug aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

In abstract terms, the build system:

  • Accepts user-controlled file path values from a configuration file (bentofile.yaml).
  • Resolves and reads those paths on the host filesystem without enforcing a confined root, canonicalization checks, or normalization safeguards.
  • Uses the referenced files as build inputs or metadata and packages them into the final artifact.

This pattern allows configuration authors to escape the intended project directory and reference arbitrary files, which is a classic path traversal scenario arising from missing or incomplete validation on filesystem access patterns.

Potential impact

  • Exfiltration of sensitive files (SSH private keys, API keys, cloud credentials, .env files, configuration secrets).
  • Leakage of proprietary source code or internal documentation into publicly shared bento images.
  • Silent inclusion of environment-specific details that aid lateral movement or targeted attacks.
  • Supply-chain compromise, where downstream consumers deploy bento artifacts unknowingly containing embedded secrets.
  • Regulatory or compliance exposure if confidential or regulated data is inadvertently distributed.

General mitigation guidance

Effective mitigation focuses on constraining file access and reducing implicit trust in configuration-controlled paths:

  • Restrict file resolution for configuration-driven paths to a well-defined project root or allowed subdirectories, rejecting any path that attempts to traverse upwards or use absolute locations.
  • Normalize and canonicalize paths before use, and perform checks against an allowlist of directories or file patterns.
  • Treat bentofile.yaml as untrusted input in shared or multi-tenant environments, and introduce schema validation that enforces safe path formats.
  • Run build pipelines with the principle of least privilege:
  • Limit the filesystem view (e.g., chroot, containerized builds with minimal mounts).
  • Avoid mounting sensitive directories into build containers unless strictly necessary.
  • Encourage internal policies that disallow building artifacts directly from unreviewed external templates or examples.

How teams detect issues like this

Organizations can look for this class of exposure using several approaches:

  • Static analysis / configuration linting:
  • Rules that flag relative paths with ../ segments or absolute paths in bentofile.yaml.
  • Policy checks that enforce all referenced files to reside under a project-specific directory.
  • Code review signals:
  • Configuration that references system paths (e.g., /home/, /root/, /etc/, .ssh/).
  • Suspicious additions or modifications to docker.* or conda.* path fields in pull requests.
  • Build-time enforcement:
  • Instrument build tooling to log and audit every external file included in bento artifacts.
  • Fail builds when unexpected directories or sensitive path patterns are referenced.
  • Artifact inspection:
  • Post-build scanning of bento archives for known sensitive file names or patterns.
  • Integration of secret-scanning tools in CI pipelines for artifacts, not just source code.

Sources

SourceLink
github.comgithub.com/bentoml/BentoML/commit/84d08cfeb40c5f2ce71b3d3444bbaa0fb16b5ca4
github.comgithub.com/bentoml/BentoML/releases/tag/v1.4.34
github.comgithub.com/bentoml/BentoML/security/advisories/GHSA-6r62-w2q3-48hf

Frequently asked

questions

It is not a traditional remote network exploit, but it is exploitable whenever a victim or CI pipeline builds a BentoML project provided by an attacker. The attack is delivered through a crafted bentofile.yaml rather than a direct network request.

The attacker needs the ability to supply or modify the bentofile.yaml that a victim uses, such as committing to a shared repository, providing an example project, or influencing build configuration in a CI/CD pipeline.

The safest pattern is to constrain all configuration-controlled paths to a restricted directory tree, perform canonicalization checks, and reject any path that escapes the intended project root or uses absolute filesystem paths.

Treat configuration files as untrusted input, apply strict schema and path validation, containerize builds with limited filesystem access, and enforce automated checks (linting, policy rules, and artifact scanning) in CI to detect unsafe path usage and inadvertent secret inclusion.

Find out what's already
exploitable in your codebase.