Register for the AI for Security Summit: Join Figma, Perplexity & Wiz

CVE-2026-40320
Python vulnerability analysis and mitigation

Overview

CVE-2026-40320 is an unsandboxed Jinja2 template rendering vulnerability in the giskard-checks Python library, specifically within the ConformityCheck class. The rule parameter is silently passed through Jinja2's default Template() constructor, meaning any template expressions embedded in rule definitions are evaluated at runtime without sandboxing. This affects giskard-checks versions <= 1.0.1b1; the issue was fixed in version 1.0.2b1. Disclosed on April 13–14, 2026 via GitHub Security Advisory GHSA-7xjm-g8f4-rp26, it carries a CVSS v3.1 base score of 7.8 (High) and a CVSS v4.0 base score of 5.4 (Medium) (GitHub Advisory).

Technical details

The root cause is classified as CWE-1336 (Improper Neutralization of Special Elements Used in a Template Engine). In conformity.py (line 59), the affected code constructs a Jinja2 template directly from the user-supplied rule string: formatted_rule = Template(self.rule).render(trace=trace). Because Jinja2's default Template() constructor provides no sandboxing, any Jinja2 expression — including those that invoke Python builtins or OS-level commands — is evaluated at runtime. Exploitation requires an attacker to have write access to a check definition file (e.g., a shared project configuration or externally contributed file) and for a developer to subsequently execute the test suite, triggering template evaluation (GitHub Advisory).

Impact

Successful exploitation allows arbitrary code execution in the context of the developer running the test suite, with high impact to confidentiality, integrity, and availability of the local system. An attacker who can inject a malicious Jinja2 expression into a rule parameter — for example via a shared project file or contributed configuration — can read sensitive files, modify data, or execute arbitrary OS commands on the developer's machine. Because giskard-checks is a local developer library with no network-facing service, the blast radius is limited to the developer's workstation and any secrets or credentials accessible from it (GitHub Advisory).

Exploitability

No public proof-of-concept exploit code or in-the-wild exploitation has been reported for this vulnerability. The EPSS score is approximately 0.023% (0.000230), indicating a very low probability of exploitation in the near term. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. Exploitation is constrained by the requirement for write access to a check definition and developer-initiated test execution, making opportunistic or remote exploitation unlikely (GitHub Advisory).

Exploitation steps

  1. Identify a target: Locate a project that uses giskard-checks <= 1.0.1b1 and loads check definitions from a shared or externally contributed source (e.g., a shared repository, project config file, or CI pipeline configuration).
  2. Gain write access: Obtain write access to a check definition file — for example, by contributing to an open-source project, submitting a pull request, or compromising a shared configuration repository.
  3. Inject a malicious Jinja2 payload: Modify the rule parameter of a ConformityCheck definition to include a Jinja2 expression that executes arbitrary code, such as:
    rule: "{{ ''.__class__.__mro__[1].__subclasses__()[<index>](['id'], capture_output=True).stdout }}"
    or a reverse shell payload using Python's subprocess or os modules.
  4. Trigger execution: Wait for or social-engineer a developer to run the test suite (e.g., pytest or equivalent), which causes ConformityCheck to render the rule string through Jinja2's Template(), evaluating the injected expression.
  5. Achieve code execution: The injected payload executes in the context of the developer's local environment, potentially exfiltrating credentials, secrets, or establishing persistence (GitHub Advisory).

Indicators of compromise

  • File System: Unexpected modifications to check definition files (e.g., conformity.py or project YAML/JSON config files) containing Jinja2 expressions such as {{, }}, __class__, __subclasses__, subprocess, or os.system.
  • Process: Unusual child processes spawned by the Python test runner (e.g., bash, sh, curl, wget, python) during test suite execution.
  • Logs: Test runner output containing unexpected command output, error tracebacks referencing Jinja2 Template() rendering, or anomalous data in test results.
  • Network: Unexpected outbound network connections from the developer workstation initiated during test suite execution (e.g., reverse shell callbacks or data exfiltration attempts).

Mitigation and workarounds

Upgrade giskard-checks to version >= 1.0.2b1, in which Jinja2 template rendering has been removed entirely from the rule parameter evaluation in ConformityCheck. No configuration-based workaround is available for unpatched versions. As an interim measure, developers should avoid loading check definitions from untrusted or externally contributed sources until the upgrade is applied, and should audit existing check definition files for unexpected Jinja2 template expressions (GitHub Advisory).

Community reactions

The vulnerability was credited to researcher @dhabaleshwar for identifying the unsandboxed template usage and was published by mattbit on behalf of Giskard-AI. No significant broader media coverage or notable community commentary beyond the GitHub advisory has been identified (GitHub Advisory).

Additional resources


SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-66455CRITICAL9.8
  • Python logoPython
  • lmdeploy
NoYesSep 18, 2026
CVE-2026-63374CRITICAL9.3
  • Python logoPython
  • python-anyio
NoYesSep 18, 2026
CVE-2026-59163CRITICAL9.1
  • Python logoPython
  • mnemosyne-memory
NoYesSep 18, 2026
CVE-2026-33625HIGH8.8
  • Python logoPython
  • lmdeploy
NoYesSep 18, 2026
CVE-2026-64847MEDIUM6.8
  • Python logoPython
  • litellm-1.90
NoYesSep 18, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management