Summary
osTicket's ticket PDF export feature contains a server-side injection flaw where crafted rich-text HTML is passed to the mPDF engine without sufficient sanitization, allowing PHP filter expressions to be interpreted during PDF generation.
A remote attacker who can submit tickets and export them to PDF can abuse these filters to embed arbitrary local files from the server filesystem into the generated PDF, exposing sensitive data within the privileges of the osTicket application user.
Affected context
This vulnerability affects osTicket deployments that:
- Allow guests to create tickets and view ticket status, or have user self-registration enabled
- Support rich-text (HTML) content in ticket bodies or replies
- Use the built-in ticket PDF export feature backed by mPDF
The issue manifests when user-supplied HTML is passed to mPDF in a way that allows PHP filter expressions or similar constructs to influence how remote or local resources are loaded during PDF generation.
Exploit preconditions
- Attack surface: Public-facing ticket submission and ticket view endpoints that support PDF export.
- Required access: Ability to:
- Create or control ticket content (e.g., as a guest or registered user), and
- Trigger PDF export for that ticket (e.g., from ticket status view or user portal).
- Trigger point: Exporting a ticket containing crafted rich-text HTML to PDF, causing mPDF to process attacker-controlled resource references.
- Why exploitation is possible: HTML content is insufficiently sanitized before being handed to mPDF, enabling injection of PHP filter or similar expressions that cause mPDF to read local files and embed their contents as images or other resources in the resulting PDF.
Why this happens
The core problem is inadequate sanitization of user-controlled HTML before it is consumed by a server-side rendering engine (mPDF).
mPDF supports a variety of resource loading and filter mechanisms, and when attacker-supplied HTML can influence those mechanisms, it creates a pathway for server-side injection.
Instead of strictly validating or normalizing URLs, resource references, and filter expressions, the implementation passes rich-text directly to mPDF, which interprets embedded expressions and allows access to local files.
This maps to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, because special syntax intended for the PDF engine is introduced through untrusted input and executed in a privileged server-side context.
Potential impact
- Disclosure of configuration files that may contain database credentials or API keys.
- Exposure of application source code that can reveal additional vulnerabilities.
- Leakage of log files, including potentially sensitive user data or internal paths.
- Access to other readable files under the osTicket application user account, enabling further reconnaissance and targeted attacks.
- Facilitation of subsequent compromise through credential reuse or knowledge of internal system details.
General mitigation guidance
Effective mitigation focuses on hardening the interface between user input and the PDF generation engine:
- Restrict the allowed HTML subset for tickets to a minimal, well-understood set of tags and attributes, rejecting or stripping anything else.
- Neutralize or remove constructs that can be interpreted as protocol handlers, filters, or file paths by downstream components (e.g., special URL schemes, filter expressions).
- Use a robust HTML sanitizer or rich-text pipeline that performs allowlist-based validation rather than ad hoc blacklisting.
- Treat all content passed into mPDF (or any HTML-to-PDF engine) as untrusted and normalize resource URLs, blocking access to local or non-HTTP(S) schemes.
- Run the application and PDF renderer with least-privilege filesystem access, reducing which files are readable even if an injection occurs.
- Consider separating the PDF generation process into an isolated service or container with constrained file and network access.
How teams detect issues like this
Detection can combine code-level review with runtime monitoring:
- Static analysis and code review:
- Identify all paths where user-supplied HTML or rich-text is passed to mPDF or similar PDF rendering libraries.
- Flag use of raw HTML, unvalidated URLs, or filter-like constructs that are passed directly to downstream components.
- Review sanitization and encoding logic to confirm allowlist-based filtering of tags, attributes, and URL schemes.
- Policy and configuration checks:
- Enforce internal guidelines that prohibit untrusted HTML from being rendered server-side without passing through vetted sanitizers.
- Require explicit validation for any file path, stream wrapper, or filter syntax reachable from user input.
- Runtime and log monitoring:
- Monitor application and web server logs for unusual resource access patterns during PDF generation (e.g., attempts to access configuration files or non-standard paths).
- Use security monitoring tools or WAF rules to detect and block payloads containing suspicious filter expressions or protocol handlers in ticket content.
- Automated SAST/DAST tools can assist in flagging injection patterns into PDF generators and other rendering engines, but should be complemented with manual review for context.

