ash-project ash
ash-project ash: cursore di paginazione falsificato permette codice o SQL arbitrario
Il problema, secondo i dati ufficiali
- Ash decodifica il cursore keyset (page[:after] o page[:before]) inviato dal client e non controlla i campi delle struct al suo interno. Una struct inserita nel valore del cursore per un campo di ordinamento di tipo :ci_string, :map, :struct o :term arriva fino al data layer.
- Con AshPostgres la struct passa a inspect/1, che esegue il codice del modulo scelto dall'attaccante. Una catena di moduli di ecto e db_connection può così richiamare una funzione indicata nel cursore e permettere l'esecuzione di comandi del sistema operativo.
- Un %Ash.Query.Function.Fragment{} dentro un %Ash.CiString{} viene scritto come testo grezzo nella query SQL (SQL injection). Può sfruttarla un attaccante non autenticato con un cursore falsificato.
- Secondo la CISA esiste già un exploit dimostrativo pubblico.
Cosa fare
- Aggiorna ash alla versione 3.38.0 o successiva.
Versioni interessate
- ash: dalla 3.31.3 alla 3.38.0 esclusa
Fonti ufficiali
- github.com — avviso del produttore
- github.com — patch
- cna.erlef.org — riferimento
- osv.dev — riferimento
- cna.erlef.org — riferimento
Descrizione ufficiale (in inglese)
Deserialization of Untrusted Data vulnerability in ash-project ash allows an unauthenticated attacker to execute arbitrary code or inject SQL through a forged keyset pagination cursor. Ash.Page.Keyset.filter/4 in lib/ash/page/keyset.ex decodes the client-supplied page[:after] or page[:before] cursor from Erlang external term format and rejects decoded expressions with Ash.Expr.expr?/1. That check does not examine the fields of a struct. The cast of each value against the type of its sort field accepts structs for the :ci_string, :map, :struct and :term types. A struct in the cursor value for such a sort field therefore reaches the data layer. With AshPostgres, the read passes such a struct to inspect/1, which runs the Inspect implementation of the struct module that the attacker selected. A chain of struct modules from ecto and db_connection then calls a function that the cursor names, which permits OS command execution. An %Ash.Query.Function.Fragment{} inside an %Ash.CiString{} value is written into the SQL query as raw text. This issue affects ash: from 3.31.3 before 3.38.0.
Non sai se ti riguarda?
Se usi ash-project ash e non sai quale versione hai, o hai un sito o un e-commerce da tenere al sicuro, possiamo controllarlo noi. Intanto puoi fare un primo controllo gratuito.
Il riassunto del problema è scritto da un modello linguistico (Claude di Anthropic) a partire dalla descrizione ufficiale, e controllato in automatico contro di essa. Soluzione e versioni vengono solo dai dati ufficiali (CISA KEV, NVD, CVE.org, FIRST EPSS). Non è più tra le allerte recenti: i dati sono quelli dell'ultimo aggiornamento. Ultimo aggiornamento: 1 dicembre 2026. Prima di intervenire verifica l'avviso del produttore.