Summary
OpenSTAManager versions 2.9.8 and prior contain a SQL injection vulnerability in the ajax_complete.php endpoint when processing the get_sedi operation.
An authenticated attacker can inject crafted SQL via the idanagrafica parameter, potentially gaining unauthorized access to database data and altering application behavior.
Affected context
The vulnerability occurs in OpenSTAManager's AJAX handling logic, specifically within ajax_complete.php when the get_sedi operation is invoked.
It affects deployments where the idanagrafica parameter is passed from authenticated user-controlled input into SQL queries without adequate sanitization or parameterization.
The risk is present in environments where users have authenticated access to the affected feature and the application backend uses a relational database to store business data such as customer, invoicing, and technical assistance records.
Exploit preconditions
- Attack surface: Application's web interface via the ajax_complete.php endpoint using the get_sedi operation.
- Required access: Authenticated user account with the ability to trigger the relevant AJAX call that includes the idanagrafica parameter.
- Trigger point: Submission of a specially crafted idanagrafica value that is incorporated into a SQL statement on the server side.
- Why exploitation is possible: The server-side code appears to concatenate the idanagrafica parameter directly into SQL queries or otherwise fails to use robust prepared statements and input handling, allowing the attacker-controlled input to alter the structure of the executed SQL command.
Why this happens
This issue stems from constructing SQL queries using dynamically concatenated user input rather than treating that input as data-only parameters.
When the idanagrafica parameter is incorporated directly into a query string, the database engine interprets parts of the input as SQL syntax instead of plain values.
This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), in which failure to properly parameterize and validate input allows an attacker to modify the intended query logic.
The core insecure pattern is trusting authenticated user input as structurally safe for direct inclusion in database commands.
Potential impact
- Unauthorized reading of sensitive records stored in the database (e.g., customer, invoice, and service data).
- Modification or deletion of business-critical data, impacting billing, reporting, or operational integrity.
- Bypass of application-level authorization checks by manipulating queries that enforce access control.
- Enumeration or extraction of additional application secrets stored in the database, potentially aiding further compromise.
- In some deployments, potential pivot to other data or functions if database-level privileges are broad.
General mitigation guidance
Effective mitigation focuses on eliminating direct inclusion of user input in SQL statements and enforcing strict data handling boundaries:
- Use parameterized queries / prepared statements for all database operations, ensuring that user-controlled values (such as idanagrafica) are always bound as parameters, not concatenated strings.
- Apply rigorous server-side validation and normalization for identifiers and similar parameters, restricting them to expected formats (for example, numeric IDs or fixed patterns).
- Centralize data access logic in a data access layer that enforces safe query construction patterns by default.
- Apply least-privilege principles at the database level so that the application account has only the minimum permissions required for its operations, limiting the blast radius of successful injection attempts.
- Introduce generic input-handling utilities that encode or sanitize data before it reaches query-building code, avoiding ad-hoc handling scattered throughout the codebase.
How teams detect issues like this
Detection efforts can combine code-centric analysis with runtime signals:
- Static analysis: Use security-focused linters or SAST tools configured with rules that flag string concatenation or interpolation involving request parameters (e.g., idanagrafica) used in SQL query construction.
- Code review: During manual reviews, look for direct use of $_GET, $_POST, or AJAX parameters inside SQL strings in PHP files such as ajax_complete.php, and verify that all database operations rely on prepared statements.
- Policy enforcement: Define coding standards that prohibit raw SQL concatenation and enforce the use of a vetted database abstraction layer or ORM, with checks integrated into CI pipelines.
- Runtime monitoring: Enable database query logging and alert on anomalous patterns, such as queries containing unexpected operators, comment markers, or concatenated literals that typically indicate injection attempts.

