Описание
OpenSTAManager has a SQL Injection in the Prima Nota module
Summary
Critical Error-Based SQL Injection vulnerability in the Prima Nota (Journal Entry) module of OpenSTAManager v2.9.8 allows authenticated attackers to extract complete database contents including user credentials, customer PII, and financial records through XML error messages by injecting malicious SQL into URL parameters.
Status: ✅ Confirmed and tested on live instance (v2.9.8)
Vulnerable Parameters: id_documenti (GET parameters)
Affected Endpoint: /modules/primanota/add.php
Attack Type: Error-Based SQL Injection (IN clause)
Details
OpenSTAManager v2.9.8 contains a critical Error-Based SQL Injection vulnerability in the Prima Nota (Journal Entry) module's add.php file. The application fails to validate that comma-separated values from GET parameters are integers before using them in SQL IN() clauses, allowing attackers to inject arbitrary SQL commands and extract sensitive data through XPATH error messages.
Vulnerability Chain:
-
Entry Point:
/modules/primanota/add.php(Lines 63-67)$id_documenti = $id_documenti ?: get('id_documenti'); $id_documenti = $id_documenti ? explode(',', (string) $id_documenti) : [];Impact: The
get()function retrieves user-controlled URL parameters,explode(',', (string) ...)splits them by comma, but NO validation ensures elements are integers. -
SQL Injection Point:
/modules/primanota/add.php(Line 306)$id_anagrafica = $dbo->fetchOne('SELECT idanagrafica FROM co_documenti WHERE id IN('.($id_documenti ? implode(',', $id_documenti) : 0).')')['idanagrafica'];Impact: Array elements from
$id_documentiare directly concatenated usingimplode()without type validation orprepare(), enabling full SQL injection.
Root Cause Analysis:
The vulnerability exists because:
get('id_documenti')return user-controlled stringsexplode(',', (string) $value)splits by comma but doesn't validate typesimplode(',', $array)concatenates array elements directly into SQL- No validation ensures array elements are integers
- Attacker can inject SQL by providing:
?id_documenti=1) AND EXTRACTVALUE(...) %23
Affected Code Path:
PoC
Step 1: Login
Step 2: Verify Vulnerability (Error-Based SQL Injection)
Test 1: Extract Database User and Version
Response (error message visible to attacker):
Impact
All authenticated users with access to the Prima Nota (Journal Entry) module.
Recommended Fix
Primary Fix - Type Validation:
File: /modules/primanota/add.php
BEFORE (Vulnerable - Lines 63-67):
AFTER (Fixed):
Credits
Discovered by Łukasz Rybak
Пакеты
devcode-it/openstamanager
<= 2.9.8
Отсутствует
Связанные уязвимости
OpenSTAManager is an open source management software for technical assistance and invoicing. OpenSTAManager v2.9.8 and earlier contain a critical Error-Based SQL Injection vulnerability in the Prima Nota (Journal Entry) module's add.php file. The application fails to validate that comma-separated values from the id_documenti GET parameter are integers before using them in SQL IN() clauses, allowing attackers to inject arbitrary SQL commands and extract sensitive data through XPATH error messages.