Skip to content

Database queries ​

Internal flows to a database are decoded as the hub assembles them. A request's story then shows not only that the service talked to its database, but what it asked and what came back: the injected UNION SELECT, and the row with the flag in it.

This needs internal capture on the vulnbox, so the service's own connections to its database are captured. To look at the database's current contents instead, use the database browser.

Protocols ​

DatabaseNotes
PostgreSQLalso replication to replicas and change-data-capture consumers
MySQL, MariaDBalso MySQL's X protocol
Redis, Valkey
MongoDB
Memcachedtext and binary
SQL ServerTDS
ClickHouseits native protocol and its HTTP interface

The hub recognises them by what the client and server send first, wherever they listen, and undoes the compression they use.

What a query holds ​

Each request the service made is a query: the statement as sent, its bound parameters (with their values, decoded from the protocols' binary formats too), the database and user, how long the answer took, and the answer: the rows it changed or returned (the first of them shown as text), or the error. For a replication stream, each change sent to the replica is a query of its own.

"This request read the flag from the database." When a value the database returned holds a flag, the query is marked and the flow gets the built-in tag db-flag-read, even when the service then sends the flag out encoded, compressed or not at all.

In the hub ​

The Queries tab of a PostgreSQL flow: a connect with the login as sent, then a UNION SELECT query marked flag in result, with its rows.The Queries tab of a PostgreSQL flow: a connect with the login as sent, then a UNION SELECT query marked flag in result, with its rows.
A database flow's Queries tab: the injected UNION SELECT returned the flag.
  • A flow's Queries tab shows each query as a card: kind, status, timing, the statement and its parameters, the error, and what came back as a small table of the first rows (column names on top for the SQL protocols and ClickHouse), with a raw text switch and a note when rows were left out. The buttons above the cards show only the errors, only the unanswered queries, or only those whose result held a flag. Open in browser opens the statement in the database browser, read-only, without running it.
  • A request's Story shows each query it caused, with its result or error, in time order; a run of the same statement is folded into one row.
  • Host → Activity groups the service's queries by shape, the statement with its values replaced by ?, so the hundred variants of SELECT … WHERE id = ? are one line, and a shape never seen before stands out as new.

Filters ​

ChipExample
statement contains, or matches a regexdbq.contains:UNION
protocoldbproto:postgres
failed query, optionally with its error codedberr:42601
returned a flagdbflag:

In the flow list these chips also match a request through the database flows it caused: with external only on, dbq.contains:UNION lists the requests whose backend sent such a query, and the request's chip opens its story at the matching database flow (see Linked flows).

Limits ​

  • Logins are recorded as sent, passwords and authentication exchanges included: who logged in with what is part of the evidence.
  • A connection that switches to TLS cannot be read, and says so. For a service whose database connection is encrypted, only the fact that it talked to the database shows.
  • The raw bytes of every internal flow are kept as captured either way.