Summary
OpenSTAManager versions 2.9.8 and earlier contain an SQL injection vulnerability in the ajax_select.php endpoint when processing the componenti operation.
An authenticated attacker can inject crafted SQL through the options[matricola] parameter, which may lead to unauthorized data access, modification, or other database-level impacts depending on configured privileges.
Affected context
This vulnerability affects OpenSTAManager deployments that expose the ajax_select.php endpoint and support the componenti operation.
The issue arises where user-controlled values from the options[matricola] parameter are used to build SQL queries without adequate parameterization or sanitization.
It is relevant in environments where authenticated users can trigger AJAX requests to this endpoint and the backend database account has privileges over sensitive tables or operations.
Exploit preconditions
- Attack surface: HTTP(S) requests to the ajax_select.php endpoint in OpenSTAManager
- Required access: Valid authenticated user account with permission to invoke the componenti operation
- Trigger point: Submission of a crafted options[matricola] parameter value in an AJAX request
- Why exploitation is possible: The parameter value is interpolated into SQL statements directly or via unsafe concatenation, allowing attacker-controlled tokens to alter query structure instead of being treated as data
Why this happens
The root cause is the construction of SQL queries using untrusted input from the options[matricola] parameter without using prepared statements or proper input binding.
This aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command, where application logic directly concatenates user input into SQL, enabling manipulation of predicates, joins, or additional statements.
The lack of a strict separation between query logic and user data allows crafted input to break out of intended query boundaries.
Potential impact
- Retrieval of sensitive information from database tables the application account can access
- Modification or deletion of records, potentially impacting invoices, customer data, or technical assistance records
- Circumvention of application-level authorization checks by modifying WHERE clauses
- In some configurations, execution of administrative database operations that can affect availability or integrity of the database
General mitigation guidance
Effective mitigation focuses on enforcing a strict separation between SQL logic and user-supplied data.
Common defensive patterns include:
- Using parameterized queries / prepared statements for all database interactions involving external input
- Applying centralized query builders or ORM layers that default to bound parameters instead of string concatenation
- Validating and constraining options[matricola] to expected formats (e.g., numeric or fixed patterns) before passing it to the data access layer
- Applying least-privilege to the database user so that even if a query is manipulated, the accessible data and operations are minimized
- Adopting a secure coding standard that prohibits ad-hoc SQL string concatenation
How teams detect issues like this
Detection typically involves a combination of code-level analysis and runtime monitoring:
- Static analysis rules that flag SQL query construction using string concatenation, particularly around ajax_select.php and the componenti operation
- Manual code review focused on data access layers, verifying use of prepared statements and consistent parameter binding
- Central logging of SQL queries (with sensitive data appropriately masked) to identify anomalous patterns such as unexpected predicates or appended clauses
- Web application firewall or API gateway rules tuned to identify and block common SQL injection patterns in parameters like options[matricola]
- Integration of automated security scanning tools in CI pipelines to catch injection-prone patterns early in development

