/

CVE-2026-25891

Severity:

HIGH RISK

(7.5)

Path Traversal in Fiber Static Middleware on Windows

CVE-2026-25891

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read

Severity:

HIGH RISK

(7.5)

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 the Fiber web framework's static file middleware on Windows allows remote attackers to bypass the sanitizer and read arbitrary files from the server's filesystem.

When the application serves static content and runs on Windows, crafted request paths can escape the intended web root and access sensitive files outside the static directory.

Affected context

This vulnerability arises in Go applications using the Fiber v3 framework (up to and including 3.0.0) that:

  • Run on Windows systems
  • Use Fiber's static middleware to serve files from a directory
  • Rely on the built-in sanitizer to confine requests to a specific static root

Under these conditions, specially crafted paths can traverse outside the configured static directory, despite the intended sanitization.

Exploit preconditions

  • Attack surface: HTTP(S) endpoints served by Fiber's static middleware
  • Required access: Remote network access to the application; no prior authentication is strictly required if static routes are public
  • Trigger point: Sending crafted path requests (e.g., encoded or specially formed traversal sequences) to static file routes
  • Why exploitation is possible: The path normalization and sanitization logic on Windows does not fully account for all traversal patterns and platform-specific path semantics, allowing user-controlled paths to resolve outside the intended directory.

Why this happens

The root cause is incomplete path canonicalization and validation in the static middleware on Windows.

The middleware attempts to sanitize user-supplied paths but does not correctly handle all forms of traversal (e.g., relative segments, mixed separators, or platform-specific quirks), enabling crafted input to escape the configured static root.

This aligns with CWE-22: Path Traversal, where user-controlled path segments are insufficiently constrained before being used to access filesystem resources.

Potential impact

  • Disclosure of sensitive configuration files that may contain secrets or credentials
  • Exposure of application source code and internal logic
  • Leakage of system information that can facilitate further attacks
  • Access to log files that may contain session identifiers or user data

General mitigation guidance

Effective mitigation focuses on strict path handling and defense-in-depth around file serving:

  • Ensure any file-serving middleware performs robust, platform-aware path canonicalization before filesystem access.
  • Enforce that resolved paths are strictly contained within an expected base directory by checking against an absolute, canonical root path.
  • Avoid exposing more of the filesystem than necessary; serve only explicit, well-defined static directories.
  • Apply least-privilege principles to the application process so that even if traversal occurs, access to sensitive system locations is constrained.
  • Consider additional application-level checks (e.g., explicit allowlists of file extensions or subdirectories) to reduce the risk of sensitive file disclosure.

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis and code review: Flagging any use of user-controlled paths passed into filesystem APIs (os.Open, io/fs, etc.) without strict normalization and root checking.
  • Configuration and route review: Inspecting Fiber configurations where static middleware is used, verifying that sanitization is not solely trusted and that no broad mappings expose large directory trees.
  • Runtime monitoring: Using web application firewalls or logging to detect suspicious path patterns (e.g., ../, mixed separators, or encoded traversal sequences) in HTTP requests.
  • Security testing: Incorporating automated and manual path traversal tests into CI/CD pipelines and periodic penetration tests, with special attention to Windows-specific path semantics.

Sources

SourceLink
github.comgithub.com/gofiber/fiber/commit/59133702301c2ab7b776dd123b474cbd995f2c86
github.comgithub.com/gofiber/fiber/pull/4064
github.comgithub.com/gofiber/fiber/security/advisories/GHSA-m3c2-496v-cw3v

Frequently asked

questions

Yes. Any remote client that can reach the Fiber application's static routes on a Windows deployment can attempt to exploit this by sending crafted HTTP requests.

Not necessarily. If the static middleware is exposed on a public route, an unauthenticated attacker may exploit it. If static routes are access-controlled, the attacker needs whatever level of access is required to reach those routes.

The safest pattern is to perform rigorous, platform-aware path canonicalization, resolve requested paths against a known static root, and verify that the final canonical path remains within that root before accessing the filesystem. Additionally, minimize what is served and avoid mapping static handlers to sensitive directories.

Treat any user-influenced file path as untrusted input. Use well-tested framework functionality for static file serving, enforce strict root-directory checks, add automated tests for traversal attempts (including encoded and platform-specific variants), and integrate code review and static analysis rules that flag direct use of unvalidated paths in file operations.

Find out what's already
exploitable in your codebase.