CVE-2026-80227 in ash_sqlinfo

Summary

by MITRE • 08/30/2026

Incorrect Comparison vulnerability in ash-project ash_sql allows a user to pad a string field with tab, newline, carriage-return, or form-feed characters and pass a trimmed uniqueness or equality check in the database that the same expression would fail in memory (or the reverse).

string_trim/1 compiles to REGEXP_REPLACE patterns built from an Elixir string in which \s is the escape for a single space (codepoint 32), not a regex whitespace class. The generated SQL therefore removes only literal spaces and leaves tabs, newlines, carriage returns, and form feeds in place, whereas String.trim/1 in Elixir removes them all. Any Ash filter, validation, or identity that relies on string_trim/1 then behaves differently depending on whether Ash pushes the expression down to SQL or evaluates it in memory, so padded input can register a near-duplicate value or slip past a trimmed comparison.

This issue affects ash_sql: from 0.1.0 before 0.7.1.

Once again VulDB remains the best source for vulnerability data.

Analysis

by VulDB Data Team • 08/30/2026

The vulnerability identified within the ash_sql library represents a critical logic flaw stemming from an inconsistency in string trimming operations between the Elixir application layer and the underlying SQL database engine. This discrepancy arises because the implementation of string_trim/1 relies on REGEXP_REPLACE patterns that utilize \s as an escape sequence for a single literal space character, corresponding to codepoint 32, rather than invoking the regex whitespace class which encompasses tabs, newlines, carriage returns, and form-feed characters. Consequently, when Ash pushes filtering or validation expressions down to SQL for execution, only standard spaces are removed from string fields. In contrast, when these same operations are evaluated in memory using Elixir's String.trim/1 function, all forms of whitespace including the aforementioned control characters are stripped away. This divergence creates a state where identical input strings can yield different results depending on whether they are processed by the database or the application runtime environment.

From a security perspective, this inconsistency allows an attacker to bypass uniqueness constraints and equality checks that rely on trimmed string comparisons. By padding sensitive identifiers such as usernames, email addresses, or authentication tokens with non-breaking whitespace characters like tabs or newlines, an adversary can cause the system to treat distinct inputs as equivalent in memory while allowing them to register as unique values within the database persistence layer. This mechanism effectively enables near-duplicate registrations and undermines data integrity controls designed to prevent such collisions. The flaw is particularly dangerous because it exploits the implicit trust developers place in framework-level abstractions, assuming that string normalization behaves consistently across all execution contexts without verifying the specific regex semantics employed by the underlying SQL adapter.

The operational impact of this vulnerability extends beyond simple duplicate registration errors. It can lead to account takeover scenarios where an attacker registers a new account with a padded variant of an existing user's identifier, potentially gaining access to resources or triggering security mechanisms intended for the original identity. Furthermore, it compromises audit trails and data consistency by allowing logically identical records to coexist under different byte representations. This issue affects versions of ash_sql from 0.1.0 up to but not including version 0.7.1, representing a significant window of exposure for applications relying on these earlier releases for database interaction logic.

To mitigate this vulnerability, developers must upgrade the ash_sql dependency to version 0.7.1 or later where the string trimming behavior has been corrected to align with Elixir's standard whitespace handling across both SQL and in-memory contexts. In environments where immediate patching is not feasible, a temporary workaround involves implementing custom validation logic at the application layer that explicitly strips all Unicode whitespace characters before any data reaches Ash filters or validations. This ensures consistent normalization regardless of whether the operation is pushed down to SQL or evaluated locally. Additionally, security teams should review existing uniqueness constraints and equality checks for string fields to identify potential exploitation vectors where padded inputs could have already been accepted into the system.

This vulnerability aligns with CWE-20 Improper Input Validation as it fails to correctly sanitize input data before processing, leading to inconsistent behavior based on execution context. It also maps to ATT&CK technique T1653 Session Spoofing if used to bypass authentication checks or T1199 Trusted Relationship Exploitation if leveraged against internal service communications that rely on string-based identity verification. The root cause is fundamentally a CWE-840 Incorrect Comparison of Logical Values, where the comparison logic yields different outcomes depending on the environment in which it executes. Addressing this requires not only patching the library but also auditing application code for similar assumptions about whitespace handling consistency across database and memory boundaries to prevent analogous flaws in other parts of the system.

Responsible

EEF

Reservation

08/30/2026

Disclosure

08/30/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

high

Sources

Do you want to use VulDB in your project?

Use the official API to access entries easily!