Summary
InvoicePlane 1.7.0 contains a critical Remote Code Execution vulnerability where an authenticated administrator can chain Local File Inclusion (LFI) with log poisoning to execute arbitrary system commands on the server.
By pointing the public_invoice_template setting at a log file that has been poisoned with PHP code, the application ends up interpreting attacker-controlled content as executable script, leading to full server compromise in affected deployments.
Affected context
The vulnerability appears in InvoicePlane 1.7.0 installations where:
- The application is configured to render invoice templates from file paths controlled by the
public_invoice_templatesetting. - Application or web server logs are writable and can be influenced by user-supplied data (e.g., request parameters, headers, or content).
- The PHP runtime is configured to interpret included files as PHP code when they are referenced as templates.
It primarily affects environments where administrators have direct access to configuration options for invoice templates and logs are stored on the same filesystem as the application.
Exploit preconditions
- Attack surface: Web-based administration interface of InvoicePlane.
- Required access: Authenticated administrator privileges capable of changing the
public_invoice_templateconfiguration. - Additional conditions:
- Ability for the attacker to inject controlled content into an application or web server log file (log poisoning).
- The log file must be stored in a location accessible to the PHP interpreter and reachable by the template inclusion logic.
- Trigger point: Rendering a public invoice that uses the configured
public_invoice_template, which is set to a poisoned log file. - Why exploitation is possible: The template mechanism trusts a configurable file path and includes it as executable PHP, and the logging subsystem records unsanitized attacker input that can contain PHP code. This combination allows arbitrary code to be written to a log file and then interpreted via Local File Inclusion.
Why this happens
The core issue is the unsafe combination of:
- A file-include-based template system that accepts administrator-controlled paths, and
- Logging of attacker-influenced data without sanitization, followed by inclusion of those log files as PHP.
This maps primarily to:
- CWE-98: Improper Control of Filename for Include/Require Statement in PHP Program, where an include path is controlled in a way that allows unintended files to be executed.
- CWE-94: Improper Control of Generation of Code ('Code Injection'), since user-controlled content in the logs is ultimately executed as PHP code.
- CWE-117: Improper Output Neutralization for Logs, as unneutralized user input is written to log files, enabling log poisoning.
Abstractly, the pattern is: "configurable file inclusion of PHP templates" + "logs containing untrusted, executable content" = a code execution sink reachable through configuration rather than direct arbitrary file upload.
Potential impact
- Execution of arbitrary PHP code and system commands under the web server or PHP process account.
- Complete compromise of the InvoicePlane application, including access to invoices, client information, and payment-related data.
- Installation of web shells or persistent backdoors on the server.
- Pivoting to other internal systems or databases accessible from the compromised host.
- Tampering with invoice content, payment details, or financial records.
- Theft or exposure of sensitive customer and business information.
General mitigation guidance
Effective mitigation focuses on breaking the chain between log poisoning and file inclusion, and on removing execution semantics from user-influenced content:
- Constrain template resolution:
- Restrict template selection to a fixed set of known-safe templates or to a whitelisted directory.
- Avoid directly including arbitrary filesystem paths; use logical template names mapped to vetted files.
- Treat templates as data, not code:
- Use non-PHP template engines where template files are not interpreted as executable code.
- If PHP templates are unavoidable, prevent runtime evaluation of file content that can be influenced indirectly (e.g., via logs).
- Harden logging behavior:
- Neutralize or encode user-supplied data before writing to logs to prevent it from being valid executable code.
- Store logs outside of directories that are web-accessible or used for application templates.
- Apply least privilege and isolation:
- Run the application with minimal filesystem permissions so it cannot write into directories that are executed or included as code.
- Separate execution directories from data/log directories with strict permissions.
- Configuration hygiene:
- Limit who can change high-impact configuration parameters like template paths.
- Review and document configuration settings that map directly to file system resources or execution context.
How teams detect issues like this
Detection can focus on both code-level and operational indicators:
- Static analysis and code review:
- Search for dynamic
include,require, or template rendering calls that accept configuration or user-controlled file paths (CWE-98 patterns). - Identify any log file paths that can be referenced by template or include mechanisms.
- Flag logging of raw user input without encoding or neutralization (CWE-117 patterns).
- Configuration and filesystem review:
- Audit configuration options related to templates or themes to ensure they cannot point to arbitrary files or log directories.
- Check webroot and application directories for the presence of log files that are readable and executable by the web server.
- Runtime monitoring:
- Monitor logs and telemetry for unusual template path changes or inclusion of non-template files (e.g.,
.logfiles). - Detect sudden execution of atypical PHP functions or system command execution originating from log file paths.
- Automated tooling:
- Use security scanners or SAST tools configured to detect dynamic file inclusion and log injection patterns.
- Integrate checks into CI/CD pipelines to prevent introduction of new file-include-based templating features without strict path controls.

