/

CVE-2026-67579

Severity:

HIGH RISK

(7.4)

SQL Injection (CWE-89) in Ash Framework Pagination

CVE-2026-67579

Analyzed

Vulnerability type

Category:

Injection

CWE:

CWE-89, CWE-502

Impact:

SQL Injection and Code Execution

Severity:

HIGH RISK

(7.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Ash contains an unsafe keyset-pagination cursor handling issue that lets an unauthenticated attacker inject an expression through a forged page cursor. Depending on the configured data layer, this may result in SQL injection or execution of attacker-controlled function calls within the application process.

Affected context

The vulnerability occurs in Ash read actions that use keyset pagination and accept client-supplied page[:after] or page[:before] cursors. It is relevant when the cursor is decoded and incorporated into filters without the same expression visibility checks applied to expressions created through the normal Ash API. AshPostgres may inline the resulting expression into SQL, while ETS and Simple data layers may evaluate it in-process.

Exploit preconditions

  • Attack surface: Publicly reachable Ash read actions using keyset pagination
  • Required access: No authentication may be required when the affected read action is exposed to unauthenticated clients
  • Trigger point: Decoding and processing a forged page[:after] or page[:before] cursor
  • Why exploitation is possible: The cursor decoder permits certain already-interned Ash struct values, allowing an expression to bypass normal public/private expression checks and enter keyset filter processing
  • Data-layer dependency: The resulting impact depends on whether the application uses AshPostgres, ETS, Simple, or another affected data layer

Why this happens

The issue combines unsafe deserialization with expression injection. Although non_executable_binary_to_term/2 is invoked with safe-mode restrictions, those restrictions do not prevent construction of certain structs from atoms already present in the running application. A forged cursor can therefore carry an Ash.Query.Call expression that bypasses the normal Ash.Expr validation path. The expression is then treated as a filter value and evaluated or incorporated into a query, mapping to CWE-502: Deserialization of Untrusted Data and CWE-89: Improper Neutralization of Special Elements used in an SQL Command.

Potential impact

  • An attacker may alter query behavior or access data outside the intended result set
  • An attacker could inject SQL expressions when the AshPostgres data layer is used
  • An attacker may cause arbitrary function calls within the application process on affected in-process data layers
  • Application confidentiality, integrity, or availability could be affected
  • Database or application credentials may be exposed if the compromised process has access to them

General mitigation guidance

Mitigation generally focuses on treating pagination cursors as strictly untrusted data and preventing serialized values from becoming executable query expressions.

Defensive patterns include:

  • Use a narrowly defined, schema-validated cursor format containing only expected scalar pagination values
  • Reject structs, function references, expression nodes, and unexpected terms before filter construction
  • Ensure cursor-derived values cannot bypass the same authorization and expression-visibility checks used by normal query APIs
  • Prefer parameterized database queries and typed query builders that keep values separate from SQL syntax
  • Limit database and application-process privileges so a compromised query path has reduced reach
  • Avoid exposing keyset-paginated actions anonymously unless the returned data and query capabilities are intentionally public

How teams detect issues like this

Detection can combine application review, static analysis, and runtime policy controls:

  • Search for deserialization of client-controlled pagination tokens or cursors
  • Review code paths where decoded terms are converted into query expressions, filters, or function calls
  • Flag use of broad term decoding, dynamic struct reconstruction, or cursor formats that preserve internal framework objects
  • Add tests using malformed, unexpected, and structurally valid-but-unauthorized cursor values
  • Monitor database queries for unexpected predicates, functions, or changes in query shape associated with pagination requests
  • Apply policy checks requiring explicit cursor schemas and forbidding executable or framework-internal terms in external request data

Automated security review tools may help identify unsafe deserialization and query-construction patterns, but framework-specific validation remains important.

Sources

SourceLink
cna.erlef.orgcna.erlef.org/cves/CVE-2026-67579.html
github.comgithub.com/ash-project/ash/commit/91874dd5435bc0ffebd8a254acfa573b39b74520
github.comgithub.com/ash-project/ash/security/advisories/GHSA-3gq3-9xm3-c8v3
osv.devosv.dev/vulnerability/EEF-CVE-2026-67579

Frequently asked

questions

Yes, when an Ash read action using keyset pagination is reachable by an attacker. The description indicates that authentication is not inherently required, although application routing and authorization may limit exposure.

The attacker needs the ability to submit a forged page[:after] or page[:before] cursor to an affected read action. No database credentials or server access are necessarily required.

Treat cursors as structured, untrusted data containing only permitted scalar values, and reject internal structs or expression objects before they reach filter or query construction.

Keep deserialized client data separate from executable query representations, enforce authorization and expression checks after decoding, use parameterized queries, and test pagination endpoints with adversarial cursor values.

Find out what's already
exploitable in your codebase.