Description
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.
Published: 2026-08-30
Score: 2.1 Low
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The flaw lies in how ash_sql's string_trim/1 function translates to SQL; it removes only space characters and leaves tabs, newlines, carriage returns, and form feeds untouched, whereas the equivalent Elixir function String.trim/1 removes all whitespace. This discrepancy allows an attacker to pad a string field with hidden whitespace so that a uniqueness or equality check performed at the database level passes while the same check in memory fails, or vice versa. Consequently an attacker can insert duplicate records that the application believes are unique, or bypass validation logic that relies on trimmed comparisons.

Affected Systems

Affected products are the AshSQL library from the AshProject. Versions from 0.1.0 up to (but not including) 0.7.1 contain the flaw. No other vendors or products are listed, and the vulnerability is tied specifically to the ash_sql component.

Risk and Exploitability

The CVSS score is 2.1, reflecting a low severity assessment. No EPSS score is available, and the vulnerability is not listed in the CISA KEV catalog, indicating no confirmed widespread exploitation yet. An attacker could exploit the issue by supplying a string containing hidden whitespace characters through the application's input—or via any API that writes to the relevant database column—and the system may accept duplicate or malformed data. Because the attack requires only normal data insertion, it is likely achievable via normal remote access if the application allows direct input, but the low CVSS indicates that the overall risk to confidentiality or availability is modest. Nonetheless, any use of uniqueness constraints or strict equality checks in your system should be reviewed for this inconsistency.

Generated by OpenCVE AI on August 30, 2026 at 13:23 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade ash_sql to 0.7.1 or newer to receive the patch that aligns SQL trimming with in‑memory trimming.
  • Audit application code that uses string_trim/1 for uniqueness or equality checks, and adjust logic so that trimming is performed consistently in both the database and application memory.
  • Add input validation that strips or rejects hidden whitespace characters before persisting data to ensure that subsequent database and in‑memory comparisons are based on identical strings.

Generated by OpenCVE AI on August 30, 2026 at 13:23 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Sun, 30 Aug 2026 12:00:00 +0000

Type Values Removed Values Added
Description 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.
Title SQL string_trim removes only spaces, diverging from in-memory trimming in AshSql
First Time appeared Ash-project
Ash-project ash Sql
Weaknesses CWE-697
CPEs cpe:2.3:a:ash-project:ash_sql:*:*:*:*:*:*:*:*
Vendors & Products Ash-project
Ash-project ash Sql
References
Metrics cvssV4_0

{'score': 2.1, 'vector': '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'}


Subscriptions

Ash-project Ash Sql
cve-icon MITRE

Status: PUBLISHED

Assigner: EEF

Published:

Updated: 2026-08-30T11:53:35.548Z

Reserved: 2026-08-30T05:45:01.813Z

Link: CVE-2026-80227

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-08-30T12:17:18.710

Modified: 2026-08-30T12:17:18.710

Link: CVE-2026-80227

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-30T13:30:05Z

Weaknesses