{"id":"CVE-2026-28492","aliases":["CVE-2026-28492","GHSA-mr74-928f-rw69","GO-2026-4585"],"related":[],"kind":"vulnerability","state":"published","title":"File Browser: Path Traversal in Public Share Links Exposes Files Outside Shared Directory","summary":"File Browser provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit files. Prior to version 2.61.0, when a user creates a public share link for a directory, the withHashFile middleware in http/public.go 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. This issue has been patched in version 2.61.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"File Browser provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit files. Prior to version 2.61.0, when a user creates a public share link for a directory, the withHashFile middleware in http/public.go 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. This issue has been patched in version 2.61.0.","source":"cvelist"},{"lang":"en","text":"### Summary\nWhen 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.\n\n### Details\nIn `http/public.go` lines 52-64, the `withHashFile` function handles public share link requests:\n\n```go\nbasePath := link.Path    // e.g. \"/documents/shared\"\nfilePath := \"\"\n\nif file.IsDir {\n    basePath = filepath.Dir(basePath)  // BUG: becomes \"/documents\" (parent!)\n    filePath = ifPath\n}\n\nd.user.Fs = afero.NewBasePathFs(d.user.Fs, basePath)\n```\n\nWhen 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/`.\n\nThis affects both `publicShareHandler` (directory listing via `/api/public/share/{hash}`) and `publicDlHandler` (file download via `/api/public/dl/{hash}/path`).\n\n### PoC\n\n1. Set up filebrowser with a user whose scope contains:\n2.    - `/documents/shared/public-file.txt` (intended to be shared)\n3.    - `/documents/secrets/passwords.txt` (NOT intended to be shared)\n4.    - `/documents/private/financial.csv` (NOT intended to be shared)\n2. Create a public share link for the directory `/documents/shared` (via POST `/api/share/documents/shared`)\n3. Access the share link: `GET /api/public/share/{hash}`\n4.    - **Expected**: Lists only contents of `/documents/shared/`\n5.    - **Actual**: Lists contents of `/documents/` (parent), revealing `secrets/`, `private/`, and `shared/` directories\n4. Download sibling files: `GET /api/public/dl/{hash}/secrets/passwords.txt`\n5.    - **Expected**: 404 or 403 (file outside share scope)\n6.    - **Actual**: 200 with file contents (sibling file downloaded successfully)\n**Standalone Go test** reproducing the exact vulnerable code path with `afero.NewBasePathFs`:\n\n```go\nfunc TestShareScopeEscape(t *testing.T) {\n    baseFs := afero.NewMemMapFs()\n    afero.WriteFile(baseFs, \"/documents/shared/public.txt\", []byte(\"public\"), 0644)\n    afero.WriteFile(baseFs, \"/documents/secrets/passwords.txt\", []byte(\"admin:hunter2\"), 0644)\n\n    linkPath := \"/documents/shared\"\n    basePath := filepath.Dir(linkPath) // BUG: \"/documents\"\n    scopedFs := afero.NewBasePathFs(baseFs, basePath)\n\n    // Sibling file is accessible through the share:\n    f, err := scopedFs.Open(\"/secrets/passwords.txt\")\n    // err is nil - file accessible! Content: \"admin:hunter2\"\n}\n```\n\nThis test passes, confirming the vulnerability.\n\n### Impact\n\n**Unauthenticated information disclosure (CWE-200, CWE-706)**. Anyone with a public share link for a directory can:\n- Browse all sibling directories and files of the shared directory\n- - Download any file within the parent directory scope\n- - This works without authentication (public shares) or after providing the share password (password-protected shares)\nAll filebrowser v2.x installations that use directory sharing are affected.\n\n### Recommended Fix\n\nRemove the `filepath.Dir()` call and use `link.Path` directly as the `BasePathFs` root:\n\n```go\nif file.IsDir {\n    // Don't change basePath - keep it as link.Path\n    filePath = ifPath\n}\nd.user.Fs = afero.NewBasePathFs(d.user.Fs, basePath)\n```\n\n**Affected commit**: e3d00d591b567a8bfe3b02e42ba586859002c77d (latest)\n**File**: `http/public.go`, line 59","format":"markdown","source":"ghsa"},{"lang":"en","text":"FileBrowser has Path Traversal in Public Share Links that Exposes Files Outside Shared Directory in github.com/filebrowser/filebrowser","format":"markdown","source":"go"},{"lang":"es","text":"Navegador de Archivos proporciona una interfaz de gestión de archivos dentro de un directorio especificado y se puede usar para subir, eliminar, previsualizar, renombrar y editar archivos. Antes de la versión 2.61.0, cuando un usuario crea un enlace de compartición público para un directorio, el middleware withHashFile en http/public.go usa filepath.Dir(link.Path) para calcular la raíz BasePathFs. Esto establece la raíz del sistema de archivos en el directorio padre en lugar del propio directorio compartido, permitiendo a cualquiera con el enlace de compartición navegar y descargar archivos de todos los directorios hermanos. Este problema ha sido parcheado en la versión 2.61.0.","source":"nvd"}],"published":"2026-03-02T20:15:46.000Z","modified":"2026-06-17T10:28:44.327Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":7.1,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":7.1,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-200"],"affected":[{"ranges":[{"version":"< 2.61.0","status":"affected"}],"vendor":"filebrowser","product":"filebrowser","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.61.0"}],"ecosystem":"Go","package":"github.com/filebrowser/filebrowser/v2","purl":"pkg:golang/github.com/filebrowser/filebrowser/v2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/filebrowser/filebrowser","purl":"pkg:golang/github.com/filebrowser/filebrowser","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.61.0"}],"ecosystem":"Go","package":"github.com/filebrowser/filebrowser/v2","purl":"pkg:golang/github.com/filebrowser/filebrowser/v2","source":"go"},{"ranges":[{"status":"affected","introduced":"2.0.0","fixed":"2.61.0"}],"vendor":"filebrowser","product":"filebrowser","cpe":"cpe:2.3:a:filebrowser:filebrowser:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/filebrowser/filebrowser/security/advisories/GHSA-mr74-928f-rw69","tags":["advisory","exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/filebrowser/filebrowser/commit/31194fb57a5b92e7155219d7ec7273028fcb2e83","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/filebrowser/filebrowser/releases/tag/v2.61.0","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-28492","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/filebrowser/filebrowser","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-03-06T10:45:01.806Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-28492","url":"https://www.cve.org/CVERecord?id=CVE-2026-28492","licence":"CVE Terms of Use","modified":"2026-03-06T10:45:32.640Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-mr74-928f-rw69","url":"https://github.com/advisories/GHSA-mr74-928f-rw69","licence":"CC-BY-4.0","modified":"2026-03-23T04:56:00.211Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-4585","url":"https://pkg.go.dev/vuln/GO-2026-4585","licence":"CC-BY-4.0","modified":"2026-03-23T04:53:11.725Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-28492","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-28492","licence":"Public domain","modified":"2026-06-17T10:28:44.327Z"}],"updatedAt":"2026-11-25T22:59:15.339Z","epss":{"score":0.00382,"percentile":0.34343,"date":"2026-12-01T12:00:22.000Z"}}