NewN-Day-BenchView benchmark
winfunc
Back to Hacktivity

Status: Patched

This vulnerability has been verified as resolved and deployed.

Cube logo
CubeHigh2026-07-27

Presto and Trino filter interpolation bypasses row-level security

Summary

A MySQL string encoder broke Presto/Trino parameter boundaries after access-policy compilation

An ordinary authenticated analytics user could inject Presto/Trino syntax through a semantic string filter, comment out the row-level predicate appended by Cube, and retrieve warehouse rows explicitly denied by the access policy.

Root cause. PrestoDriver.prepareQueryWithParams() used the MySQL-oriented sqlstring encoder, which escaped a quote as \'. Presto and Trino require doubled quotes, so the backend parsed the quote as the end of the literal after RLS compilation but before execution.

Remediation evidence. Cube acknowledged the reports and merged exact PR #11345 on 27 July 2026. The patch replaces wrong-dialect escaping in both the Presto and inherited Trino paths and adds quote-handling regression tests.

CVSS Score

VectorN
ComplexityL
PrivilegesL
User InteractionN
ScopeC
ConfidentialityH
IntegrityN
AvailabilityN
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N

Vulnerability Location

SourceLine 344
packages/cubejs-api-gateway/src/gateway.ts
POST /cubejs-api/v1/load handler
SinkLine 267
packages/cubejs-prestodb-driver/src/PrestoDriver.ts
PrestoDriver.queryPromised()

Source-to-Sink Analysis

1
packages/cubejs-api-gateway/src/gateway.ts:344

The authenticated REST request supplies a semantic query and attacker-controlled string filter value.

TYPESCRIPT
query: req.body.query
2
packages/cubejs-schema-compiler/src/adapter/BaseQuery.js

Cube applies the user's row-level access policy and compiles a statement with a placeholder plus a separate values array.

JAVASCRIPT
const { query, values } = queryWithRlsFilters.buildSqlAndParams();
3
packages/cubejs-prestodb-driver/src/PrestoDriver.ts:267

The driver interpolates the value with MySQL quote rules and submits the resulting SQL text to Presto/Trino.

TYPESCRIPT
const sql = this.prepareQueryWithParams(query, values);
return this.queryPromised(sql);

Impact Analysis

Critical Impact

The attacker can read policy-denied rows available to Cube's server-side warehouse identity, crossing tenant or user boundaries. Compatible UNION reads may widen disclosure, but this entry does not claim database writes or command execution.

Attack Surface

Cube's authenticated data API when a model uses a Presto or Trino data source and row-level access policies protect tenant data.

Preconditions

The attacker has ordinary query access to one modeled member and can control a string filter. They need no administrator privileges or warehouse credentials.

Proof of Concept

Environment Setup

Use an isolated Cube deployment connected to a test Presto or Trino warehouse containing tenant-A and tenant-B marker rows.

Target Configuration

Configure a Cube access policy that restricts the attacker to tenant A while both tenants remain readable to the warehouse service account.

Exploit Delivery

Send /cubejs-api/v1/load with an authenticated semantic query whose string filter contains active') OR true --.

Outcome

PR #11345 emits SQL-standard doubled quotes, keeping the payload inside one string literal and preserving the appended RLS predicate.

Expected Response: The vulnerable driver returns the tenant-B marker even though the compiled Cube policy should exclude it.

Run this level of analysis on your repo.

Winfunc traces source-to-sink paths, validates exploitability, and gives your team patch-ready remediation.

Vulnerability Detection