{"description":"Trending threats, MITRE ATT\u0026CK coverage, and detection metadata. Fed continuously.","feed_url":"https://feed.craftedsignal.io/products/django-haystack/feed.json","home_page_url":"https://feed.craftedsignal.io/","items":[{"_cs_actors":[],"_cs_cpes":[],"_cs_cves":[],"_cs_exploited":false,"_cs_has_poc":false,"_cs_poc_references":[],"_cs_products":["django-haystack"],"_cs_severities":["high"],"_cs_tags":["rce","python","django","elasticsearch","deserialization","supply-chain"],"_cs_type":"advisory","_cs_vendors":["django-haystack"],"content_html":"\u003cp\u003eA critical remote code execution (RCE) vulnerability (CVSS 8.5 High) has been identified in the Elasticsearch backend of the \u003ccode\u003edjango-haystack\u003c/code\u003e library. This flaw arises when a \u003ccode\u003eSearchField\u003c/code\u003e is configured with an \u003ccode\u003eindex_fieldname\u003c/code\u003e alias that differs from the logical field name. During the processing of search results, the backend attempts to look up fields by their logical name, but the data is stored under the alias. This lookup failure causes the raw field value to be passed directly to \u003ccode\u003e_to_python()\u003c/code\u003e which subsequently calls \u003ccode\u003eeval()\u003c/code\u003e without proper type-safety checks. An attacker who can control content indexed into Elasticsearch, and then trigger a search that returns this malicious content, can inject arbitrary Python expressions such as \u003ccode\u003e__import__('os').system(...)\u003c/code\u003e. This allows for the execution of arbitrary Python and shell commands within the Django application process, potentially leading to full compromise of the server. This vulnerability affects all Django applications utilizing the Elasticsearch backend with \u003ccode\u003eindex_fieldname\u003c/code\u003e aliasing, regardless of the application's authentication mechanisms.\u003c/p\u003e\n\u003ch2 id=\"attack-chain\"\u003eAttack Chain\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eAn attacker gains control over content that is subsequently indexed into Elasticsearch by the vulnerable Django application.\u003c/li\u003e\n\u003cli\u003eThe application's \u003ccode\u003eSearchIndex\u003c/code\u003e contains a \u003ccode\u003eSearchField\u003c/code\u003e declared with an \u003ccode\u003eindex_fieldname\u003c/code\u003e (e.g., \u003ccode\u003e\u0026quot;name_s\u0026quot;\u003c/code\u003e) that differs from its logical attribute name (e.g., \u003ccode\u003e\u0026quot;name\u0026quot;\u003c/code\u003e).\u003c/li\u003e\n\u003cli\u003eThe attacker-controlled data, specifically a crafted Python expression, is stored in Elasticsearch under the \u003ccode\u003eindex_fieldname\u003c/code\u003e alias.\u003c/li\u003e\n\u003cli\u003eA search operation is performed, retrieving the malicious document from Elasticsearch, including the attacker-controlled \u003ccode\u003e_source\u003c/code\u003e data.\u003c/li\u003e\n\u003cli\u003eDuring result processing by \u003ccode\u003eElasticsearchSearchBackend._process_results()\u003c/code\u003e, the backend attempts to map Elasticsearch fields to logical field names.\u003c/li\u003e\n\u003cli\u003eThe lookup for the \u003ccode\u003eindex_fieldname\u003c/code\u003e (e.g., \u003ccode\u003e\u0026quot;name_s\u0026quot;\u003c/code\u003e) fails because \u003ccode\u003eindex.fields\u003c/code\u003e is keyed by logical names (e.g., \u003ccode\u003e\u0026quot;name\u0026quot;\u003c/code\u003e).\u003c/li\u003e\n\u003cli\u003eDue to the failed lookup, the raw, attacker-controlled value from Elasticsearch is passed to \u003ccode\u003e_to_python(value)\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003eThe \u003ccode\u003e_to_python()\u003c/code\u003e function then unconditionally calls \u003ccode\u003eeval(value)\u003c/code\u003e, executing the attacker's injected Python expression with the privileges of the Django application.\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"impact\"\u003eImpact\u003c/h2\u003e\n\u003cp\u003eThis vulnerability results in Remote Code Execution (RCE), allowing an attacker to execute arbitrary Python and shell commands on the affected server. Successful exploitation grants the attacker the same privileges as the running Django application, leading to a complete compromise of the server's confidentiality, integrity, and availability. The impact extends to all Django applications that use the \u003ccode\u003edjango-haystack\u003c/code\u003e Elasticsearch backend and declare \u003ccode\u003eSearchField\u003c/code\u003e instances with \u003ccode\u003eindex_fieldname\u003c/code\u003e aliases, irrespective of their authentication configurations. The severity is high, as demonstrated by the CVSS 3.1 Base Score of 8.5.\u003c/p\u003e\n\u003ch2 id=\"recommendation\"\u003eRecommendation\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003ePatch the \u003ccode\u003edjango-haystack\u003c/code\u003e library immediately to apply the provided fix that introduces \u003ccode\u003eindex.field_map\u003c/code\u003e remapping and uses \u003ccode\u003east.literal_eval\u003c/code\u003e instead of \u003ccode\u003eeval()\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003eDeploy the provided Sigma rule to your SIEM to detect the creation of the RCE marker file \u003ccode\u003e/tmp/django_haystack_eval_rce_proof\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003eEnable process creation logging on Linux servers to ensure visibility into executed commands, which is required for the provided Sigma rule.\u003c/li\u003e\n\u003cli\u003eReview all \u003ccode\u003eSearchIndex\u003c/code\u003e configurations within your Django applications to identify and assess any \u003ccode\u003eSearchField\u003c/code\u003e declarations using \u003ccode\u003eindex_fieldname\u003c/code\u003e aliases, especially those handling user-controlled input.\u003c/li\u003e\n\u003c/ul\u003e\n","date_modified":"2026-07-15T22:43:44Z","date_published":"2026-07-15T22:43:44Z","id":"https://feed.craftedsignal.io/briefs/2026-07-django-haystack-rce/","summary":"A critical remote code execution (RCE) vulnerability in the Elasticsearch backend of django-haystack allows attackers to execute arbitrary Python commands by manipulating `SearchField` aliases and indexed content, leading to full compromise of the Django application.","title":"Remote Code Execution via eval() in django-haystack Elasticsearch Deserialization","url":"https://feed.craftedsignal.io/briefs/2026-07-django-haystack-rce/"}],"language":"en","title":"CraftedSignal Threat Feed - Django-Haystack","version":"https://jsonfeed.org/version/1.1"}