PT-2026-57600 · Packagist · Froxlor/Froxlor
Published
2026-07-02
·
Updated
2026-07-02
CVSS v3.1
4.3
Medium
| Vector | AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N |
Summary
The
Mysqls.add API command (lib/Froxlor/Api/Commands/Mysqls.php) accepts a customer-controlled mysql server parameter and only validates that the value is numeric and that the server index exists in userdata.inc.php. It never checks the value against the calling customer's allowed mysqlserver allowlist. A customer can therefore create a database, plus a MySQL user with a password they choose, on any MySQL server the operator has configured — including servers that were explicitly excluded from that customer (e.g. a separate cluster, premium-tier host, or another tenant pool). The same allowed mysqlserver check is correctly enforced in MysqlServer::get() / MysqlServer::listing() and in the customer-facing UI (customer mysql.php), confirming the omission is a bug, not by-design.Details
Vulnerable code path —
lib/Froxlor/Api/Commands/Mysqls.php:69-99 (add()):php
public function add()
{
if (($this->getUserDetail('mysqls used') < $this->getUserDetail('mysqls') || ...) {
...
$customer = $this->getCustomerData('mysqls'); // line 80
$dbserver = $this->getParam('mysql server', true, // line 81 — user-controlled
$this->getDefaultMySqlServer($customer));
...
$dbserver = Validate::validate($dbserver, ..., '/^[0-9]+$/', ...); // line 92 — numeric only
Database::needRoot(true, $dbserver, false); // line 93 — root ctx for ANY index
Database::needSqlData();
$sql root = Database::getSqlData();
Database::needRoot(false);
if (!is array($sql root)) { // line 97 — only existence check
throw new Exception("Database server with index #" . $dbserver . " is unknown", 404);
}
...
$username = $dbm->createDatabase($newdb params['loginname'], $password,
$dbserver, ...); // line 116/118 — DB+user created
...
Database::pexecute($stmt, ["customerid"=>$customer['customerid'], ..., "dbserver"=>$dbserver], ...);
}
}The
$customer['allowed mysqlserver'] field IS read on line 80 but is only consumed by getDefaultMySqlServer() (lines 566-573) to compute a default when the request omits mysql server. As soon as the client supplies the parameter, the default path is skipped and no further authorization gate runs.Cross-file evidence the check is intended elsewhere:
lib/Froxlor/Api/Commands/MysqlServer.php:319-323—get()rejects with HTTP 405 when$dbserveris not inallowed mysqlserver:
php
if ($this->isAdmin() == false) {
$allowed mysqls = json decode($this->getUserDetail('allowed mysqlserver'), true);
if ($allowed mysqls === false || empty($allowed mysqls) || !in array($dbserver, $allowed mysqls)) {
throw new Exception("You cannot access this resource", 405);
}
...
}lib/Froxlor/Api/Commands/MysqlServer.php:252-257— same allowlist filter onlisting().customer mysql.php:222— UI rejects withResponse::dynamicError('No permission')whenempty($allowed mysqlservers).
Chain of execution (attacker → impact):
- Customer authenticates to
api.phpwith apikey/secret. The only API gate iscust api allowed;allowed mysqlserveris not consulted at auth time. - Customer sends JSON
{"command":"Mysqls.add","params":{"mysql password":"<valid>","mysql server":<disallowed idx>}}. Mysqls.php:71quota check passes (mysqls used < mysqls).Mysqls.php:80getCustomerData('mysqls')returns the caller's own row.Mysqls.php:81$dbserveris set from the request (default-fallback path skipped).Mysqls.php:92numeric regex passes.Mysqls.php:93-99Database::needRoot(true, $dbserver, false)switches to the root context of the attacker-chosen server; existence check passes.Mysqls.php:116/118DbManager::createDatabase(...)runs against the disallowed server using stored root credentials, creating the DB and granting the supplied password to<loginname> <sqlN>(DbManager.php:177-218).Mysqls.php:127-141inserts a row intoTABLE PANEL DATABASESwith the attacker'scustomeridand the disalloweddbserver, allowing later management viaMysqls.get/update/delete(which only filter bycustomeridfor non-admins, e.g.Mysqls.php:282).
PoC
Preconditions on the target instance:
- ≥2 MySQL servers configured in
lib/userdata.inc.php(e.g. index 0 default, index 1 internal/premium). - Customer X with
allowed mysqlserver=[0],cust api allowed=1,mysqls > 0, and an issued API key (apikey:secret).
Request — customer creates a database on server
1, which is not in their allowlist:bash
curl -k -u 'CUST APIKEY:CUST SECRET'
-H 'Content-Type: application/json'
-X POST
-d '{"command":"Mysqls.add","params":{"mysql password":"ValidP@ssw0rd!","mysql server":1}}'
https://froxlor.example.com/api.phpExpected (mirroring
MysqlServer.get() behaviour): HTTP 405 — "You cannot access this resource".
Actual: HTTP 200 with the full database record, e.g.:json
{"data":{"id":42,"customerid":<cust id>,"databasename":"<loginname> sql1","dbserver":1,...}}Verify the credentials work on the forbidden server:
bash
mysql -h server1.host -u <loginname> sql1 -p # password: ValidP@ssw0rd!
mysql> SHOW DATABASES; # the new DB is present
mysql> USE <loginname> sql1; # full access to the newly-created DBThe customer can subsequently manage the DB via
Mysqls.get, Mysqls.update, and Mysqls.delete — those non-admin code paths filter only by customerid (Mysqls.php:282-289, Mysqls.php:380-391), which matches.Impact
- Bypass of the per-customer MySQL-server allowlist (
allowed mysqlserver) enforced by the admin/reseller. The authorization model is fully defeated for theaddoperation. - The customer obtains valid MySQL credentials on a server the operator explicitly excluded for them — possibly an internal/separate cluster, billing tier, premium-only host, or a server provisioned for a different tenant pool.
- The customer can persist a DB on the forbidden server (resource and policy bypass), then read/write data there, and continue to manage it through
Mysqls.update/Mysqls.delete. - Impact is bounded: privileges granted by
DbManager::grantPrivilegesToapply only to the new<loginname> sqlNdatabase, so no cross-tenant data exposure on the forbidden server. The damage is policy bypass, resource consumption on the forbidden server, and credential persistence there.
Recommended Fix
Mirror the allowlist check already present in
MysqlServer::get(). After the numeric validation on Mysqls.php:92, before Database::needRoot(...), add for non-admin callers:php
// validate whether the dbserver exists
$dbserver = Validate::validate($dbserver, html entity decode(lng('mysql.mysql server')), '/^[0-9]+$/', '', 0, true);
// enforce per-customer allowed mysqlserver allowlist (parity with MysqlServer::get())
if (!$this->isAdmin()) {
$allowed = json decode($customer['allowed mysqlserver'] ?? '[]', true);
if (!is array($allowed) || empty($allowed)
|| !in array((int)$dbserver, array map('intval', $allowed), true)) {
throw new Exception('You cannot access this resource', 405);
}
}
Database::needRoot(true, $dbserver, false);Audit
Mysqls::update(), Mysqls::delete(), and Mysqls::get() for the same gap: those endpoints accept mysql server and ultimately call Database::needRoot(true, $result['dbserver'], false) on the row's stored value. Once the row exists with a forbidden dbserver, those paths execute against the forbidden server unchallenged. Consider rejecting any non-admin operation whose target row's dbserver is outside allowed mysqlserver, even if the row already exists, to defend in depth.Fix
Improper Authorization
Found an issue in the description? Have something to add? Feel free to write us 👾
Weakness Enumeration
Related Identifiers
Affected Products
Froxlor/Froxlor