Summary
Vvveb prior to 1.0.8.1 contains a PHP code injection flaw in its installation endpoint, where the subdir POST parameter is written directly into env.php without sanitization.
By breaking out of the string context in a define statement, an unauthenticated attacker can inject arbitrary PHP code into the configuration file and achieve remote code execution as the web server user.
Affected context
This vulnerability appears in Vvveb installations that expose the installer endpoint and allow it to generate or overwrite env.php.
During setup, user-controlled input from the subdir POST parameter is interpolated into PHP configuration code without escaping or validation.
Environments where the installer remains accessible after initial deployment, or where env.php can be regenerated, are particularly at risk because the configuration file is executable PHP loaded on every request.
Exploit preconditions
- Attack surface: HTTP(S) interface to the Vvveb installation/installer endpoint.
- Required access: Network access to the installer; no prior authentication if the endpoint is publicly reachable.
- Trigger point: Submission of a crafted subdir POST parameter during the installation or configuration-writing process.
- Why exploitation is possible: The installer writes the raw subdir value into a PHP define statement in env.php without quoting, escaping, or validation, allowing an attacker to break out of the intended string and inject arbitrary PHP code that will later be executed by the interpreter.
Why this happens
The core issue maps to CWE-94: Improper Control of Generation of Code ('Code Injection').
The installation logic dynamically generates PHP code for env.php by directly concatenating a user-supplied value (subdir) into a define statement.
Because this value is not constrained to a safe character set, not escaped for PHP string literals, and not validated as a path, an attacker can inject PHP syntax that terminates the string and appends executable code.
When the application later includes env.php, the injected code executes in the context of the web server process.
Potential impact
- Execution of arbitrary PHP code on the server as the web server user.
- Full compromise of the Vvveb application, including reading and modifying application data.
- Deployment of webshells or backdoors for persistent access.
- Lateral movement within the hosting environment, such as accessing other sites on the same server.
- Abuse of the compromised server for further attacks, such as phishing, malware hosting, or pivoting into internal networks.
General mitigation guidance
Effective mitigation centers on controlling how configuration code is generated and treating installer input as untrusted:
- Avoid generating executable PHP code directly from raw user input; instead, store configuration as structured data (e.g., JSON, INI, environment variables) and load it safely.
- If PHP-based config files are required, strictly escape user-provided values for PHP string contexts and restrict them to expected patterns (e.g., validated path segments).
- Enforce strong validation on installer parameters, rejecting values that contain PHP control characters, quotes, or other unsafe syntax.
- Disable or remove the installer endpoint after initial setup, or protect it behind authentication and access controls.
- Run the web server and application with least-privilege accounts and restrictive filesystem permissions to reduce the blast radius of a compromise.
How teams detect issues like this
Organizations can look for this issue and similar patterns using:
- Static analysis: Rules that flag dynamic generation of PHP code using user-controlled data, particularly concatenation into define() calls or configuration includes.
- Code review: Manual checks of installation and configuration-writing routines, focusing on where request parameters are written into PHP files or other executable artifacts.
- File integrity monitoring: Alerts on unexpected changes to env.php or other configuration files that are included or required by the application.
- Runtime monitoring: Web server and application logs that show repeated or unusual access to the installer endpoint, particularly POST requests with suspicious subdir values.
- Automated security scanners or CI checks tuned to detect code generation from HTTP parameters can help surface such patterns early in development.

