Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

GHSA-r3hx-x5rh-p9vv: django-haystack: Remote Code Execution via `eval()` in Elasticsearch Result Deserialization

0
High
Published: 07/15/2026 (07/15/2026, 22:42:28 UTC)
Source: GCVE Database
Product: django-haystack

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.

CVSS v4.0

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
Low
User Interaction
None
Vuln. Confidentiality
High
Vuln. Integrity
High
Vuln. Availability
High
Subsq. Confidentiality
None
Subsq. Integrity
None
Subsq. Availability
None
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

Affected software

PyPIghsa
django-haystack
Affected versions
<3.4.0

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 07/16/2026, 10:49:19 UTC

Technical Analysis

The Elasticsearch backend in django-haystack calls Python's eval() function on raw field values returned from Elasticsearch when a SearchField is declared with an index_fieldname alias differing from the logical field name. Because Elasticsearch stores documents under the alias key but the backend looks up fields by logical name, the lookup fails and the value is passed to _to_python(), which unconditionally calls eval() on it. This allows an attacker who can control indexed content and trigger a search returning that content to execute arbitrary code in the Django application process. The Solr backend correctly remaps aliases before lookup, but the Elasticsearch backend lacks this remapping, causing the vulnerability. The vulnerability affects django-haystack versions before 3.4.0.

Potential Impact

Successful exploitation allows an attacker who can inject data into Elasticsearch and trigger a search returning that data to execute arbitrary Python code within the Django application process. This can lead to full compromise of the application environment, data theft, or further attacks. The vulnerability is rated high severity (CVSS 4.0 vector indicates high impact on confidentiality, integrity, and availability).

Mitigation Recommendations

No official patch or fix is currently documented. Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until a fix is available, 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. Monitor vendor channels for updates and apply patches promptly once released.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
GHSA-r3hx-x5rh-p9vv
Osv Schema Version
1.4.0
Aliases
[]
Ecosystems
["PyPI"]
Database Specific Severity
HIGH
Cvss Version
4.0

Threat ID: 6a58b40568715ace43d6707e

Added to database: 07/16/2026, 10:35:49 UTC

Last enriched: 07/16/2026, 10:49:19 UTC

Last updated: 07/16/2026, 11:48:10 UTC

Views: 3

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses