CVE-2026-77367: Unauthenticated SQL Injection in Daptin Entity Listing Endpoints
Vulnerability ID: CVE-2026-77367
CVSS Score: 9.4
Published: 2026-11-20
An unauthenticated SQL injection vulnerability exists in Daptin prior to version 0.12.30. The generic entity listing handler fails to validate user-supplied sort parameters against the table schema before passing them to the goqu SQL query builder, enabling remote attackers to break out of SQL identifier quoting and execute arbitrary SQL subqueries.
TL;DR
Daptin versions below 0.12.30 allow unauthenticated remote attackers to inject arbitrary SQL syntax via the sort query parameter on any GET /api/{entity} endpoint due to missing schema validation and improper identifier quoting in goqu.I().
⚠️ Exploit Status: POC
Technical Details
- CVE / GHSA ID: CVE-2026-77367 / GHSA-hq2p-f2vj-v3cm
- Weakness Class: CWE-89 (SQL Injection) / CWE-20 (Improper Input Validation)
- CVSS v3.1 Score: 9.4 Critical (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H)
- Attack Vector: Unauthenticated HTTP GET request to /api/{entity}?sort=...
- Affected Component: PaginatedFindAllWithoutFilters in server/resource/resource_findallpaginated.go
- Affected / Fixed Versions: Affected: < 0.12.30 | Patched: >= 0.12.30
- CISA KEV Status: Not Listed
Affected Systems
- Daptin Headless CMS (< 0.12.30)
-
Daptin: < 0.12.30 (Fixed in:
0.12.30)
Code Analysis
Commit: b0bcc13
fix SQL injection in entity sort parameter
File: server/resource/resource_findallpaginated.go
@@ -183,6 +183,37 @@ type column struct {
reference string
}
+func (dbResource *DbResource) validateSortOrder(sortOrder []string) ([]string, error) {
+ validSortOrder := make([]string, 0, len(sortOrder))
+
+ for _, sort := range sortOrder {
+ if len(sort) == 0 {
+ continue
+ }
+
+ direction := ""
+ columnName := sort
+ if columnName[0] == '-' || columnName[0] == '+' {
+ direction = columnName[:1]
+ columnName = columnName[1:]
+ }
+ if len(columnName) == 0 {
+ log.Warnf("Table [%v] invalid sort column [%v]", dbResource.model.GetName(), sort)
+ return nil, fmt.Errorf("table [%v] invalid sort column [%v]", dbResource.model.GetName(), sort)
+ }
+
+ columnInfo, ok := dbResource.tableInfo.GetColumnByName(columnName)
+ if !ok {
+ log.Warnf("Table [%v] invalid sort column [%v]", dbResource.model.GetName(), columnName)
+ return nil, fmt.Errorf("table [%v] invalid sort column [%v]", dbResource.model.GetName(), columnName)
+ }
+
+ validSortOrder = append(validSortOrder, direction+columnInfo.ColumnName)
+ }
+
+ return validSortOrder, nil
+}
+
// PaginatedFindAll(req Request) (totalCount uint, response Responder, err error)
func (dbResource *DbResource) PaginatedFindAllWithoutFilters(req api2go.Request, transaction *sqlx.Tx) (
[]map[string]interface{}, [][]map[string]interface{}, *PaginationData, bool, error) {
@@ -311,6 +342,11 @@ func (dbResource *DbResource) PaginatedFindAllWithoutFilters(req api2go.Request,
sortOrder = []string{"-created_at"}
}
+ sortOrder, err = dbResource.validateSortOrder(sortOrder)
+ if err != nil {
+ return nil, nil, nil, false, err
+ }
+
var filters []string
if len(req.QueryParams["filter"]) > 0 && len(queries) == 0 {
@@ -933,9 +969,6 @@ func (dbResource *DbResource) PaginatedFindAllWithoutFilters(req api2go.Request,
orders = append(orders, goqu.I(prefix+so[1:]).Asc())
} else {
ord := prefix + so
- if strings.ToLower(so) == "rand()" || strings.ToLower(so) == "random()" {
- ord = so
- }
// queryBuilder = queryBuilder.OrderBy(ord)
// countQueryBuilder = countQueryBuilder.OrderBy(ord)
orders = append(orders, goqu.I(ord).Asc())
Mitigation Strategies
- Upgrade Daptin to version 0.12.30 or higher to enforce schema-level allowlist validation on sort parameters.
- Deploy Web Application Firewall (WAF) or reverse proxy rules enforcing strict alphanumeric and underscore validation on the sort query parameter.
- Restrict unauthenticated network access to /api/{entity} endpoints where public data retrieval is not explicitly required.
Remediation Steps:
- Identify all deployed Daptin instances running versions prior to 0.12.30.
- Download and deploy the patched Daptin release v0.12.30 (or build from commit b0bcc1318832b9055781f032853ef9d2264652cf or later).
- Verify that client applications do not rely on deprecated sort=rand() or sort=random() expressions.
- Audit application and database logs for HTTP 500 errors or requests to /api/* containing backticks, double quotes, or SQL keywords in the sort query string.
References
- GitHub Security Advisory GHSA-hq2p-f2vj-v3cm
- Fix Commit: validateSortOrder in server/resource/resource_findallpaginated.go
- Daptin Release v0.12.30
- NVD Entry for CVE-2026-77367
- CVE.org Record for CVE-2026-77367
- CVEProject cvelistV5 Record for CVE-2026-77367
Read the full report for CVE-2026-77367 on our website for more details including interactive diagrams and full exploit analysis.
Top comments (0)