Summary
Green CMS 2.x contains an SQL injection vulnerability in the admin posts listing functionality, where the cat parameter is used unsafely in database queries.
An authenticated attacker can inject arbitrary SQL through crafted GET requests to index.php and execute database queries that may expose or manipulate sensitive data.
Affected context
This vulnerability occurs in Green CMS 2.x within the administrative interface, specifically in the posts management module (m=admin, c=posts, a=index).
It affects deployments where:
- Administrators or other authenticated users can access the posts listing page via HTTP(S)
- The
catparameter from GET requests is used to filter posts - The application directly concatenates or interpolates this parameter into SQL queries without robust parameterization or sanitization
Exploit preconditions
- Attack surface: HTTP GET endpoint at
index.phpwith parametersm=admin,c=posts,a=index - Required access: Valid authenticated session with access to the admin posts index page
- User-controlled input: The
catquery parameter supplied via the URL - Trigger point: Server-side execution of a database query that embeds
catdirectly into the SQL statement - Why exploitation is possible: The application constructs SQL using string concatenation or unsafe interpolation instead of using prepared statements or parameterized queries, allowing attacker-controlled input to alter the query structure
Why this happens
The root cause aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
User-supplied data from the cat parameter is treated as trusted and directly incorporated into an SQL query, often via string concatenation or similarly unsafe patterns.
Because there is no strict boundary between data and code in the query, special characters such as quotes, operators, or SQL keywords can break out of the intended context, enabling attackers to modify the query logic, append additional commands, or bypass filters.
Potential impact
- Unauthorized reading of sensitive data from one or more database tables
- Extraction of user details, including potentially hashed passwords, email addresses, and configuration settings
- Modification or deletion of content, posts, or other stored records
- Creation of new administrative or privileged accounts at the database level if application logic permits
- Potential stepping stone to broader compromise if combined with other weaknesses (e.g., reuse of credentials, weak admin passwords)
General mitigation guidance
Effective mitigation focuses on separating SQL code from user input and constraining what queries can do:
- Use parameterized queries or prepared statements for all database access, ensuring user input is always treated as data, not code
- Apply strict server-side validation on the
catparameter (e.g., whitelisting numeric IDs or specific category identifiers) - Centralize database access in a data access layer that enforces safe query construction patterns by default
- Implement least-privilege database accounts so that the application can only perform the minimum required operations (e.g., read-only when appropriate)
- Consider using an ORM or query builder that encourages safe parameter binding and discourages raw string concatenation
How teams detect issues like this
Detection typically involves both code-centric and runtime approaches:
- Static analysis: Configure tools or custom rules to detect dynamic SQL construction involving request parameters (e.g.,
$GET['cat']or equivalent) without parameter binding - Code review: Look for direct string concatenation in SQL-related code paths in the admin posts module and other controllers handling query parameters
- Security testing: Use automated scanners or manual testing to send crafted input in the
catparameter and observe for SQL error messages, anomalous responses, or data leakage - Database monitoring: Monitor for unusual or complex queries originating from the CMS application account, such as
UNION-heavy or system-table access patterns that deviate from typical usage

