Am I affected?

type your ash_authentication version to check

Description

Inefficient Algorithmic Complexity vulnerability in team-alembic AshAuthentication allows an unauthenticated attacker to exhaust CPU and memory via an oversized base62 segment in a submitted API key.

AshAuthentication.Base.decode62/1 in lib/ash_authentication/base.ex splits its argument into one binary per character and folds it with charval62/2, which recomputes Integer.pow(62, index) at every position instead of accumulating by Horner's method, so cost grows roughly cubically in the input length. bindecode62/1 in the same module is quadratic through Integer.undigits/2 and Integer.digits/2. Neither function caps byte_size/1, and AshAuthentication.Strategy.ApiKey.SignInPreparation passes the underscore-separated segments of the submitted key straight into both, before any key lookup and without prior authentication. The surrounding rescue clauses catch exceptions, not CPU or memory exhaustion.

This issue affects ash_authentication: from 4.8.0 before 4.15.0 and from 5.0.0-rc.0 before 5.0.0-rc.14.

Weaknesses & attack patterns

Weakness

CWE-407 · Inefficient Algorithmic Complexity in catalog → MITRE ↗

Attack patterns

CAPEC-130 · Excessive Allocation MITRE ↗

Affected — Hex / ash_authentication Hex.pm ↗ Repository ↗

4.8.0 < 4.15.0 affected
5.0 series 5.0.0-rc.0 < 5.0.0-rc.14 affected
every other version: unaffected
cpe cpe:2.3:a:team-alembic:ash_authentication:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.AshAuthentication.Base' · 'Elixir.AshAuthentication.Strategy.ApiKey.SignInPreparation'
source files lib/ash_authentication/base.ex · lib/ash_authentication/strategies/api_key/sign_in_preparation.ex
routines 'Elixir.AshAuthentication.Base':decode62/1 · 'Elixir.AshAuthentication.Base':bindecode62/1 · 'Elixir.AshAuthentication.Strategy.ApiKey.SignInPreparation':prepare/3

Affected — GitHub / team-alembic/ash_authentication Repository ↗

f3a53f4 and up affected
d5a5d4c not affected
dfb19c8 not affected
every other version: unaffected
cpe cpe:2.3:a:team-alembic:ash_authentication:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.AshAuthentication.Base' · 'Elixir.AshAuthentication.Strategy.ApiKey.SignInPreparation'
source files lib/ash_authentication/base.ex · lib/ash_authentication/strategies/api_key/sign_in_preparation.ex
routines 'Elixir.AshAuthentication.Base':decode62/1 · 'Elixir.AshAuthentication.Base':bindecode62/1 · 'Elixir.AshAuthentication.Strategy.ApiKey.SignInPreparation':prepare/3

References

Credits

Peter Ullrich Reporter
James Harton Remediation developer
Jonatan Männchen / EEF Analyst

CVSS breakdown

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