Am I affected?

type your ash version to check

Description

Incorrect authorization vulnerability in Ash allows an actor to read counts, sums and attribute values of related records they cannot read via aggregates.

Ash.Actions.Read (lib/ash/actions/read/read.ex) authorized an aggregate in two passes. Ash.Filter.relationship_filters/7 built a policy filter for each relationship it found an aggregate reading, and authorize_aggregate/11 looked each filter up and applied none when it found none. An aggregate the first pass did not reach ran without its destination's read policy. That covered an aggregate or calculation given as the field: of Ash.aggregate/3, the aggregates inside a calculation used as an aggregate's field, an aggregate in another aggregate's filter, sort or join filter, and an aggregate in a combination or in the sort of an atomic bulk update or destroy. Ash.count/2, Ash.exists/2 and Ash.aggregate/3 also ignored a read policy that is decided against the records, and an aggregate reached on these paths over a multitenant resource required no tenant.

This issue affects ash: from 2.17.22 before 3.39.1.

Weaknesses & attack patterns

Weakness

CWE-863 · Incorrect Authorization in catalog → MITRE ↗

Attack patterns

CAPEC-1 · Accessing Functionality Not Properly Constrained by ACLs MITRE ↗

An actor who may read a record asks for an aggregate over its related records, through Ash.aggregate/3, a stacked aggregate, or a filter or sort on one, and receives counts, sums or attribute values of related records that their read policy hides. Filtering an aggregate on a guessed value makes it a yes or no oracle for any attribute of a hidden record.

Affected — Hex / ash Hex.pm ↗ Repository ↗

≥ 2.17.22 < 3.39.1 affected
every other version: unaffected
cpe cpe:2.3:a:ash-project:ash:*:*:*:*:*:*:*:*
version type semver
modules · source files · routines
modules 'Elixir.Ash.Actions.Read' · 'Elixir.Ash.Actions.Aggregate' · 'Elixir.Ash.Filter' · 'Elixir.Ash'
source files lib/ash/actions/read/read.ex · lib/ash/actions/aggregate.ex · lib/ash/filter/filter.ex · lib/ash.ex
routines 'Elixir.Ash.Actions.Read':authorize_aggregate/11 · 'Elixir.Ash.Actions.Read':handle_multitenancy/1 · 'Elixir.Ash.Actions.Aggregate':run/4 · 'Elixir.Ash.Filter':relationship_filters/7 · 'Elixir.Ash':aggregate/3 · 'Elixir.Ash':count/2 · 'Elixir.Ash':exists/2 · 'Elixir.Ash':read/2

Affected — GitHub / ash-project/ash Repository ↗

≥ a12131c < 42ee441 affected
every other version: unaffected
cpe cpe:2.3:a:ash-project:ash:*:*:*:*:*:*:*:*
version type git
modules · source files · routines
modules 'Elixir.Ash.Actions.Read' · 'Elixir.Ash.Actions.Aggregate' · 'Elixir.Ash.Filter' · 'Elixir.Ash'
source files lib/ash/actions/read/read.ex · lib/ash/actions/aggregate.ex · lib/ash/filter/filter.ex · lib/ash.ex
routines 'Elixir.Ash.Actions.Read':authorize_aggregate/11 · 'Elixir.Ash.Actions.Read':handle_multitenancy/1 · 'Elixir.Ash.Actions.Aggregate':run/4 · 'Elixir.Ash.Filter':relationship_filters/7 · 'Elixir.Ash':aggregate/3 · 'Elixir.Ash':count/2 · 'Elixir.Ash':exists/2 · 'Elixir.Ash':read/2

Configurations

Reachable when a resource has an aggregate over a relationship whose destination has a stricter read policy than the resource itself, and one of these holds: a caller can choose the field or the query: of an aggregate given to Ash.aggregate/3 (directly, through ash_lua read operations, or through the AshAi aggregate result type); the application defines an aggregate whose field is a calculation that uses an aggregate; or a caller can filter or sort on an aggregate that is the field, filter or sort of another aggregate. Ash.count/2, Ash.exists/2 and Ash.aggregate/3 over a resource whose own read policy is decided against the records are affected without further conditions.

References

Credits

Glenn Rempe Finder Reporter Remediation developer Remediation reviewer
Paul Schoenfelder Remediation developer
Zach Daniel / Ash Project Remediation reviewer

CVSS breakdown

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

Exploitability

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
None

Vulnerable System

Confidentiality
High
Integrity
None
Availability
None

Subsequent Systems

Confidentiality
None
Integrity
None
Availability
None
« All CVEs