/

CVE-2026-41229

Severity:

CRITICAL RISK

(9.1)

Code Injection in Froxlor Server Admin

CVE-2026-41229

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary PHP Code Execution

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Froxlor's configuration handling logic allows unescaped user input to be written directly into a PHP file that is required on every request, enabling injected data to break out of a string and become executable code.

An authenticated admin with change_serversettings permission can abuse the privileged_user parameter in the MySQL server API to inject arbitrary PHP that runs as the web server user on all subsequent page loads.

Affected context

This vulnerability affects Froxlor deployments where:

  • Admin users can add or update MySQL server configurations via the API.
  • The privileged_user parameter is accepted and persisted without validation.
  • PhpHelper::parseArrayToString() serializes configuration values into PHP code using single-quoted string literals.
  • The generated lib/userdata.inc.php file is included via require in Database::getDB() on every request.

Under these conditions, crafted configuration values may escape the intended string literal and introduce attacker-controlled PHP code into the application runtime.

Exploit preconditions

  • Attack surface: Froxlor API endpoint(s) responsible for managing MySQL servers.
  • Required access: Authenticated account with change_serversettings permission (typically an administrative role).
  • Trigger point: Submission or update of the MySQL server configuration where privileged_user is set to a value containing PHP-breaking payloads.
  • Why exploitation is possible: The PhpHelper::parseArrayToString() helper writes string values into single-quoted PHP literals without escaping single quotes. This makes it possible for crafted input in privileged_user to terminate the string, inject arbitrary PHP code, and then restore syntactic validity. The resulting lib/userdata.inc.php is required on every request, so the injected code executes automatically.

Why this happens

The core issue is unsafe dynamic code generation: user-controlled data is directly embedded into a PHP source file without proper escaping or separation between data and executable logic.

By writing raw input into a single-quoted PHP string literal and failing to escape single quotes or other control characters, the application effectively treats configuration data as code. This aligns with CWE-94: Improper Control of Generation of Code ('Code Injection'), where external input influences the code that will later be executed. Instead of serializing configuration to a neutral data format (e.g., JSON, INI, or PHP arrays with robust encoding), the helper function constructs PHP code fragments that are then required, creating an implicit template engine without safety boundaries.

Potential impact

  • Execution of arbitrary PHP code as the web server user.
  • Full compromise of the Froxlor application and its data.
  • Theft or manipulation of database credentials and other secrets loaded from configuration.
  • Creation of persistent backdoors that run on every request.
  • Lateral movement to other applications or data on the same server, depending on file system and process privileges.
  • Disruption of service by injecting code that causes fatal errors or infinite loops.

General mitigation guidance

Effective mitigation focuses on eliminating the mixing of user-controlled data with executable PHP code and enforcing strict encoding for any generated configuration:

  • Stop generating executable PHP from user input: Prefer data-only configuration formats (e.g., JSON, YAML, INI, environment variables, or database-stored settings) that are parsed as data rather than code.
  • Use robust escaping when PHP code generation is unavoidable: If a PHP config file must be generated, use well-tested escaping routines for string literals (e.g., var_export or dedicated encoding helpers) to ensure that quotes and control characters cannot break out of strings.
  • Introduce strict validation for configuration fields: Constrain parameters like privileged_user to expected patterns (e.g., database username formats) using whitelisting, length limits, and character-set restrictions.
  • Separate privileges and configuration paths: Store configuration files in locations with restricted write access, ensuring that only trusted application paths can modify them, and enforce least-privilege on any process that generates configuration.
  • Apply defense-in-depth controls: Run the web server and PHP runtime under constrained OS accounts, leverage filesystem permissions, disable dangerous PHP functions where possible, and segment the environment so that configuration compromise has limited blast radius.

How teams detect issues like this

Detection can focus on both code-level patterns and runtime behavior:

  • Static analysis and code scanning:
  • Flag functions or helpers that build PHP code strings from variables (e.g., concatenation into .php files, use of eval, or require on generated files).
  • Look for serialization of user-controlled fields into PHP literals without escaping, especially where quotes and backslashes are not sanitized.
  • Enforce linting rules that disallow writing configuration as executable PHP when user input is involved.
  • Code review cues:
  • Highlight any code that writes to lib/userdata.inc.php or similar configuration files that are later required.
  • Question any pattern where configuration helpers accept raw input and output PHP code instead of neutral data.
  • Review permission checks around APIs that mutate configuration and ensure that they are restricted and validated.
  • Runtime and operational monitoring:
  • Monitor configuration files (e.g., lib/userdata.inc.php) for unexpected changes using file integrity monitoring.
  • Inspect logs for anomalous values in configuration parameters like privileged_user.
  • Use application security monitoring or WAF rules to detect suspicious payloads that contain PHP code fragments targeting configuration endpoints.

Sources

SourceLink
github.comgithub.com/froxlor/froxlor/commit/3589ddf93ab59eb2a8971f0f56cbf6266d03c4ae
github.comgithub.com/froxlor/froxlor/releases/tag/2.3.6
github.comgithub.com/froxlor/froxlor/security/advisories/GHSA-gc9w-cc93-rjv8

Frequently asked

questions

It is remotely exploitable through Froxlor's API, but only by users who already possess valid credentials with change_serversettings privileges. No local shell access is required once those permissions are available.

An attacker must authenticate as an administrative user (or compromise such an account) with permission to add or modify MySQL servers via the API, specifically the ability to set the privileged_user parameter.

The safest pattern is to stop generating executable PHP from user-supplied values. Store configuration as data in a neutral format and parse it as data only. If PHP configuration files are necessary, ensure all embedded values are passed through robust escaping or serialization functions that guarantee they cannot escape string literals.

Adopt development practices that strictly separate code from data: avoid dynamic code generation, enforce strong input validation on all configuration parameters, add automated checks for code-writing helpers during code review and CI, and standardize on configuration mechanisms that are not interpreted as code. Defense-in-depth measures such as least-privilege execution and file integrity monitoring further reduce the risk of similar issues being exploited.

Find out what's already
exploitable in your codebase.