Sanaan Fayaz Wani

comet-ml/opik

GHSA-5mc6-2qfj-59cg

Opik SDKs render Jinja2/Nunjucks prompt templates without a sandbox, allowing code execution

GHSA-5mc6-2qfj-59cg

8.8

High

CVSS 3.1 base

  1. 2026-10-25Reported privately
  2. 11 days later2026-11-05Published by the maintainer

What to do

If you run before 2.2.123, upgrade to 2.2.123 or later.
If you run before 2.2.123, upgrade to 2.2.123 or later.

Anyone who can reach it over the network, with no account, if a user takes some action, can read and change sensitive data and make it unavailable.Read from the CVSS 3.1 vector

CVSS 3.1 metrics

To exploit it

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required

What it gets

Confidentiality
High
Integrity
High
Availability
High
Scope
Unchanged

Open this vector in the FIRST calculator ↗

Weakness
CWE-94, CWE-1336 Improper Control of Generation of Code · Improper Neutralization of Special Elements Used in a Template Engine
CVE
not assigned
Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
2026-10-25Reported privately
11 days
2026-11-05Published by the maintainer

This page reproduces the published advisory for this finding. The advisory of record is linked above.

Affected versions

Package Ecosystem Vulnerable Fixed in
opik pip < 2.2.123 2.2.123
opik npm < 2.2.123 2.2.123

Summary

Before 2.2.123, the Opik Python and TypeScript SDKs rendered prompts of type jinja2 with an unsandboxed template engine (Jinja2 in Python, Nunjucks in TypeScript). A template containing crafted template expressions could execute arbitrary code in the process that formats the prompt.

Impact

An application is affected if it formats a jinja2 prompt whose template text can be written by someone the application does not fully trust. One example is a prompt fetched from a shared Opik workspace fetched from a shared Opik workspace (get_prompt() in Python, getPrompt() in TypeScript) and then rendered with format(). The code runs with the privileges of the application process, including its environment variables, credentials and network access. On self-hosted Opik deployments running without authentication, anyone who can reach the Opik API can create or edit prompts.

Prompts of the default mustache type are not affected.

Patches

Fixed in opik 2.2.123 (PyPI and npm). The Python SDK now renders Jinja2 templates in Jinja2’s SandboxedEnvironment, and the TypeScript SDK renders with a restricted Nunjucks environment. Upgrade to 2.2.123 or later.

Workarounds

If you cannot upgrade:

  • Do not format jinja2 prompts whose template text comes from sources you do not control.
  • Use mustache prompts instead.
  • Restrict who can create or edit prompts in your workspace.

Credits

Reported by sfwani.

The record

Weakness
CWE-94 Improper Control of Generation of Code
CWE-1336 Improper Neutralization of Special Elements Used in a Template Engine
Affected
opik before 2.2.123fixed in 2.2.123opik before 2.2.123fixed in 2.2.123
Disclosure
2026-10-25 Reported privately
11 days later2026-11-05 Published
Advisory
GHSA-5mc6-2qfj-59cg

About this writeup

Sanaan Fayaz Wani (GitHub sfwani) reported this vulnerability to the opik maintainers under coordinated disclosure and is credited as a reporter in GHSA-5mc6-2qfj-59cg, published 2026-11-05.

All published findings: advisory index.