Skip to content

Daptin: SQL injection via unvalidated goqu.L() calls in aggregate API

High severity GitHub Reviewed Published Apr 18, 2026 in daptin/daptin • Updated Apr 22, 2026

Package

gomod github.com/daptin/daptin (Go)

Affected versions

< 0.11.4

Patched versions

0.11.4

Description

Summary

The /aggregate/:typename endpoint accepted column and group query parameters that were passed verbatim to goqu.L() — a raw SQL literal expression builder — without any validation. This bypassed all parameterization and allowed authenticated users with any valid session to inject arbitrary SQL expressions.

Impact

An authenticated low-privilege user could:

  • Extract data from any table via subquery: (SELECT group_concat(email) FROM user_account) as leak
  • Disclose database internals: sqlite_version(), (SELECT sql FROM sqlite_master)
  • Exfiltrate cross-table data via correlated subqueries

The vulnerability was confirmed locally; user_account.email values were extracted via a crafted column parameter by a non-admin user.

Root Cause

goqu.L(userInput) in server/resource/resource_aggregate.go inserted user-supplied query parameters directly into the SQL string with no validation.

Fix (v0.11.4)

All goqu.L() calls on user-controlled input were eliminated and replaced with:

  • Structural expression parsing supporting all documented API forms
  • Schema-based column validation (column names checked against entity schema via TableInfo().GetColumnByName())
  • Exact-match allowlist for aggregate functions (count, sum, avg, min, max, first, last) and scalar functions (date, strftime, upper, lower, etc.)
  • Safe goqu constructors (goqu.I(), goqu.SUM(), goqu.Func()) for all generated expressions
  • allowedTables scope enforcement: qualified column refs (table.col) validated against root entity + explicitly joined tables only

Two additional DoS bugs were fixed in the same commit: uuid.MustParse panic on malformed UUID input and an index-out-of-range panic in ToOrderedExpressionArray on empty sort expressions.

Credits

Reported by @VashuVats.

References

@artpar artpar published to daptin/daptin Apr 18, 2026
Published to the GitHub Advisory Database Apr 22, 2026
Reviewed Apr 22, 2026
Last updated Apr 22, 2026

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:L

EPSS score

Weaknesses

Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data. Learn more on MITRE.

CVE ID

CVE-2026-41422

GHSA ID

GHSA-rw2c-8rfq-gwfv

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.