/

CVE-2026-53519

Severity:

CRITICAL RISK

(9.1)

Path Traversal (CWE-22) in Nezha Monitoring Dashboard

CVE-2026-53519

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read / Information Disclosure

Severity:

CRITICAL RISK

(9.1)

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 Nezha Monitoring's dashboard NoRoute handler allows arbitrary file reads when URLs starting with /dashboard are treated as admin asset requests.

By abusing prefix and path normalization logic, an unauthenticated attacker can request files outside the intended frontend directory, exposing sensitive configuration and operational data.

Affected context

The vulnerability occurs in Nezha Monitoring deployments where the dashboard is exposed over HTTP/HTTPS and the NoRoute handler falls back to serving admin frontend assets.

Any request whose raw path string starts with /dashboard is considered an admin asset request, regardless of path segment boundaries.

When such paths are processed with naive prefix trimming and path.Join, components like ../ may escape the admin asset directory and resolve to files in the broader server filesystem.

Exploit preconditions

  • Attack surface: Public or internal Nezha Monitoring dashboard HTTP endpoint.
  • Required access: No authentication; any network client that can reach the dashboard can send crafted URLs.
  • Trigger point: A specially crafted URL whose raw path starts with /dashboard but includes traversal-like segments (e.g., ..) in subsequent components.
  • Why exploitation is possible: The NoRoute handler:
  • Uses strings.HasPrefix instead of path-segment-aware checks to identify /dashboard asset requests.
  • Removes the prefix with strings.TrimPrefix, leaving attacker-controlled relative path components.
  • Calls path.Join("admin-dist", attack-controlled-path), which normalizes ../ sequences and can resolve to files outside the admin-dist directory.
  • Serves the resolved file with http.ServeFile if os.Stat confirms its existence, without access control.

Why this happens

The core issue is improper restriction of path traversal in file-serving logic, mapping to CWE-22: Improper Limitation of a Pathname to a Restricted Directory.

Instead of interpreting the URL path in terms of canonical path segments confined to a fixed root, the handler:

  • Treats any string starting with /dashboard as trusted to reference frontend assets.
  • Performs string-based prefix trimming and generic path joining, allowing ../ sequences to escape the intended admin-dist root.

This design conflates user-supplied URL paths with trusted filesystem paths, failing to enforce a hard boundary between the public HTTP namespace and the server's internal directory structure.

Potential impact

  • Exposure of sensitive configuration files (e.g., YAML, JSON, or environment-specific configs) that may contain credentials or API keys.
  • Disclosure of operational data such as logs, status files, or internal metadata that could aid further attacks.
  • Leakage of source code or template files, enabling deeper analysis of the application and identification of additional vulnerabilities.
  • Indirect compromise of other systems if secrets or tokens stored on disk are retrieved and reused.

General mitigation guidance

Effective mitigation focuses on constraining file-serving endpoints and hardening path handling:

  • Enforce a strict document root: resolve requested paths relative to a fixed base directory and reject any request whose canonical path escapes that base.
  • Use path-segment-aware routing and checks instead of raw string prefix matching for paths like /dashboard.
  • Normalize and validate paths before any filesystem lookup; explicitly reject paths containing .., absolute path markers, or other disallowed constructs.
  • Serve static assets via a dedicated, minimal file server or framework helper that is designed to prevent directory traversal, rather than hand-rolling prefix and join logic.
  • Limit the sensitivity of files colocated near static assets; avoid placing configuration, secrets, or logs within the same directory tree when possible.

How teams detect issues like this

Detection typically involves a combination of code-centric and behavior-centric approaches:

  • Static analysis / code review:
  • Flag use of strings.HasPrefix or similar string functions to gate file-serving logic for paths under a specific prefix (e.g., /dashboard).
  • Identify any uses of path.Join or equivalent where user-controlled path segments are joined with a base directory and then passed to os.Stat, http.ServeFile, or related APIs without canonicalization checks.
  • Look for missing validations against .. or absolute-path indicators in URL-to-filesystem translation code.
  • Automated tools and policies:
  • Enable SAST rules targeting directory traversal patterns and untrusted path operations.
  • Establish secure coding guidelines that require centralized helpers for serving static assets, and enforce them through PR templates or linters.
  • Runtime monitoring:
  • Inspect web access logs for suspicious paths containing .., nested /dashboard segments, or attempts to fetch configuration-like files (e.g., config.yaml, .env, docker-compose.yml).

Sources

SourceLink
github.comgithub.com/nezhahq/nezha/security/advisories/GHSA-5c25-7vpj-9mqh

Frequently asked

questions

Yes. Any remote client that can reach the Nezha Monitoring dashboard over the network can attempt to exploit this flaw by sending crafted HTTP requests; no prior authentication is required.

Only network-level access to the dashboard endpoint is needed. The path traversal occurs before any authentication or authorization checks are applied to the request.

Constrain all file-serving logic to a well-defined document root and ensure that the canonicalized request path cannot escape that root. Replace string-based prefix checks with path-segment-aware routing and reject any request containing traversal patterns or resolving outside the intended directory.

Use framework-provided static file handlers, centralize URL-to-filesystem mapping in vetted helpers, and require canonical path validation for any file access derived from user input. Combine these practices with static analysis rules and code review checklists that specifically look for directory traversal and unsafe path handling patterns.

Find out what's already
exploitable in your codebase.