# CVE-2026-40320: Giskard has an Unsandboxed Jinja2 Template Rendering in ConformityCheck

> Attackers with write access to check definitions can achieve arbitrary code execution via unsandboxed Jinja2 template rendering in Giskard.

- **Severity:** Medium 5.4 (`CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 17 Apr 2026
- **Updated:** 20 Apr 2026
- **Also known as:** GHSA-7xjm-g8f4-rp26, PYSEC-2026-2488

## What is CVE-2026-40320?

CVE-2026-40320 is a medium-severity code injection vulnerability in Giskard-AI giskard-oss, published on 17 Apr 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

Giskard is an open-source testing framework for AI models. In versions prior to 1.0.2b1, the ConformityCheck class rendered the rule parameter through Jinja2's default Template() constructor, silently interpreting template expressions at runtime. If check definitions are loaded from an untrusted source, a crafted rule string could achieve arbitrary code execution. Exploitation requires write access to a check definition and subsequent execution of the test suite. This issue has been fixed in giskard-checks version 1.0.2b1.

Weakness: CWE-1336 (Improper Neutralization of Special Elements Used in a Template Engine)

## Which versions are affected by CVE-2026-40320?

3 open source packages ship an affected version, including giskard-checks. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `giskard-checks` | PyPI | All versions | 1.0.2b1 |
| `giskard-checks` | PyPI | All versions | 1.0.2b1 |
| `giskard-checks` | PyPI | All versions | 1.0.2b1 |

Products: Giskard Giskard.

## How do I fix CVE-2026-40320?

Upgrade giskard-checks to 1.0.2b1 or later.

## Is CVE-2026-40320 being exploited?

There is no known exploitation of CVE-2026-40320 in the wild and no public exploit code.

## Other vulnerabilities in Giskard-AI giskard-oss

- [CVE-2026-40319](https://insights.sbomify.com/CVE-2026-40319/): Giskard has a Regular Expression Denial of Service (ReDoS) in RegexMatching Check (low 1.0)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-40320 and fix it if it is affected.

What it is: CVE-2026-40320 is a medium-severity code injection vulnerability in Giskard-AI giskard-oss, published on 17 Apr 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-40320 in the wild and no public exploit code.

Affected packages and fixed versions:
- giskard-checks (PyPI): affected all versions; fixed in 1.0.2b1
- giskard-checks (PyPI): affected all versions; fixed in 1.0.2b1
- giskard-checks (PyPI): affected all versions; fixed in 1.0.2b1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-40320/ (Markdown: https://insights.sbomify.com/CVE-2026-40320/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-40320
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-40320
- OSV: https://osv.dev/vulnerability/CVE-2026-40320

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-40320/
Summaries are generated and may contain mistakes; the official description above is the record.
