# CVE-2026-81318: ash-project ash_sql authorization bypass in aggregates

Source: https://junglewise.ai/threats/cve-2026-81318-ash-project-ash-sql-authorization-bypass-in-aggregates  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-30. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2026-81318 · Severity: info · Published 2026-08-30

ash_sql is a library for querying data in multi-tenant applications where different customers' data is isolated by database schema. A flaw in aggregate query processing causes the library to compute sums, counts, and other aggregates against the wrong tenant's data when a distinct query is used, exposing one tenant's metrics to another tenant. This could lead to unauthorized disclosure of business-sensitive aggregate information across tenant boundaries.

Technologies: [Ash-Project Ash Sql](https://junglewise.ai/threats/technologies/ash-sql). Vendors: [Ash-Project](https://junglewise.ai/threats/vendors/ash-project).

## Quick answers

**Is CVE-2026-81318 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-81318 being exploited in the wild.

**How severe is CVE-2026-81318?** Informational severity, published 30 August 2026.

**Which products and versions are affected?** Ash-Project Ash Sql 0.1.0 to 0.7.0.

**Is there a fix for CVE-2026-81318?** No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.

**How is CVE-2026-81318 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-81318?** Check whether you run Ash-Project Ash Sql at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

The vulnerability exists in ash_sql's AggregateQuery.add_single_aggs/5 function, which rebuilds the outer query from only the {table, schema} tuple without preserving query.prefix and query.from.prefix—fields that hold the tenant schema in strategy(:context) multitenancy. As a result, the rebuilt outer query reads from the repository's default schema while the inner correlated subquery still reads the tenant's schema; they are joined only on primary key, causing aggregates to be computed against another tenant's rows. The neighbouring limit and exists code branches correctly use subquery/1 to preserve the prefix. The issue affects all versions from 0.1.0 up to and including 0.7.0; version 0.7.1 and later contain the fix.

## Affected products

- ash-project ash_sql 0.1.0 to 0.7.0

## Timeline

- 2026-08-30: disclosed

## References

- [https://repo.hex.pm/](https://repo.hex.pm/)
- [https://github.com/](https://github.com/)

## Related threats

- [ash-project ash_sql incorrect authorization in aggregate queries](https://junglewise.ai/threats/cve-2026-81316-ash-project-ash-sql-incorrect-authorization-in-aggregate-queries)
- [ash-project ash_sql string trim incorrect comparison](https://junglewise.ai/threats/cve-2026-80227-ash-project-ash-sql-string-trim-incorrect-comparison)
- [ash-project ash_sql LIKE wildcard injection in string search](https://junglewise.ai/threats/cve-2026-78691-ash-project-ash-sql-like-wildcard-injection-in-string-search)
- [ash-project ash_sql authorization bypass in exists filter](https://junglewise.ai/threats/cve-2026-77454-ash-project-ash-sql-authorization-bypass-in-exists-filter)
