GHSA-88g4-74f3-63x9: Thorsten/phpmyfaq Path Traversal Vulnerability

MODERATE
CVSS 4.9
CWE-22
Published
Advisory Summary

GHSA-88g4-74f3-63x9 is a MODERATE (CVSS 4.9) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Thorsten/phpmyfaq libraries in the Packagist ecosystem. The issue involves phpmyfaq has potential authenticated path traversal in pdf export. Remediation is available by upgrading affected packages to version 4.1.5.

GHSA-88g4-74f3-63x9 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-88g4-74f3-63x9
Severity MODERATE
CVSS v3.1 Base Score 4.9
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Thorsten/phpmyfaq
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 4.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix GHSA-88g4-74f3-63x9

To remediate this vulnerability, upgrade all affected Thorsten/phpmyfaq dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

thorsten/phpmyfaq fixed: 4.1.5
Upgrade thorsten/phpmyfaq to 4.1.5
phpmyfaq/phpmyfaq fixed: 4.1.5
Upgrade phpmyfaq/phpmyfaq to 4.1.5
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for thorsten/phpmyfaq

How to Check if You Are Affected

To determine whether your application is affected by GHSA-88g4-74f3-63x9, inspect your project dependencies for Thorsten/phpmyfaq:

inspect dependencies for thorsten/phpmyfaq

Analyze the terminal output to locate any version of Thorsten/phpmyfaq in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.1.5), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Thorsten/phpmyfaq, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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: ```php $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: ```php $trimmedFile = "../../../etc/passwd"; $pos = false; $relativePath = "../../../etc/passwd"; ``` The resulting path is later processed by: ```php file_get_contents($resolvedPath); ``` without canonicalization or a root-directory containment check. --- ## Observed Data Flow ```text 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: - Path traversal outside the intended content directory - Local file read attempts during PDF export - Possible disclosure of readable files depending on file type, sanitization behavior, and PDF rendering constraints --- ## 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: 1. A user with FAQ editing privileges creates or modifies a FAQ entry. 2. The FAQ content contains an HTML image tag with a crafted relative path that does not include the expected `content` directory reference. 3. The HTML content is stored and later processed by the PDF export functionality. 4. When a user requests the PDF version of the FAQ, the application invokes `WriteHTML()`, which eventually reaches `Wrapper::Image()`. 5. `concatenatePaths()` constructs a filesystem path without canonicalization or directory containment validation. 6. The resulting path reaches `file_get_contents()`, causing the application to attempt reading a file outside the intended content directory. 7. 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. --- ## Suggested Remediation Consider replacing substring-based path anchoring with: - `realpath()` canonicalization - Strict root-directory containment checks - Explicit allowlisting of permitted image locations

GHSA-88g4-74f3-63x9 Affected Thorsten/phpmyfaq Versions

2 component(s)
Fixed Versions:
4.1.5
Product / Package Ecosystem Affected Versions Fixed Version
thorsten/phpmyfaq
Packagist
≥ 4.0.0-alpha
< 4.1.5
4.1.5
phpmyfaq/phpmyfaq
Packagist
≥ 4.0.0-alpha
< 4.1.5
4.1.5

References

Frequently Asked Questions

What is GHSA-88g4-74f3-63x9?
GHSA-88g4-74f3-63x9 is a security vulnerability in Thorsten/phpmyfaq involving phpMyFAQ has Potential Authenticated Path Traversal in PDF Export under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Thorsten/phpmyfaq versions are affected?
Affected versions include releases prior to 4.1.5 across affected packages: thorsten/phpmyfaq, phpmyfaq/phpmyfaq.
What version fixes GHSA-88g4-74f3-63x9?
Upgrading to 4.1.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is thorsten/phpmyfaq affected?
Yes, thorsten/phpmyfaq is affected in releases prior to 4.1.5. Upgrade your dependency to 4.1.5 or later.
Is phpmyfaq/phpmyfaq affected?
Yes, phpmyfaq/phpmyfaq is affected in releases prior to 4.1.5. Upgrade your dependency to 4.1.5 or later.
What is the CVSS score of GHSA-88g4-74f3-63x9?
GHSA-88g4-74f3-63x9 has a CVSS v3.1 base score of 4.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with GHSA-88g4-74f3-63x9?
GHSA-88g4-74f3-63x9 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Packagist dependencies for GHSA-88g4-74f3-63x9?
Run the dependency tree command: 'inspect dependencies for thorsten/phpmyfaq'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-88g4-74f3-63x9",
  "modified" : "2026-08-25T17:28:56Z",
  "published" : "2026-08-25T17:28:56Z",
  "aliases" : [ ],
  "summary" : "phpMyFAQ has Potential Authenticated Path Traversal in PDF Export",
  "details" : "## Summary\n\nThere is an authenticated path traversal condition in the PDF export functionality, specifically within the PDF image resolution logic.\n\nThe issue may allow a privileged FAQ editor to cause the application to attempt reading files outside the intended content directory during PDF generation.\n\n---\n\n## Affected Component\n\n**File:**\n`src/phpMyFAQ/Export/Pdf/Wrapper.php`\n\n**Function:**\n`concatenatePaths()`\n\n---\n\n## Root Cause\n\nThe path resolution logic relies on locating the substring `\"content\"` within a user-controlled path:\n\n```php\n$pos = strpos($trimmedFile, 'content');\n$relativePath = substr($trimmedFile, (int) $pos);\n```\n\nIf `\"content\"` is not present, `strpos()` returns `false`, which becomes `0` when cast to an integer.\n\nAs a result, the entire attacker-controlled path is preserved.\n\nExample:\n\n```php\n$trimmedFile = \"../../../etc/passwd\";\n$pos = false;\n$relativePath = \"../../../etc/passwd\";\n```\n\nThe resulting path is later processed by:\n\n```php\nfile_get_contents($resolvedPath);\n```\n\nwithout canonicalization or a root-directory containment check.\n\n---\n\n## Observed Data Flow\n\n```text\nFAQ Content\n    ->\nPDF Export\n    ->\nWriteHTML()\n    ->\nWrapper::Image()\n    ->\nconcatenatePaths()\n    ->\nfile_get_contents()\n```\n\n---\n\n## Potential Impact\n\nBased 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.\n\nPotential consequences may include:\n\n- Path traversal outside the intended content directory\n- Local file read attempts during PDF export\n- Possible disclosure of readable files depending on file type, sanitization behavior, and PDF rendering constraints\n\n---\n\n## Discovery Method\n\nThis issue was initially detected by an internally developed SAST tool during analysis of the phpMyFAQ source code.\n\nThe finding was then manually investigated and validated through code review.\n\nWhile 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()`.\n\n---\n\n## Potential Exploitation Scenario\n\nThe following scenario is based on code review and intended to illustrate the potential impact:\n\n1. A user with FAQ editing privileges creates or modifies a FAQ entry.\n\n2. The FAQ content contains an HTML image tag with a crafted relative path that does not include the expected `content` directory reference.\n\n3. The HTML content is stored and later processed by the PDF export functionality.\n\n4. When a user requests the PDF version of the FAQ, the application invokes `WriteHTML()`, which eventually reaches `Wrapper::Image()`.\n\n5. `concatenatePaths()` constructs a filesystem path without canonicalization or directory containment validation.\n\n6. The resulting path reaches `file_get_contents()`, causing the application to attempt reading a file outside the intended content directory.\n\n7. 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.\n\nBased 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.\n\n---\n\n## Suggested Remediation\n\nConsider replacing substring-based path anchoring with:\n\n- `realpath()` canonicalization\n- Strict root-directory containment checks\n- Explicit allowlisting of permitted image locations",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "thorsten/phpmyfaq"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0-alpha"
      }, {
        "fixed" : "4.1.5"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.1.4"
    }
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpmyfaq/phpmyfaq"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0-alpha"
      }, {
        "fixed" : "4.1.5"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.1.4"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/thorsten/phpMyFAQ/security/advisories/GHSA-88g4-74f3-63x9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/thorsten/phpMyFAQ/commit/91ce64405479933d7d62c751fa79c2f5c6fda591"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/thorsten/phpMyFAQ/commit/b709ebe69405385785c2a74ae940c3e8d4cd0a8b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/thorsten/phpMyFAQ"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-25T17:28:56Z",
    "nvd_published_at" : null
  }
}