Am I affected?

type your ash_postgres version to check

Description

Unchecked Return Value vulnerability in ash-project ash_postgres allows a user who can drive a tenant rename to a name that collides with an existing tenant's schema to have their tenant record repointed at that other tenant's live schema, gaining access to its data.

AshPostgres.MultiTenancy.rename_tenant/3 issues the ALTER SCHEMA ... RENAME TO ... with the non-raising Ecto.Adapters.SQL.query/2, discards its {:ok, _} | {:error, _} result, and unconditionally returns :ok. PostgreSQL rejects the rename when the target schema already exists (and on insufficient privilege or lock timeout), but that failure never reaches the caller. The calling manage_tenant update action therefore sees success and commits the tenant row with the new name, which is the schema of a different existing tenant, so subsequent reads and writes for that tenant run against the other tenant's data.

This issue affects ash_postgres: from 0.25.0 before 2.13.0.

Weaknesses & attack patterns

Weakness

CWE-252 · Unchecked Return Value in catalog → MITRE ↗

Attack patterns

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

Affected — Hex / ash_postgres Hex.pm ↗ Repository ↗

0.25.0 < 2.13.0 affected
every other version: unaffected
cpe cpe:2.3:a:ash-project:ash_postgres:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.AshPostgres.MultiTenancy'
source files lib/multitenancy.ex
routines 'Elixir.AshPostgres.MultiTenancy':rename_tenant/3

Affected — GitHub / ash-project/ash_postgres Repository ↗

03510da < 8544ab1 affected
every other version: unaffected
cpe cpe:2.3:a:ash-project:ash_postgres:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.AshPostgres.MultiTenancy'
source files lib/multitenancy.ex
routines 'Elixir.AshPostgres.MultiTenancy':rename_tenant/3

Configurations

An application must run ash_postgres schema-based multitenancy with a user-driven tenant rename (for example a manage_tenant update on an editable org slug or subdomain), letting a user choose a new tenant name that collides with an existing tenant's schema.

References

Credits

Peter Ullrich Finder Reporter
Zach Daniel / Ash Project Remediation developer
Jonatan Männchen / EEF Coordinator

CVSS breakdown

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