Skip to content

@cubejs-backend/api-gateway row level security bypass

High severity GitHub Reviewed Published Dec 9, 2022 in cube-js/cube • Updated Jan 28, 2023

Package

npm @cubejs-backend/api-gateway (npm)

Affected versions

= 0.31.23

Patched versions

0.31.24

Description

Impact

All authenticated Cube clients could bypass row-level security and run arbitrary SQL via the newly introduced /v1/sql-runner endpoint.

Patches

The change has been reverted in 0.31.24

Workarounds

Upgrade to >=0.31.24 or downgrade to <=0.31.22

Post mortem

As part of implementing the Cube Cloud SQL runner functionality, we’ve added a new endpoint to the Cube Core so that we could add arbitrary queries directly to the queue, bypassing the modeling layer.

The endpoint was added in this commit: cube-js/cube@f1e25bb

It went through the code review; however, it slipped everyone’s attention that this endpoint completely bypasses any row-level security logic implemented in the modeling layer. Now anyone with a valid Cube JWT token could fetch any data, even if they were not allowed to do so by their security context.

The issue was noticed by the Core team on Dec 12 and immediately reverted.

The just-released 0.31.23 version of the Cube has been pulled out of all the registries, and a CVE was published on Github.
Another change (cube-js/cube@2c5db32) was also rolled back along with the SQL runner endpoint. It didn't pose a significant security threat, but it increased the attacker’s ability to enumerate cube schema, and it should be revisited.

The 0.31.24 was released to replace the revoked version with a change completely reverted. All customers are urged to upgrade to the newest Cube version.

References

@bsod90 bsod90 published to cube-js/cube Dec 9, 2022
Published by the National Vulnerability Database Dec 9, 2022
Published to the GitHub Advisory Database Dec 12, 2022
Reviewed Dec 12, 2022
Last updated Jan 28, 2023

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N

EPSS score

0.178%
(55th percentile)

Weaknesses

CVE ID

CVE-2022-23510

GHSA ID

GHSA-6jqm-3c9g-pch7

Source code

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.