Skip to main content

Python CVE-2026-34172

HIGH
Improper Neutralization of Special Elements Used in a Template Engine (CWE-1336)
2026-03-27 https://github.com/Giskard-AI/giskard-oss GHSA-frv4-x25r-588m
7.7
CVSS 4.0 · Vendor: https://github.com/Giskard-AI/giskard-oss
Share

Severity by source

Vendor (https://github.com/Giskard-AI/giskard-oss) PRIMARY
7.7 HIGH
CVSS:4.0/AV:N/AC:L/AT:P/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

Primary rating from Vendor (https://github.com/Giskard-AI/giskard-oss) · only source for this CVE.

CVSS VectorVendor: https://github.com/Giskard-AI/giskard-oss

CVSS:4.0/AV:N/AC:L/AT:P/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
Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
X

Lifecycle Timeline

3
Patch released
Mar 31, 2026 - 21:13 nvd
Patch available
Analysis Generated
Mar 27, 2026 - 22:46 vuln.today
CVE Published
Mar 27, 2026 - 22:17 nvd
HIGH 7.7

DescriptionCVE.org

Summary

ChatWorkflow.chat(message) passes its string argument directly as a Jinja2 template source to a non-sandboxed Environment. A developer who passes user input to this method enables full remote code execution via Jinja2 class traversal.

The method name chat and parameter name message naturally invite passing user input directly, but the string is silently parsed as a Jinja2 template, not treated as plain text.

Root Cause

libs/giskard-agents/src/giskard/agents/workflow.py line ~261:

python
def chat(self, message: str | Message | MessageTemplate, role: Role = "user") -> Self:
    if isinstance(message, str):
        message = MessageTemplate(role=role, content_template=message)

The string becomes content_template, which is parsed by from_string():

libs/giskard-agents/src/giskard/agents/templates/message.py lines 14-15:

python
def render(self, **kwargs: Any) -> Message:
    template = _inline_env.from_string(self.content_template)
    rendered_content = template.render(**kwargs)

The Jinja2 Environment is not sandboxed:

libs/giskard-agents/src/giskard/agents/templates/environment.py line 37:

python
_inline_env = Environment(
    autoescape=False,
# Not SandboxedEnvironment
)

Proof of Concept

python
from jinja2 import Environment
env = Environment()
# Same as giskard's _inline_env
# Class traversal reaches os.popen
t = env.from_string("{{ ''.__class__.__mro__[1].__subclasses__() | length }}")
print(t.render())
# 342 accessible subclasses
# Full RCE payload (subclass index varies by Python version)
# {{ ''.__class__.__mro__[1].__subclasses__()[INDEX].__init__.__globals__['os'].popen('id').read() }}

A developer building a chatbot:

python
workflow = ChatWorkflow(generator=my_llm)
workflow = workflow.chat(user_input)
# user_input parsed as Jinja2 template
result = await workflow.run()
# RCE if user_input contains {{ payload }}

Note: using .with_inputs(var=user_data) is safe because variable values are not parsed as templates. The issue is only when user strings are passed directly to chat().

Impact

Remote code execution on the server hosting any application built with giskard-agents that passes user input to ChatWorkflow.chat(). Attacker can execute system commands, read files, access environment variables.

Affects giskard-agents <=0.3.3 and 1.0.x alpha. Patched in giskard-agents 0.3.4 (stable) and 1.0.2b1 (pre-release).

Mitigation

Update to 0.3.4 (or 1.0.2b1 for the pre-release branch) which includes the fix.

The fix replaces the unsandboxed Jinja2 Environment with SandboxedEnvironment, which blocks attribute access to dunder methods and prevents class traversal chains. SandboxedEnvironment blocks access to attributes starting with _, preventing the __class__.__mro__ traversal chain.

AnalysisAI

Remote code execution in giskard-agents Python library (versions ≤0.3.3 and 1.0.x alpha) allows attackers to execute arbitrary system commands when user-controlled strings are passed to the ChatWorkflow.chat() method. The vulnerability stems from unsandboxed Jinja2 template rendering that enables class traversal exploitation via Python's object introspection. Patched in versions 0.3.4 (stable) and 1.0.2b1 (pre-release). Public exploit code exists demonstrating full RCE via Jinja2 object traversal to os.popen(). No active exploitation confirmed at time of analysis, though the straightforward attack vector and clear POC make this a critical priority for affected deployments.

Technical ContextAI

The vulnerability resides in the giskard-agents library's ChatWorkflow implementation, specifically in the message handling pipeline. When a developer calls ChatWorkflow.chat() with a string argument, the code automatically wraps it in a MessageTemplate object where the string becomes the content_template attribute. During rendering, this template is parsed using Jinja2's Environment.from_string() method without sandboxing protections. The affected component uses a standard Jinja2 Environment with autoescape=False instead of SandboxedEnvironment. This maps to CWE-1336 (Improper Neutralization of Special Elements Used in a Template Engine), a server-side template injection vulnerability class. In Python's Jinja2, unsandboxed templates allow access to the object model through dunder methods like __class__ and __mro__, enabling traversal to dangerous built-in classes. Attackers can reach subprocess management classes through the method resolution order chain, ultimately accessing os.popen() or similar execution primitives. The package identifier pkg:pip/giskard-agents confirms this affects the Python PyPI distribution of the giskard-agents library, a component designed for building AI agent workflows with large language models.

RemediationAI

Organizations using giskard-agents must immediately upgrade to version 0.3.4 for stable deployments or version 1.0.2b1 for pre-release branch users. The vendor-released patches replace the unsandboxed Jinja2 Environment with SandboxedEnvironment, which blocks access to attributes beginning with underscores, preventing the __class__.__mro__ traversal chain required for exploitation. Install the patched version using pip: 'pip install --upgrade giskard-agents0.3.4' for stable or 'pip install --upgrade giskard-agents1.0.2b1' for beta users. As an interim workaround for environments where immediate patching is not feasible, audit all code calling ChatWorkflow.chat() to ensure no user-controlled data is passed directly as the message parameter. Instead, use the with_inputs() method to pass user data as template variables, which are safely rendered without template parsing. Complete remediation guidance and patch details are available in the GitHub Security Advisory at https://github.com/Giskard-AI/giskard-oss/security/advisories/GHSA-frv4-x25r-588m and the general advisory database at https://github.com/advisories/GHSA-frv4-x25r-588m.

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2026-55255 HIGH POC
8.4 Jun 19

Cross-user flow execution in Langflow (< 1.9.1) lets any authenticated API-key holder run another user's flow by passing

Share

CVE-2026-34172 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy