Skip to main content
VulnerabilityPublished

django-haystack: Remote Code Execution via `eval()`

Affects django-haystackSource GCVE Database

0

CVSS 8.7 High : upgrade to 3.4.0 soon.

Data as of 16 Jul 2026, 10:49 UTC

CVSS 4.0 base score
8.7High
How severe the flaw is on the 0–10 CVSS scale.
Patch
Available – fixed in 3.4.0
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

What to do

Upgrade django-haystack to 3.4.0.

Affected software

ProductAffectedFixed in
PyPIdjango-haystackAffected
  • <3.4.0
Fixed in
  • 3.4.0

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

If you cannot patch yet, avoid using index_fieldname aliases different from logical field names in SearchFields with the Elasticsearch backend, or restrict user input that can be indexed to prevent injection of malicious payloads.

Description

A remote code execution (RCE) vulnerability exists in django-haystack's Elasticsearch backend due to unsafe use of eval() on attacker-controlled data during result deserialization. When a SearchField uses an index_fieldname alias different from the logical field name, the backend fails to remap the alias, causing it to call eval() on raw Elasticsearch field values. An attacker able to control indexed content and trigger a search returning that content can execute arbitrary code in the Django application process. This affects django-haystack versions prior to 3.4.0.

References

Community reviews

Loading reviews…