Am I affected?

type your ash version to check

Description

Deserialization of Untrusted Data vulnerability in ash-project ash allows an unauthenticated attacker to inject a filter expression through a forged keyset pagination cursor, resulting in SQL injection or code execution depending on the data layer.

Read actions with keyset pagination decode the client-supplied page[:after] or page[:before] cursor in decode_values/2 in lib/ash/page/keyset.ex using non_executable_binary_to_term/2 with [:safe]. That guard blocks new atoms, funs, and ports, but not a struct built from atoms already interned in a running Ash application, so a decoded %Ash.Query.Call{} expression survives and is spliced into the keyset filter as a comparison value in do_filters/4 and evaluated. Because the cursor bypasses the Ash.Expr macro, the runtime never applies the private?/public? gate that would otherwise reject it. On AshPostgres the injected fragment is inlined into the SQL query; on the ETS and Simple data layers it is evaluated in-process as an arbitrary function call.

This issue affects ash: from 1.17.0 before 3.31.3.

Weaknesses & attack patterns

Weakness

CWE-502 · Deserialization of Untrusted Data in catalog → MITRE ↗
CWE-89 · Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') in catalog → MITRE ↗

Attack patterns

CAPEC-586 · Object Injection MITRE ↗
CAPEC-66 · SQL Injection MITRE ↗

Affected — Hex / ash Hex.pm ↗ Repository ↗

1.17.0 < 3.31.3 affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:ash-project:ash:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Ash.Page.Keyset'
source files lib/ash/page/keyset.ex
routines 'Elixir.Ash.Page.Keyset':decode_values/2 · 'Elixir.Ash.Page.Keyset':do_filters/4

Affected — GitHub / ash-project/ash Repository ↗

f8fadc6 < 91874dd affected
every other version: unaffected
default status unaffected
cpe cpe:2.3:a:ash-project:ash:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Ash.Page.Keyset'
source files lib/ash/page/keyset.ex
routines 'Elixir.Ash.Page.Keyset':decode_values/2 · 'Elixir.Ash.Page.Keyset':do_filters/4

Configurations

A read action must declare keyset? true in its pagination block, and the application must pass a client-supplied value as the :after or :before page option. The severity of a successful attack depends on the data layer: AshPostgres yields SQL injection, while the ETS and Simple data layers evaluate the injected expression in-process.

References

Credits

Jisung Chae Finder
Zach Daniel Remediation developer
Jonatan Männchen / EEF Analyst

CVSS breakdown

CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
« All CVEs