There is an authenticated path traversal condition in the PDF export functionality, specifically within the PDF image resolution logic.
The issue may allow a privileged FAQ editor to cause the application to attempt reading files outside the intended content directory during PDF generation.
File:
src/phpMyFAQ/Export/Pdf/Wrapper.php
Function:
concatenatePaths()
The path resolution logic relies on locating the substring "content" within a user-controlled path:
$pos = strpos($trimmedFile, 'content');
$relativePath = substr($trimmedFile, (int) $pos);
If "content" is not present, strpos() returns false, which becomes 0 when cast to an integer.
As a result, the entire attacker-controlled path is preserved.
Example:
$trimmedFile = "../../../etc/passwd";
$pos = false;
$relativePath = "../../../etc/passwd";
The resulting path is later processed by:
file_get_contents($resolvedPath);
without canonicalization or a root-directory containment check.
FAQ Content
->
PDF Export
->
WriteHTML()
->
Wrapper::Image()
->
concatenatePaths()
->
file_get_contents()
Based on code review, a user with FAQ editing privileges may be able to store HTML containing crafted image paths that are processed during PDF generation.
Potential consequences may include:
This issue was initially detected by an internally developed SAST tool during analysis of the phpMyFAQ source code.
The finding was then manually investigated and validated through code review.
While the original scanner output classified the issue as a generic path traversal/local file inclusion pattern, manual analysis identified the specific root cause in the path resolution logic of concatenatePaths().
The following scenario is based on code review and intended to illustrate the potential impact:
A user with FAQ editing privileges creates or modifies a FAQ entry.
The FAQ content contains an HTML image tag with a crafted relative path that does not include the expected content directory reference.
The HTML content is stored and later processed by the PDF export functionality.
When a user requests the PDF version of the FAQ, the application invokes WriteHTML(), which eventually reaches Wrapper::Image().
concatenatePaths() constructs a filesystem path without canonicalization or directory containment validation.
The resulting path reaches file_get_contents(), causing the application to attempt reading a file outside the intended content directory.
Depending on sanitization behavior, file permissions, image validation, and PDF rendering behavior, the contents of the targeted file may potentially be exposed to the PDF consumer.
Based on my current analysis, exploitation would require a user capable of editing FAQ content and is therefore not considered an anonymous or unauthenticated attack vector.
Consider replacing substring-based path anchoring with:
realpath() canonicalization| Software | Affected versions |
|---|---|
thorsten / phpmyfaq
|
>= 4.0.0-alpha, < 4.1.5 |
phpmyfaq / phpmyfaq
|
>= 4.0.0-alpha, < 4.1.5 |
A security vulnerability is a weakness in software, hardware, or configuration that can be exploited to compromise confidentiality, integrity, or availability. Many vulnerabilities are tracked as CVEs (Common Vulnerabilities and Exposures), which provide a standardized identifier so teams can coordinate patching, mitigation, and risk assessment across tools and vendors.
CVSS (Common Vulnerability Scoring System) estimates technical severity, but it doesn't automatically equal business risk. Prioritize using context like internet exposure, affected asset criticality, known exploitation (proof-of-concept or in-the-wild), and whether compensating controls exist. A "Medium" CVSS on an exposed, production system can be more urgent than a "Critical" on an isolated, non-production host.
A vulnerability is the underlying weakness. An exploit is the method or code used to take advantage of it. A zero-day is a vulnerability that is unknown to the vendor or has no publicly available fix when attackers begin using it. In practice, risk increases sharply when exploitation becomes reliable or widespread.
Recurring findings usually come from incomplete Asset Discovery, inconsistent patch management, inherited images, and configuration drift. In modern environments, you also need to watch the software supply chain: dependencies, containers, build pipelines, and third-party services can reintroduce the same weakness even after you patch a single host. Unknown or unmanaged assets (often called Shadow IT) are a common reason the same issues resurface.
Use a simple, repeatable triage model: focus first on externally exposed assets, high-value systems (identity, VPN, email, production), vulnerabilities with known exploits, and issues that enable remote code execution or privilege escalation. Then enforce patch SLAs and track progress using consistent metrics so remediation is steady, not reactive.
SynScan combines attack surface monitoring and continuous security auditing to keep your inventory current, flag high-impact vulnerabilities early, and help you turn raw findings into a practical remediation plan.