thorsten/phpmyfaq
Affected
- introduced
4.0.0-alpha, fixed4.1.5(ecosystem)
Fixed versions
4.1.5
Fix
The export has no generic command for this ecosystem.
Advisory
Also known as: CVE-2026-57961
phpMyFAQ has Potential Authenticated Path Traversal in PDF Export
Summary
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.
---
Affected Component
File:src/phpMyFAQ/Export/Pdf/Wrapper.php
Function:concatenatePaths()
---
Root Cause
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.
---
Observed Data Flow
FAQ Content
->
PDF Export
->
WriteHTML()
->
Wrapper::Image()
->
concatenatePaths()
->
file_get_contents()
---
Potential Impact
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:
---
Discovery Method
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().
---
Potential Exploitation Scenario
The following scenario is based on code review and intended to illustrate the potential impact:
content directory reference.WriteHTML(), which eventually reaches Wrapper::Image().concatenatePaths() constructs a filesystem path without canonicalization or directory containment validation.file_get_contents(), causing the application to attempt reading a file outside the intended content directory.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.
---
Suggested Remediation
Consider replacing substring-based path anchoring with:
realpath() canonicalizationMedium Basis: The source's own band: MODERATE
4.0.0-alpha, fixed 4.1.5 (ecosystem)4.1.5
The export has no generic command for this ecosystem.
4.0.0-alpha, fixed 4.1.5 (ecosystem)4.1.5
The export has no generic command for this ecosystem.
Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0