Vulnerability EEF-CVE-2026-128360

Unknown
UNKNOWN RISK
Vulnerabilities without an assigned CVSS score. Severity is not determinable from available data.
1 day ago
December 04, 2026 at 06:17 AM UTC
Aggregates given a tenant are read in the enclosing query's tenant, leaking across tenants in AshSql
0.1.1-rc.0 and 0.1.1-rc.1 and 0.1.1-rc.2 and 0.1.1-rc.3 and 0.1.1-rc.4 and 0.1.1-rc.5 and 0.1.1-rc.6 and 0.1.1-rc.7 and 0.1.1-rc.8 and 0.1.1-rc.9 and 0.1.1-rc.10 and 0.1.1-rc.11 and 0.1.1-rc.12 and 0.1.1-rc.13 and 0.1.1-rc.14 and 0.1.1-rc.15 and 0.1.1-rc.16 and 0.1.1-rc.17 and 0.1.1-rc.18 and 0.1.1-rc.19 and 0.1.1-rc.20 - 0.9.0
0.1.1-rc.0 and 0.1.1-rc.1 and 0.1.1-rc.2 and 0.1.1-rc.3 and 0.1.1-rc.4 and 0.1.1-rc.5 and 0.1.1-rc.6 and 0.1.1-rc.7 and 0.1.1-rc.8 and 0.1.1-rc.9 and 0.1.1-rc.10 and 0.1.1-rc.11 and 0.1.1-rc.12 and 0.1.1-rc.13 and 0.1.1-rc.14 and 0.1.1-rc.15 and 0.1.1-rc.16 and 0.1.1-rc.17 and 0.1.1-rc.18 and 0.1.1-rc.19 and 0.1.1-rc.20 - 0.9.0

Summary

Aggregates given a tenant are read in the enclosing query's tenant, leaking across tenants in AshSql

Details

Summary

Incorrect Authorization vulnerability in ash_sql allows a caller in a multitenant application to receive aggregate values computed from another tenant's rows.

An aggregate can be given a tenant with the tenant option of Ash.Query.aggregate/5. AshSql.Aggregate.Lateral.add_aggregates/6 read only part of such an aggregate in that tenant. A field that is an aggregate or calculation, and what the aggregate's filter and sort refer to, were read in the tenant of the enclosing query, and with no tenant on that query they were read across every tenant. Aggregates over the same relationship were grouped into one lateral join without regard to their tenants, and with strategy(:context) multitenancy the aggregate was read in the schema of the enclosing query.

This issue affects ash_sql: from 0.1.0 before 0.9.1.

Details

1. Grouping. AshSql.Aggregate.Lateral.add_aggregates/6 groups the aggregates of a query by relationship path, resource, join filters, read action and multitenancy bypass, and builds one lateral subquery per group from the query of the first aggregate. The tenant is not part of that key, so aggregates that were given different tenants share the subquery of the first one.

2. Nested reads. The subquery is built from the bindings of the enclosing query. What is resolved inside it (a field that is an aggregate or a calculation, and the aggregates and calculations in the aggregate's filter and sort) takes context[:private][:tenant] from those bindings, which is the tenant of the enclosing read and not the tenant of the aggregate. AshSql.Join.handle_attribute_multitenancy/3 adds no tenant filter when that tenant is nil, so with no tenant on the read these nested reads cover every tenant. Ash itself refuses the same aggregate when no tenant is given anywhere.

3. Joined first aggregates. optimizable_first_aggregate?/3 lets a first aggregate over a to-one relationship be added as a join on the enclosing query, which reads the relationship in that query's tenant.

4. Schema multitenancy. With strategy(:context) the observed effect covers the aggregate as a whole: its subquery is read in the schema of the enclosing query's tenant, or in the repo's default schema when that query has no tenant.

Proof of concept

  1. With AshPostgres, define Group (has_many :orgs) and Org (has_many :notes, aggregate count :notes_count, :notes) without multitenancy, and Note with multitenancy using strategy :attribute and attribute :tenant_id.
  2. Create one group with two orgs. Give the first org one note in tenant "a" and two in tenant "b", and the second org two notes in tenant "a".
  3. Without a tenant on the read, run Group |> Ash.Query.aggregate(:n, :sum, :orgs, field: :notes_count, tenant: "a") |> Ash.read!(). The value for tenant "a" is 3; an affected version returns 5, the count over both tenants.
  4. Run the same query with Ash.read!(tenant: "b"). An affected version returns 2, the value of tenant "b".
  5. Again without a tenant on the read, add the aggregate twice, as :a with tenant: "a" and as :b with tenant: "b". The values are 3 and 2; an affected version returns 5 for both.
  6. For comparison, the aggregate without its tenant option in a read without a tenant is refused by Ash with a tenant-required error.

Impact

A user of the application receives counts, sums, lists or first values computed from rows of a tenant other than the one the application asked for, and from the rows of every tenant when the enclosing read has no tenant. No input from the user is needed beyond reaching the read that builds the aggregate.

Workarounds

Set the tenant on the read (Ash.Query.set_tenant/2 or the tenant option of the read) instead of on the aggregate, so that both are read in the same tenant. Aggregates that have to be read in different tenants can be run as separate reads, one per tenant.

Configurations

An application must use a data layer built on ash_sql (verified with AshPostgres), have a resource with multitenancy, and build an aggregate with the tenant option (Ash.Query.aggregate/5 or Ash.Query.Aggregate.new/4) inside a read that has no tenant or a different tenant. With the :attribute strategy the aggregate must also have a field, filter or sort that refers to an aggregate or calculation over the multitenant resource, or share its relationship with an aggregate that was given a different tenant. With the :context strategy any such aggregate over the multitenant resource is affected. Aggregates that take their tenant from the read are not affected.

Related Vulnerabilities

Other vulnerabilities affecting the same packages

Unknown
3 months ago
exists/2 predicate silently dropped on limited relationships with a parent() filter in AshSql
0.4.1 - 0.7.0 EEF-CVE-2026-77454
0.4.1 - 0.7.0 EEF-CVE-2026-77454
Unknown
3 months ago
Same-named aggregates with differing filters are conflated in AshSql
0.1.1-rc.0 and 0.1.1-rc.1 and 0.1.1-rc.2 and 0.1.1-rc.3 and 0.1.1-rc.4 and 0.1.1-rc.5 and 0.1.1-rc.6 and 0.1.1-rc.7 and 0.1.1-rc.8 and 0.1.1-rc.9 and 0.1.1-rc.10 and 0.1.1-rc.11 and 0.1.1-rc.12 and 0.1.1-rc.13 and 0.1.1-rc.14 and 0.1.1-rc.15 and 0.1.1-rc.16 and 0.1.1-rc.17 and 0.1.1-rc.18 and 0.1.1-rc.19 and 0.1.1-rc.20 - 0.7.0 EEF-CVE-2026-81316
0.1.1-rc.0 and 0.1.1-rc.1 and 0.1.1-rc.2 and 0.1.1-rc.3 and 0.1.1-rc.4 and 0.1.1-rc.5 and 0.1.1-rc.6 and 0.1.1-rc.7 and 0.1.1-rc.8 and 0.1.1-rc.9 and 0.1.1-rc.10 and 0.1.1-rc.11 and 0.1.1-rc.12 and 0.1.1-rc.13 and 0.1.1-rc.14 and 0.1.1-rc.15 and 0.1.1-rc.16 and 0.1.1-rc.17 and 0.1.1-rc.18 and 0.1.1-rc.19 and 0.1.1-rc.20 - 0.7.0 EEF-CVE-2026-81316
Unknown
3 months ago
Distinct-query aggregate drops the tenant schema prefix, leaking across tenants in AshSql
0.1.1-rc.0 and 0.1.1-rc.1 and 0.1.1-rc.2 and 0.1.1-rc.3 and 0.1.1-rc.4 and 0.1.1-rc.5 and 0.1.1-rc.6 and 0.1.1-rc.7 and 0.1.1-rc.8 and 0.1.1-rc.9 and 0.1.1-rc.10 and 0.1.1-rc.11 and 0.1.1-rc.12 and 0.1.1-rc.13 and 0.1.1-rc.14 and 0.1.1-rc.15 and 0.1.1-rc.16 and 0.1.1-rc.17 and 0.1.1-rc.18 and 0.1.1-rc.19 and 0.1.1-rc.20 - 0.7.0 EEF-CVE-2026-81318
0.1.1-rc.0 and 0.1.1-rc.1 and 0.1.1-rc.2 and 0.1.1-rc.3 and 0.1.1-rc.4 and 0.1.1-rc.5 and 0.1.1-rc.6 and 0.1.1-rc.7 and 0.1.1-rc.8 and 0.1.1-rc.9 and 0.1.1-rc.10 and 0.1.1-rc.11 and 0.1.1-rc.12 and 0.1.1-rc.13 and 0.1.1-rc.14 and 0.1.1-rc.15 and 0.1.1-rc.16 and 0.1.1-rc.17 and 0.1.1-rc.18 and 0.1.1-rc.19 and 0.1.1-rc.20 - 0.7.0 EEF-CVE-2026-81318
Unknown
3 months ago
Unescaped backslash allows LIKE wildcard injection in AshSql string search
0.1.1-rc.10 and 0.1.1-rc.11 and 0.1.1-rc.12 and 0.1.1-rc.13 and 0.1.1-rc.14 and 0.1.1-rc.15 and 0.1.1-rc.16 and 0.1.1-rc.17 and 0.1.1-rc.18 and 0.1.1-rc.19 and 0.1.1-rc.20 - 0.7.0 EEF-CVE-2026-78691
0.1.1-rc.10 and 0.1.1-rc.11 and 0.1.1-rc.12 and 0.1.1-rc.13 and 0.1.1-rc.14 and 0.1.1-rc.15 and 0.1.1-rc.16 and 0.1.1-rc.17 and 0.1.1-rc.18 and 0.1.1-rc.19 and 0.1.1-rc.20 - 0.7.0 EEF-CVE-2026-78691
Unknown
3 months ago
SQL string_trim removes only spaces, diverging from in-memory trimming in AshSql
0.1.1-rc.0 and 0.1.1-rc.1 and 0.1.1-rc.2 and 0.1.1-rc.3 and 0.1.1-rc.4 and 0.1.1-rc.5 and 0.1.1-rc.6 and 0.1.1-rc.7 and 0.1.1-rc.8 and 0.1.1-rc.9 and 0.1.1-rc.10 and 0.1.1-rc.11 and 0.1.1-rc.12 and 0.1.1-rc.13 and 0.1.1-rc.14 and 0.1.1-rc.15 and 0.1.1-rc.16 and 0.1.1-rc.17 and 0.1.1-rc.18 and 0.1.1-rc.19 and 0.1.1-rc.20 - 0.7.0 EEF-CVE-2026-80227
0.1.1-rc.0 and 0.1.1-rc.1 and 0.1.1-rc.2 and 0.1.1-rc.3 and 0.1.1-rc.4 and 0.1.1-rc.5 and 0.1.1-rc.6 and 0.1.1-rc.7 and 0.1.1-rc.8 and 0.1.1-rc.9 and 0.1.1-rc.10 and 0.1.1-rc.11 and 0.1.1-rc.12 and 0.1.1-rc.13 and 0.1.1-rc.14 and 0.1.1-rc.15 and 0.1.1-rc.16 and 0.1.1-rc.17 and 0.1.1-rc.18 and 0.1.1-rc.19 and 0.1.1-rc.20 - 0.7.0 EEF-CVE-2026-80227
View all vulnerabilities for these packages

Impacted packages

Timeline

Published
1 day ago
December 04, 2026 at 06:17 AM UTC
Fixed (0.9.1)
1 day ago
December 04, 2026 at 12:23 AM UTC
Last Modified
1 day ago
December 04, 2026 at 06:41 AM UTC