Summary
No-Cms 1.0 contains an SQL injection vulnerability in the order_by parameter of the manage_privilege export endpoint, allowing authenticated users to manipulate database queries.
By sending crafted POST requests to /nocms/main/manage_privilege/index/export, an attacker can inject SQL through order_by[0] and potentially extract sensitive data from the underlying database.
Affected context
The vulnerability appears in the privilege management/export functionality of No-Cms 1.0, specifically when handling the order_by parameter in export requests.
It manifests in environments where:
- The manage_privilege module is enabled and reachable to authenticated users
- User-controlled request parameters (e.g.,
order_by[0]) are interpolated directly into SQL queries - The underlying database executes dynamically constructed SQL without adequate parameterization or filtering
Exploit preconditions
- Attack surface: HTTP POST requests to
/nocms/main/manage_privilege/index/export - Required access: Authenticated access to the No-Cms admin or privilege management interface
- Trigger point: Processing of the
order_by[0]parameter when generating export queries - Why exploitation is possible: The application appears to concatenate the
order_byvalue into the SQL statement without proper parameter binding, escaping, or allowlisting, enabling attackers to alter the query structure.
Why this happens
This issue stems from dynamically constructing SQL statements using untrusted input from the order_by parameter.
Instead of using parameterized queries or restricting the ORDER BY clause to a fixed set of allowed columns, the code likely interpolates raw request data into the query string.
This maps directly to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, where lack of proper input handling allows an attacker to inject additional SQL tokens and modify query behavior.
Potential impact
- Extraction of sensitive data, including user records or privilege information, from the database
- Enumeration of database schema details (tables, columns) via injected queries
- Bypassing of application-level access controls if injected queries alter filtering or join conditions
- Potential pivot to more severe database operations (e.g., writing or deleting data) depending on query context and DB permissions
General mitigation guidance
Mitigation should focus on eliminating direct string concatenation of SQL and treating all client input as untrusted:
- Use parameterized queries / prepared statements for all database access, including
ORDER BY-related logic where supported - Restrict sort and filter parameters to a predefined, allowlisted set of column names, mapping user-facing values to internal constants
- Normalize and validate all user input for structural parameters (e.g., sort columns, sort direction) rather than passing it through directly
- Apply least-privilege to the database account so that even if a query is abused, its ability to access or modify data is limited
- Centralize query-building helpers to enforce safe patterns and avoid ad-hoc SQL construction across the codebase
How teams detect issues like this
Detection efforts can combine code-centric review with runtime monitoring:
- Use static analysis or linters to flag string-based SQL construction that incorporates request parameters (particularly for sorting, filtering, and export functionality)
- During code review, look for:
- Direct concatenation of
$_POST,$_GET, or framework request variables into SQL - Dynamic
ORDER BY,LIMIT, orWHEREclauses built from user input without a clear allowlist - Add application-level logging around export and privilege-management endpoints to detect anomalous
order_byvalues containing SQL syntax (quotes, comments, logical operators) - Incorporate database-side monitoring for unusual query patterns, such as queries containing unexpected concatenations or schema enumeration attempts
- Consider using Web Application Firewalls (WAFs) or API gateways configured with generic SQL injection signatures as a defense-in-depth layer

