Am I affected?

type your ash version to check

Description

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 has_many relationship declared with through: was loaded for a single record with a limit of 1, or an unsorted has_one through relationship was loaded with a limit of 1, lateral_join?/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 accessing_from, 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.

Weaknesses & attack patterns

Weakness

CWE-863 · Incorrect Authorization in catalog → MITRE ↗

Attack patterns

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

A client paging a through relationship field with a limit of 1 reads destination records that should only be reachable through that relationship.

Affected — Hex / ash Hex.pm ↗ Repository ↗

≥ 3.24.0 < 3.37.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.Relationships'
source files lib/ash/actions/read/relationships.ex
routines 'Elixir.Ash.Actions.Read.Relationships':lateral_join?/4 · 'Elixir.Ash.Actions.Read.Relationships':load/4

Affected — GitHub / ash-project/ash Repository ↗

≥ 24f41e2 < e374633 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.Relationships'
source files lib/ash/actions/read/relationships.ex
routines 'Elixir.Ash.Actions.Read.Relationships':lateral_join?/4 · 'Elixir.Ash.Actions.Read.Relationships':load/4

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 (accessing_from) or are otherwise open to the caller.

References

Credits

Will Townsend Finder Reporter
Zach Daniel / Ash Project Remediation developer

CVSS breakdown

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