Summary
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 :cistring, :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 dbconnection 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.
Details
1. Cursor decoding
A keyset cursor is the Base64 form of :erlang.termtobinary/1 over the list of sort values of one record. decodevalues/3 in lib/ash/page/keyset.ex decodes a client-supplied cursor with Ash.Helpers.nonexecutablebinarytoterm/2 and [:safe]. This refuses functions and new atoms. It accepts a map with a struct key, so the client selects the struct module of each decoded value. When keysetsigningsecret is unset, Ash does not authenticate the cursor.
2. Expression check
checknoexpression/1 calls Ash.Expr.expr?/1 on the decoded term. Ash.Expr.expr?/1 in lib/ash/expr/expr.ex returns true for expression structs and descends into lists, tuples and maps that are not structs. For a struct that is not an expression it returns false and does not examine the fields. Such a struct passes the check, and so does any value inside it.
3. Type cast
castvalues/3 casts each decoded value with Ash.Type.castinput/3 against the type of its sort field. Strict types such as :integer reject a struct. Four built-in types accept one. Ash.Type.CiString.castinput/2 returns any %Ash.CiString{} unchanged, and its string field can hold any term. Ash.Type.Map.castinput/2 and Ash.Type.Struct.castinput/2 accept any map, which includes any struct. Ash.Type.Term.castinput/2 accepts any term.
4. Query construction
dofilters/4 puts the value into the keyset filter as the right side of a comparison with the sort field. In ashsql, the clause of AshSql.Expr for an %Ash.CiString{} value compiles the string field as a nested expression.
5. Code execution
A value that holds a struct inside a map, or inside a tuple in an %Ash.CiString{}, becomes a query parameter. Parameter encoding fails, and the read passes the value to inspect/1 before Ash.read/2 returns. inspect/1 runs the Inspect implementation of each struct module in the value. An %Ecto.Query.DynamicExpr{} whose binding field holds a %DBConnection.Stream{} makes Inspect call Enum.map/2 on the stream. The Enumerable implementation of DBConnection.Stream calls DBConnection.reduce/3, which applies the :log module, function and arguments from the opts field of the struct. The cursor supplies that field. A function from the OTP standard library that applies a further module, function and argument list makes the call fully attacker-controlled, which includes OS command execution.
6. SQL injection
An %Ash.CiString{} whose string field holds an %Ash.Query.Function.Fragment{} with raw: arguments becomes literal SQL text in the WHERE clause. This works for each of the four types, because each accepts the %Ash.CiString{} struct.
Proof of concept
1. Define an AshPostgres resource with a :cistring attribute and a read action with pagination keyset?: true. Leave keysetsigningsecret unset. 2. Read one page sorted on the :cistring attribute and decode the keyset of a record with Base.decode64!/1 and :erlang.binarytoterm/1. The term is a list with the %Ash.CiString{} sort value and the primary key. 3. Build an %Ecto.Query.DynamicExpr{} whose binding field is a %DBConnection.Stream{}. Set the query field of the stream to an atom, and put a :log entry with a module, function and argument list into its opts field. 4. Replace the first element of the list with an %Ash.CiString{} whose string field is a one-element tuple that holds the struct from step 3. 5. Encode the list with :erlang.termtobinary/1 and Base.encode64/1, and pass the result as page: [after: cursor] to the same read. 6. The read returns an invalid filter value error. Before it returns, the application calls the function from the :log entry.
For the SQL injection, use an %Ash.Query.Function.Fragment{} with raw: arguments as the string field in step 4. The read succeeds, and the query contains the raw text in the WHERE clause.
Impact
An unauthenticated client that can supply a keyset cursor selects the struct modules of the decoded values. Through protocol implementations in ecto and dbconnection, the client makes the application call a function of its choice, and can execute OS commands with the privileges of the BEAM OS user.
An unauthenticated client that can supply a keyset cursor adds SQL text to the query of the read action. The text runs with the database privileges of the application.
Workarounds
On ash 3.37.0 or later, set config :ash, keysetsigningsecret to a long random string. Ash then rejects each cursor that it did not sign, before it decodes the cursor. Cursors issued before the change become invalid.
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 sort must include a field of type :cistring, :map, :struct or :term. config :ash, :keysetsigningsecret must be unset, which is the default. Both results were demonstrated with the AshPostgres data layer. The code execution was demonstrated with ecto 3.14.3 and dbconnection 2.10.2 loaded.
Summary
Authorization Bypass Through User-Controlled Key vulnerability in ash-project ash allows a user of one tenant to read, overwrite and take over another tenant's records via an upserting create action.
Under attribute multitenancy, Ash.Actions.Create (lib/ash/actions/create/create.ex) and Ash.Actions.Create.Bulk (lib/ash/actions/create/bulk.ex) upserted on the primary key, or on an alltenants? identity, without scoping the conflicting record to the request's tenant. A caller of a create action with upsert? true that accepts the primary key, supplying a record id from another tenant, updated that record's upsert fields and received all of its attributes in the result. With the default upsert fields the tenant attribute was written too, moving the record into the caller's tenant. Read and update policies do not run for upserts, and tenant-scoped create policies pass because the tenant is the caller's own.
This issue affects ash: from 1.22.0 before 3.37.2.
Impact
A signed-in user of one tenant posts another tenant's record id to an upserting create action, receives that record's attributes, overwrites its upsert fields, and with the default upsert fields moves it into their own tenant.
Workarounds
Add upsertcondition expr(<tenant attribute> == ^tenant()) to every create action that upserts on the primary key or on an alltenants? identity, and do not combine it with returnskippedupsert?. An upsert into another tenant's record then fails with Ash.Error.Changes.StaleRecord (or is skipped in a bulk create) and leaves that record unchanged. This does not help on the Mnesia data layer, which ignores upsert conditions in affected versions.
Configurations
Reachable when a resource uses attribute multitenancy and exposes to callers of one tenant a create action with upsert? true that either upserts on the primary key (no upsertidentity) and accepts it, or upserts on an alltenants? identity, and the caller knows or can enumerate a key belonging to another tenant (for example a serial integer id, or an id from a shared link or export).
Summary
Authorization Bypass Through User-Controlled Key vulnerability in ash-project ash allows a user of one tenant to read, overwrite and take over another tenant's records via an upserting create action.
Under attribute multitenancy, Ash.Actions.Create (lib/ash/actions/create/create.ex) and Ash.Actions.Create.Bulk (lib/ash/actions/create/bulk.ex) upserted on the primary key, or on an alltenants? identity, without scoping the conflicting record to the request's tenant. A caller of a create action with upsert? true that accepts the primary key, supplying a record id from another tenant, updated that record's upsert fields and received all of its attributes in the result. With the default upsert fields the tenant attribute was written too, moving the record into the caller's tenant. Read and update policies do not run for upserts, and tenant-scoped create policies pass because the tenant is the caller's own.
This issue affects ash: from 1.22.0 before 3.37.2.
Impact
A signed-in user of one tenant posts another tenant's record id to an upserting create action, receives that record's attributes, overwrites its upsert fields, and with the default upsert fields moves it into their own tenant.
Workarounds
Add upsertcondition expr(<tenant attribute> == ^tenant()) to every create action that upserts on the primary key or on an alltenants? identity, and do not combine it with returnskippedupsert?. An upsert into another tenant's record then fails with Ash.Error.Changes.StaleRecord (or is skipped in a bulk create) and leaves that record unchanged. This does not help on the Mnesia data layer, which ignores upsert conditions in affected versions.
Configurations
Reachable when a resource uses attribute multitenancy and exposes to callers of one tenant a create action with upsert? true that either upserts on the primary key (no upsertidentity) and accepts it, or upserts on an alltenants? identity, and the caller knows or can enumerate a key belonging to another tenant (for example a serial integer id, or an id from a shared link or export).
Summary
Authorization Bypass Through User-Controlled Key vulnerability in ash-project ash allows a user of one tenant to read, overwrite and take over another tenant's records via an upserting create action.
Under attribute multitenancy, Ash.Actions.Create (lib/ash/actions/create/create.ex) and Ash.Actions.Create.Bulk (lib/ash/actions/create/bulk.ex) upserted on the primary key, or on an alltenants? identity, without scoping the conflicting record to the request's tenant. A caller of a create action with upsert? true that accepts the primary key, supplying a record id from another tenant, updated that record's upsert fields and received all of its attributes in the result. With the default upsert fields the tenant attribute was written too, moving the record into the caller's tenant. Read and update policies do not run for upserts, and tenant-scoped create policies pass because the tenant is the caller's own.
This issue affects ash: from 1.22.0 before 3.37.2.
Impact
A signed-in user of one tenant posts another tenant's record id to an upserting create action, receives that record's attributes, overwrites its upsert fields, and with the default upsert fields moves it into their own tenant.
Workarounds
Add upsertcondition expr(<tenant attribute> == ^tenant()) to every create action that upserts on the primary key or on an alltenants? identity, and do not combine it with returnskippedupsert?. An upsert into another tenant's record then fails with Ash.Error.Changes.StaleRecord (or is skipped in a bulk create) and leaves that record unchanged. This does not help on the Mnesia data layer, which ignores upsert conditions in affected versions.
Configurations
Reachable when a resource uses attribute multitenancy and exposes to callers of one tenant a create action with upsert? true that either upserts on the primary key (no upsertidentity) and accepts it, or upserts on an alltenants? identity, and the caller knows or can enumerate a key belonging to another tenant (for example a serial integer id, or an id from a shared link or export).
Summary
Incorrect Authorization vulnerability in ash-project ash allows a client to read destination records unrelated to the source record through a through relationship.
When a hasmany relationship declared with through: was loaded for a single record with a limit of 1, or an unsorted hasone through relationship was loaded with a limit of 1, lateraljoin?/4 in lib/ash/actions/read/relationships.ex chose the path that reads the destination without any filter linking it to the source. The load returned the first destination record by sort, or any other record with an offset. The read still runs the destination's policies but carries the relationship as accessingfrom, so a client paging such a field (for example teachers(limit: 1, offset: n) through AshGraphql) can enumerate destination records that policies allow only when reached through that relationship.
This issue affects ash: from 3.24.0 before 3.37.1.
Impact
A client paging a through relationship field with a limit of 1 reads destination records that should only be reachable through that relationship.
Configurations
Reachable when a through relationship is loaded for a single record with a caller-controlled limit of 1 (and optionally an offset), for example through AshGraphql relationship field arguments, and the destination resource's read policies rely on the relationship (accessingfrom) or are otherwise open to the caller.
Summary
Incorrect Authorization vulnerability in ash-project ash allows a client to read destination records unrelated to the source record through a through relationship.
When a hasmany relationship declared with through: was loaded for a single record with a limit of 1, or an unsorted hasone through relationship was loaded with a limit of 1, lateraljoin?/4 in lib/ash/actions/read/relationships.ex chose the path that reads the destination without any filter linking it to the source. The load returned the first destination record by sort, or any other record with an offset. The read still runs the destination's policies but carries the relationship as accessingfrom, so a client paging such a field (for example teachers(limit: 1, offset: n) through AshGraphql) can enumerate destination records that policies allow only when reached through that relationship.
This issue affects ash: from 3.24.0 before 3.37.1.
Impact
A client paging a through relationship field with a limit of 1 reads destination records that should only be reachable through that relationship.
Configurations
Reachable when a through relationship is loaded for a single record with a caller-controlled limit of 1 (and optionally an offset), for example through AshGraphql relationship field arguments, and the destination resource's read policies rely on the relationship (accessingfrom) or are otherwise open to the caller.
Summary
Incorrect Authorization vulnerability in ash-project ash allows an actor to infer data in related records they cannot read via Ash.count/2, Ash.exists/2 and Ash.aggregate/3.
Ash.Actions.Aggregate.run/4 (lib/ash/actions/aggregate.ex) applied only the root resource's read policy before running the aggregate query. The read path also applies each related resource's read policy to filter and sort references that cross a relationship, directly (for example comments.body) or through an aggregate over one, but the aggregate path skipped that step. A caller whose filter or sort reaches these functions, for example through Ash.Query.filterinput/2, an ashlua script, or an AshAi tool offering count or exists results, can test conditions against related rows hidden from them and recover their existence and attribute values one query at a time. Ash.read/2 and its page counts are not affected.
This issue affects ash: from 2.6.0 before 3.34.6.
Configurations
Reachable only when an application passes caller-supplied filters or sorts that cross a relationship into Ash.count/2, Ash.exists/2 or Ash.aggregate/3 (directly, through ashlua read operations, or through AshAi count, exists or aggregate result types), and a related resource's read policy is stricter than the root resource's.
Summary
Ash stores :atom-typed attributes as strings and compares them as strings. When such an attribute is referenced in a filter, the comparison value is coerced through Ash.Type.Atom. Because the type defined no coerce/2 callback, coercion fell back to the default (castinput/2), which calls String.toatom/1 when the attribute is configured with the unsafetoatom?: true constraint.
Filtering such an attribute with attacker-controlled strings therefore interned a new, permanent atom for every distinct value. Atoms are never garbage collected and the BEAM caps the atom table, so an actor who can supply filter values for a public, filterable :atom attribute declared with unsafetoatom?: true can exhaust the atom table and crash the node (denial of service). AshPaperTrail is a notable example: its version resources expose a public, filterable versionactionname atom attribute with unsafetoatom?: true by default.
The fix adds a coerce/2 to Ash.Type.Atom that never interns atoms — a comparison value is left as a string, since the type is stored and compared as a string. Setting the attribute from action input (castinput/2, which still honors unsafetoatom?) is unchanged.
This issue affects ash: from 3.5.1 before 3.34.3.
Configurations
Reachable only when an application exposes a public, filterable :atom attribute declared with the unsafetoatom?: true constraint, and an actor can supply filter values for it (for example through AshGraphql, AshJsonApi, or Ash.Query.filterinput/2). AshPaperTrail's version resources ship such an attribute (versionactionname) by default.
Summary
Improperly Controlled Modification of Dynamically-Determined Object Attributes vulnerability in ash-project ash allows a user to set the value of a private action argument on the bulk destroy and bulk update paths.
Action arguments declared with public?: false are meant to be set only by trusted server-side code (for example via Ash.Changeset.setprivateargument/3) and must not be settable from end-user input. CVE-2026-55736 fixed the non-bulk changeset path to strip private arguments from user-supplied parameter maps, but the bulk destroy and bulk update paths were not covered.
Ash.Actions.Destroy.Bulk.basechangeset/5 and Ash.Actions.Update.Bulk.basechangeset/5 match every key in the caller-supplied parameter map against all of the action's arguments with no public? check, then apply the matches to the base changeset. A caller who can submit parameters to a bulk destroy or bulk update action (for example through AshJsonApi, AshGraphql, or a controller that forwards request parameters to Ash.bulkdestroy/4 or Ash.bulkupdate/4) can therefore set any private argument of that action, including one referenced by an arg(...) template in the action's changes or validations. Depending on how the application uses the argument (for example an actinguserid driving authorization or record ownership, or audit metadata), this can lead to an integrity violation or privilege escalation.
The fix requires public? in the argument matching on both bulk paths; private arguments remain settable server-side via the :privatearguments option.
This issue affects ash: from 2.17.15 before 3.33.11.
Configurations
An action must declare a private argument (public?: false) that is referenced by an arg(...) template in one of its changes or validations, be invocable as a bulk destroy or bulk update, and the application must pass untrusted user-supplied parameters into Ash.bulkdestroy/4 or Ash.bulkupdate/4 (directly or through AshJsonApi/AshGraphql).
Summary
Improper Validation of Specified Quantity in Input vulnerability in ash-project ash allows an attacker to store a value of arbitrary size in an attribute whose length constraint should bound it.
Ash measures string length with Elixir's String.length/1, which counts Unicode graphemes, in the maxlength and minlength constraints of Ash.Type.String (applyconstraints/2 in lib/ash/type/string.ex), in Ash.Resource.Validation.StringLength, and in the stringlength expression function. A grapheme carries an unbounded number of combining marks, so a base character followed by a million combining acute accents is one grapheme and megabytes of data, and satisfies maxlength: 2. Where the data layer imposes no independent limit (ETS, Mnesia, or a Postgres text column) the whole value is persisted, so an attacker can write an entire request body into an attribute declared with a small maximum and grow storage without bound.
The counting unit also disagrees with the storage layer, which counts codepoints rather than graphemes, so a value accepted by the constraint can still be rejected or truncated by the column. A Postgres varchar(n) column bounds the value itself and is not exposed.
This issue affects ash: from 0.10.0 before 3.33.0.
Configurations
A resource attribute must carry a maxlength constraint (or an equivalent stringlength validation) fed from client input, and the data layer must impose no independent size limit of its own. The ETS and Mnesia data layers and Postgres text columns store the value in full; a Postgres varchar(n) column bounds it independently and is not exposed.
Summary
Improper Validation of Specified Quantity in Input vulnerability in ash-project ash allows an attacker to store a value of arbitrary size in an attribute whose length constraint should bound it.
Ash measures string length with Elixir's String.length/1, which counts Unicode graphemes, in the maxlength and minlength constraints of Ash.Type.String (applyconstraints/2 in lib/ash/type/string.ex), in Ash.Resource.Validation.StringLength, and in the stringlength expression function. A grapheme carries an unbounded number of combining marks, so a base character followed by a million combining acute accents is one grapheme and megabytes of data, and satisfies maxlength: 2. Where the data layer imposes no independent limit (ETS, Mnesia, or a Postgres text column) the whole value is persisted, so an attacker can write an entire request body into an attribute declared with a small maximum and grow storage without bound.
The counting unit also disagrees with the storage layer, which counts codepoints rather than graphemes, so a value accepted by the constraint can still be rejected or truncated by the column. A Postgres varchar(n) column bounds the value itself and is not exposed.
This issue affects ash: from 0.10.0 before 3.33.0.
Configurations
A resource attribute must carry a maxlength constraint (or an equivalent stringlength validation) fed from client input, and the data layer must impose no independent size limit of its own. The ETS and Mnesia data layers and Postgres text columns store the value in full; a Postgres varchar(n) column bounds it independently and is not exposed.
Summary
Improperly Controlled Modification of Dynamically-Determined Object Attributes vulnerability in ash-project ash allows a user to set the value of a private action argument that is intended to be controlled only by trusted server-side code.
Action arguments declared with public?: false are meant to be set internally (for example via Ash.Changeset.set\private\argument/3) and must not be settable from end-user input. When a changeset is built from a parameter map, Ash filters out private arguments, but the filtering is incomplete.
In the regular changeset path (for\create, for\update, for\destroy), private arguments are stripped only when the parameter key is an atom. When the key is a binary (string), as is the case for user-supplied parameters, the private argument is kept and the user controls its value. In the atomic path (Ash.Changeset.fully\atomic\changeset/4, also reached through atomic and bulk updates), private arguments are not stripped at all, regardless of whether the key is an atom or a binary.
An attacker who can submit parameters to an action that defines a private argument can therefore inject a value for that argument. Depending on how the application uses the argument (for example an acting\user\id driving authorization or record ownership), this can lead to an integrity violation or privilege escalation.
This issue affects ash: from 3.0.0 before 3.29.3.
Configurations
An action must declare a private argument (one defined with public?: false) whose value is meant to be set only by trusted server-side code, and the application must build the changeset from untrusted user-supplied parameters, passing them straight into Ash.Changeset.for\create/3, for\update/3, for\destroy/3, or into an atomic or bulk update.