Status: Patched
This vulnerability has been verified as resolved and deployed.

SQL Injection via queueName in getDatabaseQueuesMetrics
Summary
SQL Injection via queueName in getDatabaseQueuesMetrics
getDatabaseQueuesMetrics builds SQL statements with queueName interpolated directly into table identifiers and literals. The queueName value originates from the route parameter (/integrations/queues/queues/:queueName) which is attacker-controllable. No validation or quoting is applied before the SQL is sent to executeSql, allowing crafted queue names to break out of the identifier context and execute arbitrary SQL statements against the project database.
CVSS Score
Vulnerability Location
Sink-to-Source Analysis
getDatabaseQueuesMetrics invokes executeSql with a SQL string built from the queue name.
Queue name flows into preciseMetricsSqlQuery without validation.
The template literal concatenates queueName directly into the identifier, enabling injection.
queueName originates from the URL parameter, which can be controlled by attackers.
Impact Analysis
Critical Impact
Arbitrary SQL execution, including data exfiltration, table deletion, privilege escalation, or extension installation.
Attack Surface
Supabase Studio queue detail pages (/project/<ref>/integrations/queues/queues/:queueName) loaded by authenticated project members—the route binds the attacker-controlled queueName directly into privileged executeSql calls.
Preconditions
The attacker needs a regular user account to craft URLs or entice an administrator to click the link. The target user must have access to the queue metrics page (standard for project members).
Proof of Concept
Environment Setup
Requirements: Ubuntu 22.04 LTS (or any OS with Node.js 18+, npm, and git installed).
Install dependencies:
Target Configuration
The Studio app runs on http://localhost:3000. Ensure your Supabase backend is configured (or mock the API). For PoC, a development project with queues enabled is sufficient.
Exploit Delivery
Authenticate as any tenant user with access to the project dashboard.
Manually craft the queue URL without creating such a queue:
To reproduce the production-reported slowdown, first create a disposable queue named foo via Add queue, then browse directly to the crafted queue detail route. Supply this queueName payload to UNION in a pg_sleep(50) call:
Hosted dashboard URL template:
For write-oriented exploitation, UNION in a direct call to pgmq.send to enqueue attacker data without interacting with the UI:
Raw queueName value:
Encoded payload and dashboard URL:
Outcome
Observed effects range from destructive DDL (dropping public.users), to prolonged availability impact via pg_sleep, to silent data integrity violations by writing arbitrary messages into tenant queues.
Expected Response:
When the page loads, Studio invokes getDatabaseQueuesMetrics, executing the SQL:
The pg_sleep(50) payload keeps the request inflight for ~50 seconds, demonstrating a trivial blocking DoS. The pgmq.send UNION returns a synthesized queue row containing the injected JSON, proving arbitrary SQL that enqueues attacker-controlled messages.
