# CVE-2026-91925: Polyaxon through 2.16.4 Server-Side Template Injection via Unsandboxed Jinja2 Engine

The Markdown version of <https://upatch.dev/cve/CVE-2026-91925>. Last updated 25 Nov 2026.

## At a glance

CVE-2026-91925 is rated High 8.7 (CVSS 4.0, CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X). It affects Polyaxon (polyaxon) and was published on 15 Sept 2026. It is not in CISA's Known Exploited Vulnerabilities catalog. Its EPSS score is 0.8%: the estimated chance it is exploited in the next 30 days, as of 24 Nov 2026. The upatch `cve-2026-91925-exec-block` mitigates it, and is vetted (merged into the registry).

A upatch is a signed BPF program that shirudo loads into a running Linux kernel to block the code path this CVE's exploit takes. It holds the line until the fix ships; it does not replace patching.

## The vulnerability

CVE-2026-91925 is a server-side template injection vulnerability in Polyaxon through 2.16.4, published on 15 September 2026. During server-side run preparation (`SchedulingManager.runs_prepare` in `haupt/orchestration/scheduler/manager.py`), Polyaxon resolves operation specifications by calling `PolyaxonfileParser.parse_operation()` and `render_template()` in `cli/polyaxon/_polyaxonfile/specs/libs/engine.py`. Because `get_engine()` constructs an unsandboxed `jinja2.Environment()`, an authenticated user who submits a run with a Jinja2 expression in `queue`, `namespace`, `conditions`, `presets`, or `dependencies` can traverse Python object attributes (`namespace.__init__.__globals__['__builtins__']`) and execute operating system commands in the context of the `haupt` server or scheduler process.

### Official description

Polyaxon through 2.16.4 renders operation specification fields with an unsandboxed Jinja2 environment during server-side run preparation, allowing authenticated users to execute arbitrary code. Attackers can submit runs with Jinja2 payloads in queue, namespace, conditions, presets, or dependencies fields to execute operating system commands in the scheduler process context, exposing database credentials and service tokens.

## What the upatch does

The `lsm/bprm_check_security` program `cve_2026_91925_exec_block` returns `-EPERM` whenever a process whose command name (`comm`) is `haupt`, or whose parent or grandparent has command name `haupt`, attempts to execute a binary:

| Hook                      | Refused                                                      |
| ------------------------- | ------------------------------------------------------------ |
| `lsm/bprm_check_security` | Any `execve` by `haupt` or a child worker spawned by `haupt` |

Because `bprm_check_security` runs before `begin_new_exec` updates `current->comm`, starting `haupt` itself from a shell is unaffected. Once `haupt` is running, both single-process mode and multi-worker mode handle run preparation in Python without executing external binaries, whereas an injected OS command (`os.popen` or `subprocess`) forks a child and calls `execve`, which the hook refuses with `-EPERM`. The `refused` per-CPU array counts refused executions at key 0.

The policy: [`cve-2026-91925-exec-block.bpf.c`](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-91925), 73 lines of BPF C attached at `lsm/bprm_check_security`, licensed GPL-2.0 OR BSD-2-Clause.

## Side effects

- Any attempt by a running `haupt` process or its worker children to spawn an external operating system binary fails with `EPERM`.
- Starting a `haupt` server with multiple `uvicorn` worker processes while the upatch is already loaded will fail if `haupt` spawns new worker processes via `execve`; single-worker `haupt` or workers started before loading continue to serve requests normally.
- In-process Python evaluation inside the unsandboxed Jinja2 environment that does not call `execve` is not stopped by a kernel hook; upgrading to Polyaxon 2.19 or later is required to sandbox template rendering in Python.

## Preemption model and cost

The program holds no shared mutable state beyond the per-CPU refusal counter, which it increments with `__sync_fetch_and_add`, making it safe under all preemption models including `PREEMPT_LAZY`, `PREEMPT_DYNAMIC`, and `PREEMPT_RT`. It runs only on `execve` (`bprm_check_security`), where it reads `current->comm` and two parent `task_struct` pointers via CO-RE.

## Affected versions

Affected software: Polyaxon (`polyaxon` and `haupt`) through 2.16.4; fixed in Polyaxon 2.19 by switching `get_engine()` to `jinja2.sandbox.SandboxedEnvironment()` in commit `5e61f8caa59ee4ea3a017c3a8532c22080fd4193`.

Kernels: any Linux kernel with BPF LSM enabled (`lsm/bprm_check_security`) and BTF support.

## How it was tested

On Polyaxon 2.16.4 (haupt 2.16.4), the loaded upatch refused OS command execution triggered via Jinja2 template rendering in the operation queue field while allowing normal API requests; in-process Python evaluation that does not invoke execve requires upgrading Polyaxon.

- **Tested:** 25 Nov 2026
- **Target:** Polyaxon haupt 2.16.4 and polyaxon 2.16.4 on Python 3.12, sandbox mode on 127.0.0.1:18000
- **Kernel:** 7.4-shirudo-ci-20261123
- **Architecture:** x86_64
- **Distribution:** Ubuntu 26.04

### Results

| State           | Template command execution (/bin/echo) blocked | Run submission API works |
| --------------- | ---------------------------------------------- | ------------------------ |
| Before loading  | no (reached)                                   | yes                      |
| Upatch loaded   | yes (EPERM)                                    | yes                      |
| After unloading | no (reached)                                   | yes                      |

## How to apply

Build the upatch from source, sign it with your own shirudo key, and publish it to your own OCI registry. Machines that follow your upatch tree load it within about a minute.

Build and sign:

```sh
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-91925
```

Publish and roll out:

```sh
shirudo bpm push build/packages/cve-2026-91925-1.0.0.bee oci://<registry>/<namespace>/cve-2026-91925 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-91925-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>
```

## Review

- Contributors: romanlab.
- Reviewers: none recorded yet.

## Sources and links

- [VulnCheck advisory for CVE-2026-91925](https://www.vulncheck.com/advisories/polyaxon-through-2.16.4-server-side-template-injection-via-unsandboxed-jinja2-engine)
- [GitHub issue polyaxon/polyaxon#1540](https://github.com/polyaxon/polyaxon/issues/1540)
- [Vulnerable engine.py in polyaxon/cli](https://github.com/polyaxon/cli/blob/bfea04a0bf93886f69a3195954204d9d010b55aa/cli/polyaxon/_polyaxonfile/specs/libs/engine.py)
- [Vulnerable sections.py in polyaxon/cli](https://github.com/polyaxon/cli/blob/bfea04a0bf93886f69a3195954204d9d010b55aa/cli/polyaxon/_polyaxonfile/specs/sections.py)
- [Fix commit 5e61f8caa59e in polyaxon/cli](https://github.com/polyaxon/cli/commit/5e61f8caa59ee4ea3a017c3a8532c22080fd4193)

### Links

- [CVE-2026-91925 on upatch.dev](https://upatch.dev/cve/CVE-2026-91925) (this page, as HTML)
- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2026-91925)
- [CVE.org](https://www.cve.org/CVERecord?id=CVE-2026-91925)
- [CWE-1336](https://cwe.mitre.org/data/definitions/1336.html)
- Upatch source: [upatches/cve-2026-91925](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-91925)

### More references from NVD (5)

- [github.com](https://github.com/polyaxon/cli/blob/bfea04a0bf93886f69a3195954204d9d010b55aa/cli/polyaxon/_polyaxonfile/specs/libs/engine.py)
- [github.com](https://github.com/polyaxon/cli/blob/bfea04a0bf93886f69a3195954204d9d010b55aa/cli/polyaxon/_polyaxonfile/specs/sections.py)
- [github.com](https://github.com/polyaxon/polyaxon)
- [github.com](https://github.com/polyaxon/polyaxon/issues/1540)
- [vulncheck.com](https://www.vulncheck.com/advisories/polyaxon-through-2.16.4-server-side-template-injection-via-unsandboxed-jinja2-engine)
