Am I affected?

type your ash_postgres version to check

Description

Incorrect Authorization vulnerability in ash-project ash_postgres allows a user to load destination records linked to a source record only through another tenant's join rows.

When a many_to_many relationship, or a through relationship, is loaded with a lateral join (for example with a per-record limit or sort), AshPostgres.DataLayer builds the query for the join resource, and for each resource along a through path, in lateral_join_query/3 and through_step_queries/4 without running that resource's read action, which is where attribute multitenancy is applied. When those resources use strategy :attribute multitenancy, rows belonging to other tenants were joined, so the load returned destination records that the caller's tenant is not related to.

This issue affects ash_postgres: from 0.38.0 before 2.15.2.

Weaknesses & attack patterns

Weakness

CWE-863 · Incorrect Authorization in catalog → MITRE ↗

Attack patterns

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

A user of one tenant loading a many_to_many or through relationship receives destination records linked only through another tenant's join rows.

Affected — Hex / ash_postgres Hex.pm ↗ Repository ↗

≥ 0.38.0 < 2.15.2 affected
every other version: unaffected
cpe cpe:2.3:a:ash-project:ash_postgres:*:*:*:*:*:*:*:*
version type semver
modules · source files · routines
modules 'Elixir.AshPostgres.DataLayer'
source files lib/data_layer.ex
routines 'Elixir.AshPostgres.DataLayer':lateral_join_query/3 · 'Elixir.AshPostgres.DataLayer':through_step_queries/4 · 'Elixir.AshPostgres.DataLayer':run_query_with_lateral_join/4

Affected — GitHub / ash-project/ash_postgres Repository ↗

≥ 7115bec < 8c25c94 affected
every other version: unaffected
cpe cpe:2.3:a:ash-project:ash_postgres:*:*:*:*:*:*:*:*
version type git
modules · source files · routines
modules 'Elixir.AshPostgres.DataLayer'
source files lib/data_layer.ex
routines 'Elixir.AshPostgres.DataLayer':lateral_join_query/3 · 'Elixir.AshPostgres.DataLayer':through_step_queries/4 · 'Elixir.AshPostgres.DataLayer':run_query_with_lateral_join/4

Configurations

Reachable when the join resource of a many_to_many relationship, or a resource along a through path, uses attribute multitenancy and holds rows from several tenants, and the relationship is loaded with a lateral join (for example with a limit, offset or sort on the relationship).

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