Am I affected?

type your ash version to check

Description

Incorrect Behavior Order: Validate Before Canonicalize vulnerability in ash-project ash lets an attacker store a case-insensitive string value that violates its length or match constraints.

Ash.Type.CiString.apply_constraints/2 (lib/ash/type/ci_string.ex) validated the max_length, min_length, and match constraints against the value as submitted, while the type case-folds the string (per its casing) for storage and comparison. Because validation ran before folding, an attacker can submit a value whose folded form breaks a constraint but whose original form passes: for example, against a match pattern requiring uppercase, an uppercase value that is stored lowercased persists a value the pattern rejects. The fix case-folds the value at the start of apply_constraints/2, so the constraints are checked against the form that is actually stored.

This issue affects ash: from 1.29.0-rc0 before 3.32.2.

Weaknesses & attack patterns

Weakness

CWE-180 · Incorrect Behavior Order: Validate Before Canonicalize in catalog → MITRE ↗

Attack patterns

CAPEC-267 · Leverage Alternate Encoding MITRE ↗

Affected — Hex / ash Hex.pm ↗ Repository ↗

1.29.0-rc0 < 3.32.2 affected
every other version: unaffected
cpe cpe:2.3:a:ash-project:ash:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Ash.Type.CiString'
source files lib/ash/type/ci_string.ex
routines 'Elixir.Ash.Type.CiString':apply_constraints/2

Affected — GitHub / ash-project/ash Repository ↗

f6f5d19 < d8320b0 affected
every other version: unaffected
cpe cpe:2.3:a:ash-project:ash:*:*:*:*:*:*:*:*
modules · source files · routines
modules 'Elixir.Ash.Type.CiString'
source files lib/ash/type/ci_string.ex
routines 'Elixir.Ash.Type.CiString':apply_constraints/2

References

Credits

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

CVSS breakdown

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