---
id: CVE-2024-41950
aliases:
  - GHSA-hx9v-6r9f-w677
  - PYSEC-2026-1447
title: Insecure Jinja2 templates rendered in Haystack Components can lead to RCE
summary: Insecure Jinja2 templates rendered in Haystack Components can lead to RCE
severity: high
cvss: 7.5
cvssVector: 'CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H'
vendor: haystack-ai
product: haystack-ai
ecosystem: pip
affected:
  - haystack-ai < 2.3.1
patched:
  - haystack-ai 2.3.1
published: '2024-07-31'
updated: '2026-07-07'
source: OSV
sourceUrl: 'https://osv.dev/vulnerability/GHSA-hx9v-6r9f-w677'
references:
  - url: >-
      https://github.com/deepset-ai/haystack/security/advisories/GHSA-hx9v-6r9f-w677
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2024-41950'
  - url: 'https://github.com/deepset-ai/haystack/pull/8095'
  - url: 'https://github.com/deepset-ai/haystack/pull/8096'
  - url: >-
      https://github.com/deepset-ai/haystack/commit/3fed1366c448b02189851bf08166c1f6477a02b0
  - url: >-
      https://github.com/deepset-ai/haystack/commit/6c25a5c73e83aa32c3241ba84a5cbb3ac0e8a89e
  - url: 'https://github.com/deepset-ai/haystack'
  - url: 'https://github.com/deepset-ai/haystack/releases/tag/v2.3.1'
tags:
  - osv
  - pip
epss: 0.01171
epssPercentile: 0.66079
ingestedAt: '2026-07-08T18:25:50.346Z'
---

## Overview

### Impact

Haystack clients that let their users create and run Pipelines from scratch are vulnerable to remote code executions.

Certain Components in Haystack use Jinja2 templates, if anyone can create and render that template on the client machine they run any code.

### Patches

The problem has been fixed with PRs deepset-ai/haystack#8095 and deepset-ai/haystack#8096.

Both have been released with Haystack `2.3.1`.

### Workarounds

Prevent users from running the affected Components, or only let users use preselected templates.

### References

The list of impacted Components can be found in the release notes for `2.3.1`.
https://github.com/deepset-ai/haystack/releases/tag/v2.3.1

## Affected packages

- `haystack-ai < 2.3.1`

## Remediation

Upgrade to a patched release:

- `haystack-ai 2.3.1`
