/

CVE-2026-48126

Severity:

HIGH RISK

(8.2)

Path Traversal in Algernon Domain Routing

CVE-2026-48126

Deferred

Vulnerability type

Category:

Path Traversal / Directory Traversal

CWE:

CWE-22, CWE-23, CWE-644

Impact:

Arbitrary File Read and Potential Server-Side Code Execution

Severity:

HIGH RISK

(8.2)

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

Algernon's domain routing logic trusts the client-supplied Host header when resolving the directory to serve, allowing path traversal outside the configured document root.

By sending a crafted Host value such as .., an attacker may gain arbitrary file read, directory listing, and, when Lua files are present, server-side Lua execution.

Affected context

This vulnerability affects Algernon web server deployments that:

  • Run versions prior to 1.17.8
  • Start the server with --domain explicitly or implicitly via --letsencrypt
  • Serve content from a configured --dir that has accessible parent directories containing sensitive files or .lua scripts

The issue is triggered when the server uses the client-provided Host header to construct the filesystem path without validating or constraining it to the intended document root.

Exploit preconditions

  • Attack surface: HTTP interface exposed by Algernon
  • Required access: Ability to send HTTP requests to the Algernon instance (no prior authentication required for basic exploitation)
  • Trigger point: The request handling logic that resolves the served directory using filepath.Join(dir, HostHeaderValue)
  • Why exploitation is possible: The Host header is treated as a trusted path segment, and filepath.Join is used without validation or normalization checks to ensure the resulting path remains within the document root, enabling .. components to escape the configured directory.

Why this happens

The core issue is improper restriction of the directory path used to locate web content, corresponding to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

Algernon's request handler takes the configured --dir and naively joins it with the client-controlled Host header using filepath.Join. Because there is no validation or canonicalization to enforce that the resulting path stays within the intended document root, an attacker can supply .. or similar constructs in the Host header to traverse one or more levels up the filesystem hierarchy. Subsequent file resolution and directory listing logic operate on this expanded path, exposing files and directories outside of the originally configured web root.

The behavior also intersects with CWE-23 (Relative Path Traversal) and CWE-644 (Improper Neutralization of HTTP Headers), as header data is being repurposed as a filesystem path component without sufficient sanitization.

Potential impact

  • Arbitrary file read from directories above the configured document root
  • Full directory listing of parent directories, revealing file names and structure
  • Server-side Lua execution if .lua files exist in parent directories, potentially leading to remote code execution
  • Exposure of application configuration files, secrets, or credentials stored in parent directories
  • Information disclosure about the underlying system and deployment layout

General mitigation guidance

Effective mitigation focuses on constraining filesystem access and treating header values as untrusted input:

  • Enforce strict validation of any value used to construct filesystem paths, rejecting or normalizing inputs that contain .., absolute paths, or path separators.
  • Decouple domain routing from direct filesystem paths by maintaining an explicit map from allowed hostnames to preconfigured directories instead of joining arbitrary header values.
  • Canonicalize and verify resulting paths after join operations to ensure they remain within the intended document root, failing requests that resolve outside this boundary.
  • Avoid executing server-side scripts (such as .lua files) from directories that might be reached by user-influenced paths, or restrict script locations to trusted, non-traversable locations.
  • Run the server with least-privilege file permissions so that even if traversal occurs, sensitive files are not readable or executable by the web server process.

How teams detect issues like this

Organizations can identify and monitor for this class of issue through a combination of code and runtime analysis:

  • Static analysis: Search for usage of filepath.Join or similar APIs where any part of the path originates from request headers (especially Host) or other user-controlled data, and flag missing validation or boundary checks.
  • Code review: During manual review, treat any use of HTTP headers as untrusted, and scrutinize places where they influence routing, directory selection, or script execution paths.
  • Security testing: Use dynamic testing or fuzzing tools to send crafted Host headers containing .. segments and observe whether directory listings or unexpected files become accessible.
  • Policy enforcement: Incorporate linting or CI rules that prohibit direct use of Host header values in filesystem path construction, requiring an intermediate mapping layer or whitelist.

Sources

SourceLink
github.comgithub.com/xyproto/algernon/security/advisories/GHSA-jc3j-x6pg-4hmv

Frequently asked

questions

Any client that can reach the Algernon HTTP service while it is running with --domain or --letsencrypt can attempt to exploit the issue by manipulating the Host header, without needing prior authentication in typical configurations.

The attacker needs network-level access to send HTTP requests to the server. No file system access or local account is required, although the impact depends on which files and directories are readable or contain .lua scripts.

The safest approach is to stop using user-supplied values (like Host headers) directly as path components. Instead, maintain an explicit, validated mapping from known hostnames to predefined directories, and enforce post-join checks that ensure any resolved path stays within the configured document root before serving content.

Establish a development practice that treats all header and request fields as untrusted, require canonicalization and boundary checks for any path derived from user input, and incorporate automated checks in CI to flag path joins that do not include validation or confinement to a safe base directory.

Find out what's already
exploitable in your codebase.