CVE-2026-25891: Github.com/gofiber/fiber/v3 Fiber Has An Arbitrary File Vulnerability

HIGH
Advisory Identifier: GHSA-m3c2-496v-cw3v
CWE-22
Published
Advisory Summary

CVE-2026-25891 is a HIGH fiber has an arbitrary file vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Github.com/gofiber/fiber/v3 libraries in the Go ecosystem. The issue involves fiber has an arbitrary file read in static middleware on windows. Remediation is available by upgrading affected packages to version 3.1.0.

CVE-2026-25891 at a Glance

CVE Identifier CVE-2026-25891
GHSA Identifier GHSA-m3c2-496v-cw3v
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Github.com/gofiber/fiber/v3
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2026-25891

To remediate this vulnerability, upgrade all affected Github.com/gofiber/fiber/v3 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/gofiber/fiber/v3 fixed: 3.1.0
Upgrade github.com/gofiber/fiber/v3 to 3.1.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/gofiber/fiber/v3

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-25891, inspect your project dependencies for Github.com/gofiber/fiber/v3:

inspect dependencies for github.com/gofiber/fiber/v3

Analyze the terminal output to locate any version of Github.com/gofiber/fiber/v3 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.1.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Github.com/gofiber/fiber/v3, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary **Description** A Path Traversal (CWE-22) vulnerability in Fiber allows a remote attacker to bypass the static middleware sanitizer and read arbitrary files on the server file system on Windows. This affects Fiber v3 through version 3.0.0. This has been patched in Fiber v3 version 3.1.0. ### Details The vulnerability resides in `middleware/static/static.go` within the `sanitizePath` function. This function attempts to sanitize the requested path by checking for backslashes, decoding the URL, and then cleaning the path. The vulnerability stems from two combined issues: - The check for backslash characters happens before the URL decoding loop. If an attacker sends a double-encoded backslash, the initial check sees `%255C` and passes. The loop then decodes this into a single backslash. - The function uses `path.Clean` to clean the resulting string. `path.Clean` is designed for slash-separated paths and does not recognize backslashes as directory separators. Consequently, sequences like `..\..\` are treated as valid filenames. When this sanitized path is later used, the backslashes are interpreted as valid separators, allowing the attacker to traverse up the directory tree. ```go // pkg/static/static.go func sanitizePath(p []byte, filesystem fs.FS) ([]byte, error) { ... // this check happens BEFORE decoding if bytes.IndexByte(p, '\\') >= 0 { ... } // This loop decodes %255C to %5C to \ for strings.IndexByte(s, '%') >= 0 { us, err := url.PathUnescape(s) ... s = us } // path.Clean only understands forward slashes (/) s = pathpkg.Clean("/" + s) ... return utils.UnsafeBytes(s), nil } ``` ### Impact This impacts Fiber v3 prereleases through stable release version 3.0.0. Successful exploitation requires the server to be using the static middleware on Windows, as this is the only OS where backslashes are treated as directory separators by the file system. Exploitation allows directory traversal on the host server. An attacker can read arbitrary files within the scope of the application server context. Depending on permissions and deployment conditions, attackers may access sensitive files outside the web root, such as configuration files, source code, or system files. Leaking application secrets often leads to further compromise. ### Patches This has been [patched](https://github.com/gofiber/fiber/pull/4064) in Fiber v3 version 3.1.0. Users are strongly encouraged to update to the latest available release.

CVE-2026-25891 Affected Github.com/gofiber/fiber/v3 Versions

1 component(s)
Fixed Versions:
3.1.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/gofiber/fiber/v3
Go
< 3.1.0
3.1.0

References

Frequently Asked Questions

What is CVE-2026-25891?
CVE-2026-25891 is a security vulnerability in Github.com/gofiber/fiber/v3 involving Fiber has an Arbitrary File Read in Static Middleware on Windows under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Github.com/gofiber/fiber/v3 versions are affected?
Affected versions include releases prior to 3.1.0 across affected packages: github.com/gofiber/fiber/v3.
What version fixes CVE-2026-25891?
Upgrading to 3.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/gofiber/fiber/v3 affected?
Yes, github.com/gofiber/fiber/v3 is affected in releases prior to 3.1.0. Upgrade your dependency to 3.1.0 or later.
What CWE is associated with CVE-2026-25891?
CVE-2026-25891 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Go dependencies for CVE-2026-25891?
Run the dependency tree command: 'inspect dependencies for github.com/gofiber/fiber/v3'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-m3c2-496v-cw3v",
  "modified" : "2026-02-27T20:04:39Z",
  "published" : "2026-02-24T20:51:01Z",
  "aliases" : [ "CVE-2026-25891" ],
  "summary" : "Fiber has an Arbitrary File Read in Static Middleware on Windows",
  "details" : "### Summary\n\n**Description**\nA Path Traversal (CWE-22) vulnerability in Fiber allows a remote attacker to bypass the static middleware sanitizer and read arbitrary files on the server file system on Windows. This affects Fiber v3 through version 3.0.0. This has been patched in Fiber v3 version 3.1.0.\n \n### Details\nThe vulnerability resides in `middleware/static/static.go` within the `sanitizePath` function. This function attempts to sanitize the requested path by checking for backslashes, decoding the URL, and then cleaning the path.\n\nThe vulnerability stems from two combined issues:\n- The check for backslash characters happens before the URL decoding loop. If an attacker sends a double-encoded backslash, the initial check sees `%255C` and passes. The loop then decodes this into a single backslash.\n- The function uses `path.Clean` to clean the resulting string. `path.Clean` is designed for slash-separated paths  and does not recognize backslashes as directory separators. Consequently, sequences like `..\\..\\` are treated as valid filenames.\n\nWhen this sanitized path is later used, the backslashes are interpreted as valid separators, allowing the attacker to traverse up the directory tree.\n```go\n// pkg/static/static.go\nfunc sanitizePath(p []byte, filesystem fs.FS) ([]byte, error) {\n    ...\n    // this check happens BEFORE decoding\n    if bytes.IndexByte(p, '\\\\') >= 0 {\n        ...\n    } \n    // This loop decodes %255C to %5C to \\\n    for strings.IndexByte(s, '%') >= 0 {\n        us, err := url.PathUnescape(s)\n        ...\n        s = us\n    }\n    // path.Clean only understands forward slashes (/)\n    s = pathpkg.Clean(\"/\" + s)\n    ...\n    return utils.UnsafeBytes(s), nil\n}\n```\n\n### Impact\n\nThis impacts Fiber v3 prereleases through stable release version 3.0.0.\n\nSuccessful exploitation requires the server to be using the static middleware on Windows, as this is the only OS where backslashes are treated as directory separators by the file system.\n\nExploitation allows directory traversal on the host server. An attacker can read arbitrary files within the scope of the application server context. Depending on permissions and deployment conditions, attackers may access sensitive files outside the web root, such as configuration files, source code, or system files. Leaking application secrets often leads to further compromise.\n\n### Patches\n\nThis has been [patched](https://github.com/gofiber/fiber/pull/4064) in Fiber v3 version 3.1.0.  Users are strongly encouraged to update to the latest available release.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/gofiber/fiber/v3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.1.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.0.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/gofiber/fiber/security/advisories/GHSA-m3c2-496v-cw3v"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-25891"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gofiber/fiber/pull/4064"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gofiber/fiber/commit/59133702301c2ab7b776dd123b474cbd995f2c86"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gofiber/fiber"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2026-4540"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-02-24T20:51:01Z",
    "nvd_published_at" : "2026-02-24T22:16:31Z"
  }
}