/

CVE-2026-34728

Severity:

HIGH RISK

(8.7)

Path Traversal in phpMyFAQ Media Browser

CVE-2026-34728

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Deletion within Application-Accessible Paths

Severity:

HIGH RISK

(8.7)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal vulnerability in phpMyFAQ's media browser file deletion logic allows user input to be concatenated directly into filesystem paths without proper validation.

Combined with missing CSRF protection, an attacker can trick an authenticated user into issuing crafted requests that may delete arbitrary files within the web server's accessible directories.

Affected context

This vulnerability occurs in the MediaBrowserController::index() method, specifically when handling the fileRemove action in phpMyFAQ's media browser.

The issue is present when:

  • File deletion is driven by a user-supplied name parameter
  • The application concatenates this name directly with the base upload directory path
  • There is no normalization or rejection of directory traversal sequences (e.g., ../)
  • CSRF protection is not enforced for this endpoint

It primarily affects deployments where authenticated users can access the media browser and the underlying PHP process has permission to delete files in the target directories.

Exploit preconditions

  • Attack surface: HTTP endpoint for the media browser's fileRemove action.
  • Required access: A victim user must be authenticated with permissions to use the media browser; the attacker can be unauthenticated if they rely on CSRF.
  • Trigger point: A crafted HTTP request (or malicious web page) that supplies a name parameter containing path traversal sequences, such as ../.
  • Why exploitation is possible:
  • The name parameter is concatenated to the base upload path with no directory traversal validation or canonicalization.
  • The FILTER_SANITIZE_SPECIAL_CHARS filter only encodes HTML special characters, leaving filesystem metacharacters (., /, \) untouched.
  • The endpoint does not enforce CSRF tokens, allowing an attacker to cause state-changing requests via a victim's browser session.

Why this happens

The root cause aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

The application treats a user-controlled name parameter as if it were a safe relative path and directly concatenates it with the base upload directory, without:

  • Normalizing the path
  • Rejecting .. components
  • Enforcing that the resolved path stays within the intended upload directory

Additionally, the absence of CSRF validation on the file deletion endpoint allows cross-origin sites to trigger this unsafe file deletion behavior on behalf of authenticated users.

Potential impact

  • Deletion of media files managed by the phpMyFAQ application
  • Deletion of other files within directories writable or deletable by the PHP process, depending on server configuration
  • Disruption of site content, including FAQs that rely on media assets
  • Potential deletion of configuration, cache, or log files if they are located under or reachable from the upload path
  • Increased impact of CSRF attacks, turning a simple link or embedded resource into a destructive action against the application's filesystem

General mitigation guidance

Effective mitigation focuses on both path handling and request integrity:

  • Constrain file operations to whitelisted locations:
  • Use server-side lookup keys or IDs rather than accepting raw filenames or paths from clients.
  • When paths must be accepted, normalize and canonicalize them, then verify that the resolved path remains strictly under the intended base directory.
  • Strictly validate filenames:
  • Reject any input containing directory separators (/, \), .., or other traversal-related characters.
  • Enforce an allowlist-based filename pattern (e.g., alphanumeric plus a small set of safe characters and an expected extension).
  • Apply defense-in-depth for filesystem access:
  • Run the application under a dedicated OS user with limited filesystem permissions, restricting what can be deleted.
  • Separate upload directories from configuration and application code to reduce potential damage.
  • Enforce CSRF protection on state-changing endpoints:
  • Require and validate CSRF tokens on all file deletion and modification actions.
  • Prefer same-site cookies and CSRF defenses that do not depend solely on headers under attacker control.

How teams detect issues like this

Detection typically combines code-focused and behavior-focused approaches:

  • Static analysis and code scanning:
  • Flag patterns where user input is concatenated into filesystem paths, especially in delete, move, or write operations.
  • Look for the presence of ../ or other traversal markers in input handling logic without subsequent validation or canonicalization.
  • Identify state-changing endpoints (e.g., delete operations) lacking CSRF token verification.
  • Targeted code review:
  • Review controllers and upload handlers for direct use of request parameters in filesystem APIs (unlink, fopen, rename, etc.).
  • Check that any path sanitization is robust and not limited to HTML-oriented filters like FILTER_SANITIZE_SPECIAL_CHARS.
  • Verify that CSRF protections are uniformly applied to all administrative and content-modifying routes.
  • Runtime and log analysis:
  • Monitor server logs for repeated access to file deletion endpoints with unusual name values (containing ../ or deeply nested paths).
  • Configure alerts for anomalous spikes in file deletion activity or unexpected 404s following intensive delete operations.

Automated SAST or security-focused code review tools can be configured to flag these patterns as part of continuous integration pipelines.

Sources

SourceLink
github.comgithub.com/thorsten/phpMyFAQ/releases/tag/4.1.1
github.comgithub.com/thorsten/phpMyFAQ/security/advisories/GHSA-38m8-xrfj-v38x

Frequently asked

questions

Yes. An attacker can exploit it remotely by crafting a malicious webpage that issues the file deletion request via CSRF, as long as a logged-in phpMyFAQ user visits that page in a browser that carries valid session cookies.

The attacker does not need their own account if they use CSRF. However, exploitation relies on a victim who is authenticated with sufficient permissions to access the media browser and whose browser can be induced to send the crafted request.

The safest fix pattern is to remove direct filename/path control from the client: use server-side identifiers for media objects, normalize and validate all resolved paths against a fixed base directory, and strictly reject any input that attempts to influence directory traversal. At the same time, enforce CSRF protection on all file-modifying endpoints.

Adopt a standard file-handling abstraction that centralizes path construction and validation, enforce a strict allowlist for file names, ensure that all state-changing actions are protected with CSRF tokens, and include automated checks in CI to detect unsafe path concatenation and missing CSRF validation in new code.

Find out what's already
exploitable in your codebase.