GitHub Security Advisory: GHSA-jvx4-xv3m-hrj4
Package: froxlor/froxlor (COMPOSER)
Severity: MODERATE (CVSS 5.4)
CWE: CWE-863: Incorrect Authorization
Vulnerable versions: <= 2.3.5
Patched in: 2.3.6

Summary: Froxlor has a Reseller Domain Quota Bypass via Unvalidated adminid Parameter in Domains.add()

Details:
## Summary

In `Domains.add()`, the `adminid` parameter is accepted from user input and used without validation when the calling reseller does not have the `customers_see_all` permission. This allows a reseller to attribute newly created domains to any other admin, bypassing their own domain quota (since the wrong admin's `domains_used` counter is incremented) and potentially exhausting another admin's quota.

## Details

In `lib/Froxlor/Api/Commands/Domains.php`, the `add()` method accepts `adminid` as an optional parameter at line 327:

```php
$adminid = intval($this->getParam('adminid', true, $this->getUserDetail('adminid')));
```

The validation for this parameter only runs when the caller has `customers_see_all == '1'` (lines 410-421):

```php
if ($this->getUserDetail('customers_see_all') == '1' && $adminid != $this->getUserDetail('adminid')) {
    $admin_stmt = Database::prepare("
        SELECT * FROM `" . TABLE_PANEL_ADMINS . "`
        WHERE `adminid` = :adminid AND (`domains_used` < `domains` OR `domains` = '-1')");
    $admin = Database::pexecute_first($admin_stmt, [
        'adminid' => $adminid
    ], true, true);
    if (empty($admin)) {
        Response::dynamicError("Selected admin cannot have any more domains or could not be found");
    }
    unset($admin);
}
```

When a reseller does **not** have `customers_see_all` (the common case for limited resellers), there is no `else` branch to force `$adminid = $this->getUserDetail('adminid')`. The unvalidated `$adminid` flows directly into:

1. The domain INSERT at line 757: `'adminid' => $adminid`
2. The quota increment at lines 862-868:
```php
$upd_stmt = Database::prepare("
    UPDATE `" . TABLE_PANEL_ADMINS . "` SET `domains_used` = `domains_used` + 1
    WHERE `adminid` = :adminid
");
Database::pexecute($upd_stmt, ['adminid' => $adminid], true, true);
```

Compare with `Domains.update()` at lines 1386-1387 which correctly handles this case:

```php
} else {
    $adminid = $result['adminid'];
}
```

The initial quota check at line 321 checks the *caller's* own quota (`$this->getUserDetail('domains_used')`), but since the caller's `domains_used` is never incremented (the wrong admin's counter is incremented instead), this check passes indefinitely.

Note: The `getCustomerData()` call at line 407 does correctly restrict the `customerid` to the reseller's own customers (via `Customers.get` which filters by `adminid`). However, this does not prevent the `adminid` field itself from being spoofed.

## PoC

```bash
# Step 1: Create a domain with the reseller's API key, specifying a different admin's ID
curl -s -u RESELLER_[CREDENTIAL_REDACTED] -X POST https://froxlor.example/api.php \
  -d '{"command": "Domains.add", "params": {"domain": "bypass-test-1.com", "customerid": 3, "adminid": 1}}'

# Where:
# - RESELLER_[CREDENTIAL_REDACTED] = API credentials for a reseller WITHOUT customers_see_all
# - customerid=3 = one of the reseller's own customers
# - adminid=1 = the super-admi