/

CVE-2026-28679

Severity:

HIGH RISK

(8.6)

Path Traversal in Home-Gallery File Download Handler

CVE-2026-28679

Analyzed

Vulnerability type

Category:

Path Traversal / Directory Traversal

CWE:

CWE-22

Impact:

Unauthorized File Disclosure

Severity:

HIGH RISK

(8.6)

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 flaw in Home-Gallery's download functionality allows users to request files outside the intended media source directory.

If an attacker can craft arbitrary download paths, they may be able to access sensitive system files on the host running the gallery.

Affected context

This vulnerability appears in Home-Gallery instances where the download endpoint accepts a file path or identifier and directly maps it to the filesystem.

The issue arises when the server does not enforce that requested files reside strictly within the configured media source directory.

Deployments where the gallery server runs with access to broader system paths (e.g., /etc, user home directories, configuration directories) are more exposed, as the process may read files beyond the media library.

Exploit preconditions

  • Attack surface: HTTP(S) download endpoint exposed by the Home-Gallery web interface
  • Required access: Ability to trigger file downloads (typically any user who can access the gallery's download feature)
  • Trigger point: Supplying a crafted path in the download request that traverses out of the media source directory
  • Why exploitation is possible: The server trusts the requested path without validating that it resolves to a location within the configured media source directory, enabling directory traversal sequences (e.g., ../) or equivalent constructs to escape the intended root.

Why this happens

The underlying bug is a classic directory traversal issue, aligning with CWE-22: Improper Limitation of a Pathname to a Restricted Directory.

The application constructs filesystem paths directly from user-supplied input and then serves the resulting file without robust checks that:

  • Normalize and canonicalize the final path, and
  • Enforce that it remains within a defined base directory (the media source).

This pattern allows an attacker to manipulate path components to escape the intended directory and access arbitrary readable files on the server.

Potential impact

  • Access to sensitive system configuration files that the gallery process can read
  • Disclosure of credentials, API keys, or tokens stored in local configuration files
  • Exposure of other users' private data on the same host
  • Leakage of application secrets that could facilitate further compromise of the environment
  • Collection of information useful for subsequent targeted attacks (e.g., user enumeration, system layout)

General mitigation guidance

Effective mitigation centers on strictly confining file access to a well-defined directory and rejecting any paths that resolve outside it.

Recommended defensive patterns include:

  • Constructing file paths using server-side mapping from safe identifiers (e.g., database IDs) rather than raw client-supplied paths.
  • Normalizing and canonicalizing requested paths and verifying that the result still begins with the expected media source directory.
  • Implementing deny-by-default rules for any path containing traversal tokens or absolute path prefixes when not explicitly permitted.
  • Running the gallery under a dedicated, least-privileged account with minimal filesystem permissions beyond the media directory.
  • Separating media storage from system and configuration directories to limit damage if a path validation issue occurs.

How teams detect issues like this

Detection typically combines code-level checks with runtime monitoring:

  • Static analysis and code review:
  • Flag any use of user-controlled strings being concatenated into filesystem paths.
  • Verify that all file-serving code paths perform canonicalization and root-directory checks.
  • Enforce secure coding guidelines for file access through automated linters or SAST tools.
  • Configuration and policy enforcement:
  • Apply policies that restrict the application's filesystem permissions (e.g., via containers, chroot, or sandboxing).
  • Use infrastructure-as-code checks to ensure media directories are isolated from sensitive system paths.
  • Runtime monitoring:
  • Collect and analyze access logs for suspicious path patterns (e.g., repeated ../ sequences or requests for known sensitive files).
  • Use intrusion detection systems that trigger alerts on attempts to access critical files via web endpoints.

Sources

SourceLink
github.comgithub.com/xemle/home-gallery/releases/tag/v1.21.0
github.comgithub.com/xemle/home-gallery/security/advisories/GHSA-xj65-hcj5-h6j3

Frequently asked

questions

Yes. Any remote user who can interact with the download endpoint and supply or influence the requested file path may be able to exploit the issue over HTTP(S).

It depends on how the gallery is deployed. If downloads are available to unauthenticated visitors, the issue can be exploited anonymously. If downloads require login, an attacker must first obtain valid user access but does not necessarily need elevated privileges.

The most robust fix is to decouple user input from raw filesystem paths by mapping safe identifiers to files, and to strictly enforce that any resolved path remains within the configured media directory after canonicalization. Additionally, deny any request that attempts to reference locations outside that directory.

Adopt a secure-by-default file access layer that centralizes path construction, canonicalization, and boundary checks; enforce coding standards around file operations; and include automated static analysis or code review rules focused on directory traversal and path manipulation issues.

Find out what's already
exploitable in your codebase.