Am I affected?

type your ash version to check

Description

Incorrect Authorization vulnerability in ash-project ash allows an actor to read, update and destroy records that a runtime policy check forbids.

A policy check decided against the records (check/4) reads their attributes, but Ash did not always give it them. On a read that selected fewer attributes, Ash.Policy.Authorizer (lib/ash/policy/authorizer/authorizer.ex) passed the records with the other attributes as %Ash.NotLoaded{}, which is truthy. On an update or destroy, Ash.Can (lib/ash/can.ex) read the record again with an empty select, so on a data layer that honors select the check saw only the primary key and attribute defaults. A check that reads such an attribute decided on the placeholder or the default.

This issue affects ash: from 3.4.44 before 3.39.0.

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 that can narrow the attributes a read selects, such as through a GraphQL query, reads records a runtime policy check should hide; on a SQL data layer, an actor updates or destroys records the check should protect.

Affected — Hex / ash Hex.pm ↗ Repository ↗

≥ 3.4.44 < 3.39.0 affected
every other version: unaffected
cpe cpe:2.3:a:ash-project:ash:*:*:*:*:*:*:*:*
version type semver
modules · source files · routines
modules 'Elixir.Ash.Policy.Authorizer' · 'Elixir.Ash.Can'
source files lib/ash/policy/authorizer/authorizer.ex · lib/ash/can.ex
routines 'Elixir.Ash.Policy.Authorizer':check_fact/2 · 'Elixir.Ash.Can':run_changeset_query/5 · 'Elixir.Ash.Can':run_queries/5

Affected — GitHub / ash-project/ash Repository ↗

≥ f4a8ff5 < 58e4243 affected
every other version: unaffected
cpe cpe:2.3:a:ash-project:ash:*:*:*:*:*:*:*:*
version type git
modules · source files · routines
modules 'Elixir.Ash.Policy.Authorizer' · 'Elixir.Ash.Can'
source files lib/ash/policy/authorizer/authorizer.ex · lib/ash/can.ex
routines 'Elixir.Ash.Policy.Authorizer':check_fact/2 · 'Elixir.Ash.Can':run_changeset_query/5 · 'Elixir.Ash.Can':run_queries/5

Workarounds

Write the check as an expr(...) filter check, which reads the rows again itself and is not affected.

Configurations

Reachable when a policy uses a custom check whose check/4 reads a record attribute (under access_type :runtime, or with a strict_check/3 that returns :unknown), and either the caller can narrow the select of the read, as a GraphQL selection in AshGraphql, a sparse fieldset in AshJsonApi or Ash.Query.select/2 does, or the check guards an update or destroy on a data layer that honors select, such as AshPostgres, from 3.33.0.

References

Credits

Glenn Rempe Finder Reporter Remediation developer
Zach Daniel / Ash Project Remediation developer

CVSS breakdown

CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/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
High
Availability
None

Subsequent Systems

Confidentiality
None
Integrity
None
Availability
None
« All CVEs