Every CVESearch/Get API key

CVE-2026-128360

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

Explain with AI
ChatGPTClaudeGoogle AI
Severity
2.1Low
Local attack, no privileges, no user interactionCVSS 4.0, CVE List
Exploitation
Unknown
No source reports exploitation yet.
Exploit chance
0.24% in 30 days
Percentile15th
EPSS, scored
Listed fix
0.9.1 for ash_sql
From OSV

Overview

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.

CVSS 4.0 vector

Exploitability

Attack vector
Local
Complexity
Low
Attack requirements
Present
Privileges needed
None
User interaction
None

Impact on the vulnerable system

Confidentiality
Low
Integrity
None
Availability
None

Impact on subsequent systems

Confidentiality
None
Integrity
None
Availability
None
CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N

Exploit chance over time

Scored once so far, on . The trend appears after a second daily score.

Affected

Packages 1

Affected packages
PackageAffectedFixed
ash_sql
Hex
0.1.0 up to 0.9.1, plus listed versions
0.1.1-rc.00.1.1-rc.10.1.1-rc.100.1.1-rc.110.1.1-rc.12
Show 45 more versionsShow less
0.1.1-rc.130.1.1-rc.140.1.1-rc.150.1.1-rc.160.1.1-rc.170.1.1-rc.180.1.1-rc.190.1.1-rc.20.1.1-rc.200.1.1-rc.30.1.1-rc.40.1.1-rc.50.1.1-rc.60.1.1-rc.70.1.1-rc.80.1.1-rc.90.1.20.1.30.2.00.2.10.2.100.2.110.2.120.2.130.2.140.2.150.2.160.2.170.2.180.2.190.2.20.2.200.2.210.2.220.2.230.2.240.2.250.2.260.2.270.2.280.2.290.2.30.2.300.2.310.2.32
0.9.1

The JSON record also has 124 more versions.

Products 1

Sources

CVE List Score usedCVSS 4.02.1

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

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.

Record
CVE-2026-128360
CVSS 4.0
2.1 LowCVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N
Weakness
CWE-863
Updated
2026-12-04
EUVDEUVD-2026-144040CVSS 4.02.1

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.

Record
EUVD-2026-144040
CVSS 4.0
2.1 LowCVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N
Updated
2026-12-04
NVDCVSS 4.02.1

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.

Record
CVE-2026-128360
CVSS 4.0
2.1 LowCVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Weakness
CWE-863
Updated
2026-12-04
OSVCVSS 4.02.1

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

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.

Record
CVE-2026-128360
CVSS 4.0
2.1 LowCVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N
Weakness
CWE-863
Updated
2026-12-04
OSVEEF-CVE-2026-128360CVSS 4.02.1

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

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…

Record
EEF-CVE-2026-128360
CVSS 4.0
2.1 LowCVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N
Weakness
CWE-863
Updated
2026-12-04

The JSON record also has the rest of 1 source description.

History

Recorded by Every CVE

Changes recorded by Every CVE
DayChangedSources
ReferencesOSV
ReferencesOSV
Other IDs, published dateEUVD
SeverityNVD
Affected packages, other IDs, key facts, referencesOSV
First indexedCVE List

Upstream dates may differ.

References

MoveEnter Open