Summary
Daptin's generic list endpoint uses attacker-controlled sort values when building SQL identifiers without checking them against the table schema. An unauthenticated attacker may exploit this behavior to access unauthorized table data or repeatedly cause query failures when the endpoint is reachable.
Affected context
The issue occurs in Daptin's generic GET /api/{entity} list endpoint, where pagination and sorting logic constructs SELECT and ORDER BY identifiers from requested sort values. Deployments may be at risk when this endpoint is reachable and those values are incorporated into SQL without safe identifier handling or schema validation.
Exploit preconditions
- Attack surface: The generic
GET /api/{entity}list endpoint - Required access: The description indicates that authentication is not required
- Trigger point: A list request that supplies attacker-controlled sort values
- Why exploitation is possible: Sort values are used to construct SQL identifiers without validating them against the table schema, allowing identifier quoting to be disrupted
Why this happens
The underlying issue is insufficient validation and unsafe construction of SQL identifiers from untrusted input. An embedded identifier quote can change how the database parses the constructed query. This maps primarily to CWE-89: SQL Injection and is also related to CWE-20: Improper Input Validation. SQL parameters generally protect values, but identifiers such as column names require separate allowlisting or safe identifier handling.
Potential impact
- An attacker may extract unauthorized table data through blind or error-based behavior
- Repeated malformed queries could cause query failures or disrupt endpoint availability
- Exposed data could contribute to further compromise, depending on its sensitivity and the deployment's controls
General mitigation guidance
Defensive patterns focus on ensuring untrusted input cannot control SQL structure:
- Accept sort fields only from an explicit allowlist derived from permitted schema fields
- Use database-library support for safely quoting identifiers where available; value parameterization alone may not protect identifiers
- Validate sort direction and other query options against narrow, documented choices
- Keep database credentials and permissions limited to the data and operations the application needs
- Prefer secure-by-default query-building abstractions that separate SQL structure from user-supplied values
How teams detect issues like this
- Use static analysis to identify SQL statements whose identifiers or clauses are assembled from request parameters
- Review list, sorting, and pagination code for missing schema allowlists and unsafe identifier construction
- Enforce code-review or CI policies requiring safe query-building patterns for database access
- Monitor for unusual sorting parameters, database syntax errors, and repeated failed list queries

