Summary
A SQL injection vulnerability in kykms's SqlInjectionUtil component allows attacker-controlled column input to influence dynamically generated database queries. When the affected ordering functionality is reachable with insufficiently trusted input, a remote attacker may alter query behavior or access and modify database data.
Affected context
The issue occurs in the QueryGenerator.doMultiFieldsOrder function within QueryGenerator.java, where the column argument contributes to SQL generation. Deployments may be at risk when this functionality processes remotely supplied or indirectly controlled values without strict allowlisting and when the resulting query is executed with broader database privileges than required.
Exploit preconditions
- Attack surface: A remotely reachable application feature that uses the SqlInjectionUtil ordering functionality
- Required access: Ability to submit or influence the value of the
columnargument, potentially through an unauthenticated or authenticated request depending on the surrounding application - Trigger point: Query construction or execution through
QueryGenerator.doMultiFieldsOrder - Why exploitation is possible: Untrusted input is incorporated into SQL structure without sufficiently restricting it to approved column identifiers
Why this happens
The underlying bug is improper neutralization of externally influenced input used in SQL statement construction. Dynamic identifiers such as column names cannot generally be made safe through ordinary value parameterization alone; they require strict mapping to known-safe fields before query generation. This behavior maps primarily to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection) and is also related to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component.
Potential impact
- An attacker may alter query logic or filtering behavior.
- Unauthorized database records may be disclosed.
- Data may be modified, deleted, or corrupted.
- Database credentials or metadata may be exposed depending on permissions.
- Application availability could be affected through resource-intensive queries.
General mitigation guidance
Mitigation generally centers on reducing trust in dynamic query inputs and ensuring database operations use the least privilege necessary.
Common defensive patterns include:
- Map externally supplied sort and column names to a fixed allowlist of internal identifiers.
- Use parameterized queries for values wherever the database interface supports them.
- Keep query structure separate from user-controlled data.
- Reject unknown, ambiguous, or malformed column selections before query generation.
- Apply least-privilege database roles and limit write permissions for read-oriented features.
- Enforce consistent validation at service boundaries rather than relying only on callers.
- Avoid exposing detailed database errors to remote users.
How teams detect issues like this
Organizations can look for this vulnerability through:
- Static analysis rules identifying string concatenation or templating of request-derived values into SQL.
- Code review signals such as dynamic
ORDER BYor field-selection logic without an explicit allowlist. - Tests that verify rejected identifiers cannot alter generated query structure.
- Runtime monitoring for anomalous query shapes, unexpected database errors, and unusual access patterns.
- Policy enforcement requiring parameterized database access and approved query-builder patterns.
- Neutral automated security and code-review tools that flag SQL construction from untrusted sources.

