Get a Demo

Let's Patch It!

Book a short call with one our specialists, we'll walk you through how Endor Patches work, and ask you a few questions about your environment (like your primary programming languages and repository management). We'll also send you an email right after you fill out the form, feel free to reply with any questions you have in advance!

CVE

CVE-2026-28492

FileBrowser has Path Traversal in Public Share Links that Exposes Files Outside Shared Directory
Back to all
CVE

CVE-2026-28492

FileBrowser has Path Traversal in Public Share Links that Exposes Files Outside Shared Directory

Summary

When a user creates a public share link for a directory, the withHashFile middleware in http/public.go (line 59) uses filepath.Dir(link.Path) to compute the BasePathFs root. This sets the filesystem root to the parent directory instead of the shared directory itself, allowing anyone with the share link to browse and download files from all sibling directories.

Details

In http/public.go lines 52-64, the withHashFile function handles public share link requests:

basePath := link.Path    // e.g. "/documents/shared"
filePath := ""
if file.IsDir {
    basePath = filepath.Dir(basePath)  // BUG: becomes "/documents" (parent!)
    filePath = ifPath
}
d.user.Fs = afero.NewBasePathFs(d.user.Fs, basePath)

When a directory at /documents/shared is shared, filepath.Dir("/documents/shared") evaluates to "/documents". The BasePathFs is then rooted at the parent directory /documents/, giving the share link access to everything under /documents/ - not just the intended /documents/shared/.

This affects both publicShareHandler (directory listing via /api/public/share/{hash}) and publicDlHandler (file download via /api/public/dl/{hash}/path).

PoC

  1. Set up filebrowser with a user whose scope contains:
  2.    - /documents/shared/public-file.txt (intended to be shared)
  3.    - /documents/secrets/passwords.txt (NOT intended to be shared)
  4.    - /documents/private/financial.csv (NOT intended to be shared)
  5. Create a public share link for the directory /documents/shared (via POST /api/share/documents/shared)
  6. Access the share link: GET /api/public/share/{hash}
  7.    - Expected: Lists only contents of /documents/shared/
  8.    - Actual: Lists contents of /documents/ (parent), revealing secrets/private/, and shared/ directories
  9. Download sibling files: GET /api/public/dl/{hash}/secrets/passwords.txt
  10.    - Expected: 404 or 403 (file outside share scope)
  11.    - Actual: 200 with file contents (sibling file downloaded successfully)

Standalone Go test reproducing the exact vulnerable code path with afero.NewBasePathFs:

func TestShareScopeEscape(t *testing.T) {
    baseFs := afero.NewMemMapFs()
    afero.WriteFile(baseFs, "/documents/shared/public.txt", []byte("public"), 0644)
    afero.WriteFile(baseFs, "/documents/secrets/passwords.txt", []byte("admin:hunter2"), 0644)
    linkPath := "/documents/shared"
    basePath := filepath.Dir(linkPath) // BUG: "/documents"
    scopedFs := afero.NewBasePathFs(baseFs, basePath)
    // Sibling file is accessible through the share:
    f, err := scopedFs.Open("/secrets/passwords.txt")
    // err is nil - file accessible! Content: "admin:hunter2"
}

This test passes, confirming the vulnerability.

Impact

Unauthenticated information disclosure (CWE-200, CWE-706). Anyone with a public share link for a directory can:

  • Browse all sibling directories and files of the shared directory
  • - Download any file within the parent directory scope
  • - This works without authentication (public shares) or after providing the share password (password-protected shares)

All filebrowser v2.x installations that use directory sharing are affected.

Recommended Fix

Remove the filepath.Dir() call and use link.Path directly as the BasePathFs root:

if file.IsDir {
    // Don't change basePath - keep it as link.Path
    filePath = ifPath
}
d.user.Fs = afero.NewBasePathFs(d.user.Fs, basePath)

Affected commit: e3d00d591b567a8bfe3b02e42ba586859002c77d (latest)

Filehttp/public.go, line 59

Package Versions Affected

Package Version
patch Availability
No items found.

Automatically patch vulnerabilities without upgrading

Fix Without Upgrading
Detect compatible fix
Apply safe remediation
Fix with a single pull request

CVSS Version

Severity
Base Score
CVSS Version
Score Vector
C
H
U
7.1
-
4.0
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
C
H
U
0
-
C
H
U
-

Related Resources

No items found.

References

https://github.com/filebrowser/filebrowser/security/advisories/GHSA-mr74-928f-rw69, https://nvd.nist.gov/vuln/detail/CVE-2026-28492, https://github.com/filebrowser/filebrowser/commit/31194fb57a5b92e7155219d7ec7273028fcb2e83, https://github.com/filebrowser/filebrowser, https://github.com/filebrowser/filebrowser/releases/tag/v2.61.0

Severity

6.5

CVSS Score
0
10

Basic Information

Ecosystem
Base CVSS
6.5
EPSS Probability
0.00048%
EPSS Percentile
0.1494%
Introduced Version
0
Fix Available
2.61.0

Fix Critical Vulnerabilities Instantly

Secure your app without upgrading.
Fix Without Upgrading