Summary
Livewire PowerGrid versions 6.0.0 through versions before 6.10.4 interpolate the public sortDirection property into a raw SQL ORDER BY clause without restricting its value. An attacker who can submit updates to an affected Livewire component may be able to inject SQL when sorting is processed.
Affected context
The vulnerability occurs in Livewire PowerGrid's table sorting behavior when the component builds a database query. It affects versions 6.0.0 through versions before 6.10.4 when a submitted sortDirection value is used verbatim in a raw SQL ORDER BY clause. Exploitability depends on whether an attacker can reach the Livewire update endpoint and trigger the affected sorting path.
Exploit preconditions
- Attack surface: The application's Livewire update endpoint,
POST /livewire/update - Required access: The ability to submit updates to an affected PowerGrid component; authentication requirements depend on the application
- Trigger point: Processing a table sort that uses the public
sortDirectionproperty - Why exploitation is possible: The value is interpolated into raw SQL without being constrained to expected directions such as
ascordesc
Why this happens
The component treats a public property as safe SQL syntax and inserts it directly into a raw ORDER BY clause. Because the value is not restricted to an allowlist of valid sort directions, attacker-controlled input can alter the SQL statement's structure. This is an SQL injection flaw mapped to CWE-89: Improper Neutralization of Special Elements used in an SQL Command.
Potential impact
- An attacker may be able to alter database queries executed during sorting
- Depending on the query, database permissions, and application controls, sensitive data could be exposed or modified
- Database availability or application integrity could be affected
General mitigation guidance
Defensive patterns include treating sort parameters as untrusted and mapping them to a fixed set of permitted values before query construction. Prefer query-builder APIs and bound parameters where applicable, and avoid interpolating user-controlled values into raw SQL syntax. Apply least-privilege database permissions and restrict access to component actions according to the application's authorization model.
How teams detect issues like this
- Use static analysis to identify raw SQL construction that incorporates public component properties or request-derived values
- Review sorting code for missing allowlists and direct interpolation into
ORDER BYclauses - Apply policy checks that flag unsafe raw-query APIs or require validation of SQL identifiers and directions
- Monitor application and database logs for unexpected sorting inputs or anomalous query behavior

