Description
A vulnerability has been found in django-haystack up to 3.3.0. Affected is the function _to_python of the file haystack/backends/elasticsearch_backend.py of the component more_like_this Template Tag Handler. Such manipulation of the argument result_class leads to improper neutralization of directives in dynamically evaluated code. The attack can be launched remotely. The exploit has been disclosed to the public and may be used. Upgrading to version 3.4.0 is able to address this issue. The name of the patch is eb05f193c9771a68dcc8cfac6674a0d48a52ee9d. It is suggested to upgrade the affected component.
Published: 2026-10-05
Score: 5.1 Medium
EPSS: < 1% Very Low
KEV: No
Impact: Remote Code Execution
Action: Apply Patch
AI Analysis

Impact

A flaw in django‑haystack’s more_like_this template tag handler (the _to_python function in haystack/backends/elasticsearch_backend.py) allows an attacker to supply a crafted value_class argument that is improperly neutralized before being passed to Python’s eval, enabling the execution of arbitrary Python code on the host running the Django application. The vulnerability is contained in the search library and results in compromise of confidentiality, integrity, and availability for the underlying system, as the executed code runs with the same privileges as the web application process.

Affected Systems

The issue affects the django‑haystack Python search library versions up to and including 3.3.0; a fix was released in 3.4.0 (commit eb05f193c9771a68dcc8cfac6674a0d48a52ee9d). The library is commonly used in Django applications that interface with Elasticsearch for search functionality, and the weakness resides in template rendering logic rather than the operating system.

Risk and Exploitability

With a CVSS score of 5.1 the flaw is rated moderate, yet it unlocks remote code execution via a template tag that is accessible to any remote client that can render templates. EPSS data is not available, the vulnerability is not listed in the CISA KEV catalog, but public exploit code exists; therefore an unpatched deployment remains at ongoing risk.

Generated by OpenCVE AI on October 5, 2026 at 15:35 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade django‑haystack to version 3.4.0 or later, applying the patch identified by commit eb05f193c9771a68dcc8cfac6674a0d48a52ee9d
  • Review and restrict usage of the more_like_this template tag in all rendering contexts that process untrusted input
  • Validate and sanitize any parameters passed to the tag, ensuring that result_class values cannot be supplied by external users
  • If an immediate upgrade cannot be performed, disable the tag or limit template rendering permissions to trusted users

Generated by OpenCVE AI on October 5, 2026 at 15:35 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Mon, 05 Oct 2026 14:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Mon, 05 Oct 2026 13:00:00 +0000

Type Values Removed Values Added
Description A vulnerability has been found in django-haystack up to 3.3.0. Affected is the function _to_python of the file haystack/backends/elasticsearch_backend.py of the component more_like_this Template Tag Handler. Such manipulation of the argument result_class leads to improper neutralization of directives in dynamically evaluated code. The attack can be launched remotely. The exploit has been disclosed to the public and may be used. Upgrading to version 3.4.0 is able to address this issue. The name of the patch is eb05f193c9771a68dcc8cfac6674a0d48a52ee9d. It is suggested to upgrade the affected component.
Title django-haystack more_like_this Template Tag elasticsearch_backend.py _to_python eval injection
First Time appeared Django-haystack
Django-haystack django-haystack
Weaknesses CWE-94
CWE-95
CPEs cpe:2.3:a:django-haystack:django-haystack:*:*:*:*:*:*:*:*
Vendors & Products Django-haystack
Django-haystack django-haystack
References
Metrics cvssV2_0

{'score': 5.8, 'vector': 'AV:N/AC:L/Au:M/C:P/I:P/A:P/E:POC/RL:OF/RC:C'}

cvssV3_0

{'score': 4.7, 'vector': 'CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:L/E:P/RL:O/RC:C'}

cvssV3_1

{'score': 4.7, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:L/E:P/RL:O/RC:C'}

cvssV4_0

{'score': 5.1, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:P'}


Subscriptions

Django-haystack Django-haystack
cve-icon MITRE

Status: PUBLISHED

Assigner: VulDB

Published:

Updated: 2026-10-05T13:27:19.349Z

Reserved: 2026-10-05T07:33:33.334Z

Link: CVE-2026-105315

cve-icon Vulnrichment

Updated: 2026-10-05T13:27:14.448Z

cve-icon NVD

Status : Deferred

Published: 2026-10-05T13:16:52.823

Modified: 2026-10-06T15:04:52.637

Link: CVE-2026-105315

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-10-05T15:45:16Z

Weaknesses
  • CWE-94

    Improper Control of Generation of Code ('Code Injection')

  • CWE-95

    Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')