Summary
Worklenz through version 3.0.0 does not properly validate the sort-field query parameter used by pagination helpers, allowing authenticated users to influence PostgreSQL ORDER BY expressions. This may enable time-based or boolean-based blind SQL injection and unauthorized extraction of sensitive data, including password hashes belonging to other tenants.
Affected context
The vulnerability occurs in Worklenz pagination functionality when a request-controlled sort-field parameter is incorporated into a PostgreSQL ORDER BY clause without sufficient validation. It is particularly risky in multi-tenant deployments where database queries can access records beyond the requesting user's tenant boundary, and represents an incomplete remediation of a prior related issue.
Exploit preconditions
- Attack surface: Authenticated application endpoints that use pagination helpers
- Required access: Valid user credentials and permission to submit requests containing pagination parameters
- Trigger point: Processing of a sort-field query parameter during database query construction
- Why exploitation is possible: The parameter can influence SQL expression handling in an ORDER BY clause, enabling controlled boolean or timing behavior and inference of database contents
Why this happens
The underlying bug is insufficient allowlisting and normalization of a user-controlled value used as a SQL identifier or expression. Instead of mapping accepted sort options to fixed server-side column definitions, the application permits input to affect query syntax, which maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection). Parameter binding alone is generally insufficient for dynamic identifiers or ORDER BY expressions unless the application uses a trusted mapping.
Potential impact
- Attackers may infer sensitive database contents through blind SQL injection
- Password hashes and other credentials may be disclosed
- Data belonging to other tenants could be exposed
- Database confidentiality and tenant isolation may be weakened
- Further attacks may become possible if exposed data supports account compromise
General mitigation guidance
Mitigation generally focuses on ensuring that dynamic ordering is controlled entirely by trusted application logic.
Common defensive patterns include:
- Mapping each accepted sort option to a fixed, server-side column or expression
- Rejecting unknown, malformed, or unexpected sort-field values by default
- Keeping user-controlled input out of SQL syntax and using parameterization for values
- Enforcing tenant-scoped predicates independently of sorting and pagination logic
- Applying least-privilege database permissions and limiting access to credential data
- Maintaining regression tests for previously reported injection paths and related helper functions
How teams detect issues like this
Detection approaches commonly include:
- Static analysis rules for string interpolation or concatenation of request parameters into SQL statements
- Code review checks for dynamic ORDER BY, GROUP BY, column, and table expressions
- Tests using unexpected sort names, boolean variations, and timing-sensitive input in controlled environments
- Database monitoring for anomalous query timing, repeated pagination requests, and cross-tenant access patterns
- Policy enforcement requiring approved allowlists for dynamic SQL identifiers
- Automated security review tools can help identify similar query-construction patterns across pagination helpers

