GHSA-8wc8-hf36-mjh9 CVE-2026-55668 GO-2026-6020
File Browser: ScopedFs follows a dangling symlink on write, letting a scoped user create files outside their scope
- Severity
- 6.3 / 10
- Medium · CVSS 3.1
- Exploit chance (EPSS)
- 0.38%
- Chance of exploitation in the next 30 days. Higher than 31.80% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
- CWE-59 Improper Link Resolution Before File Access ('Link Following')
- Fix
2.63.16- Upgrade github.com/filebrowser/filebrowser/v2 to this version or later
Description
Summary
ScopedFs confines every File Browser user to a scope directory. Its within() guard is meant to reject any operation that follows a symbolic link out of that scope. When the link target does not exist yet, the guard walks up to the nearest existing ancestor and validates that instead. For a dangling symlink (target does not exist), the nearest existing ancestor is the in-scope directory containing the link, so the guard returns "in scope" and the subsequent os.OpenFile(O_CREATE) follows the link and creates the file at its out-of-scope target.
A post-auth user with Create and Modify permission can write attacker-controlled content to any non-existent path outside their scope that the File Browser process can write to. The precondition is a dangling symlink present inside the user's scope, which is the same out-of-band precondition the rest of ScopedFs is built to defend against.
This is a patch-gap variant of the GHSA-239w-m3h6-ch8v symlink confinement issue, not a resubmission of the already-published vulnerable-version behavior: GHSA-239w-m3h6-ch8v marks <= 2.63.13 vulnerable and 2.63.14 patched, while this proof reproduces on current master / v2.63.15 (be23ab3a15bf957928ecfed88de5ab67850c1b9c). The escaping-symlink-to-an-existing-target case is defended and tested. The dangling case is neither, and the gap is acknowledged in a code comment as "best-effort".
Root cause
files/scoped.go (commit be23ab3). The guard, including the maintainer comment that already flags this exact gap:
// Note: a dangling symlink whose target does not yet exist resolves to its
// containing directory and is therefore allowed; writing through such a link
// could still create a file outside the scope. This is treated as best-effort
// and relies on rejecting existing escaping symlinks, which covers the
// disclosure and overwrite vectors.
func (s *ScopedFs) within(p string) (bool, error) {
root, err := filepath.EvalSymlinks(afero.FullBaseFsPath(s.base, "/"))
if err != nil {
return false, err
}
target := afero.FullBaseFsPath(s.base, p)
resolved, err := filepath.EvalSymlinks(target)
for errors.Is(err, fs.ErrNotExist) {
parent := filepath.Dir(target) // LEXICAL parent of the link path
if parent == target {
break
}
target = parent
resolved, err = filepath.EvalSymlinks(target)
}
if err != nil {
return false, err
}
// ...
return resolved == root || strings.HasPrefix(resolved, prefix), nil
}
When p is a symlink whose target does not exist, EvalSymlinks(target) returns fs.ErrNotExist. The loop takes the lexical parent of the link path (filepath.Dir), a real directory inside the scope, and EvalSymlinks of that resolves under the scope root. within() returns true and guard() permits the operation. The write then dereferences the link at the OS layer:
func (s *ScopedFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error) {
if err := s.guard(name); err != nil { // returns nil for a dangling escaping symlink
return nil, err
}
return s.base.OpenFile(name, flag, perm) // os.OpenFile(O_CREATE) follows the link
}
The assumption that breaks: within() treats "target does not exist" as "brand-new in-scope file" and validates the containing directory. But the path component being created is itself a symlink pointing outside the scope. O_CREATE follows it and creates the file at the link target, not inside the validated directory. The existing-target case is correctly blocked, because the walk-up resolves the link itself to an out-of-scope path. Only the dangling case slips through.
For the layout below:
/tmp/root/scope/escape -> /tmp/root/outside/created-by-http.txt
/tmp/root/outside/ # exists
/tmp/root/outside/created-by-http.txt # does not exist yet
EvalSymlinks(/tmp/root/scope/escape) returns not-exist, and the fallback validates /tmp/root/scope. The final OpenFile still follows /tmp/root/scope/escape and creates /tmp/root/outside/created-by-http.txt.
Reachability over HTTP
Endpoint: POST /api/resources/<linkname>?override=true (also PUT, and POST/PATCH /api/tus/...). Verified trace against the audited source:
http/resource.goresourcePostHandlerrequiresd.user.Perm.Create(else 403).files.NewFileInfois called. For a dangling symlink,stat()infiles/file.godoesLstatIfPossible(sees the symlink,err == nil,IsSymlink = true), thenFs.Statfollows the link and fails with ENOENT, so the code returns the symlinkFileInfowitherr == nil. The handler therefore enters the "file exists" branch.- The branch requires
override == "true"andd.user.Perm.Modify, then proceeds. writeFile(d.user.Fs, r.URL.Path, r.Body, ...)callsafs.OpenFile(dst, os.O_RDWR|os.O_CREATE|os.O_TRUNC, fileMode).ScopedFs.OpenFilerunsguard(), which passes for the dangling link, thenos.OpenFilefollows the link and creates the file outside the scope with the request body as content.
The TUS path (http/tus_handlers.go tusPostHandler -> OpenFile, then tusPatchHandler) reaches the same sink.
Why existing defenses do not apply
afero.BasePathFslexical confinement only neutralizes... A plain link name passes it unchanged.ScopedFs.within()is the dedicated symlink defense, and it is the component that fails: the not-exist walk-up validates the link's parent directory instead of the link.- The project's symlink tests (
http/tus_symlink_test.goTestTusHandlersRejectSymlinkScopeEscape,files/file_test.go) only exercise escaping symlinks whose target exists. Those are blocked. The dangling variant is never tested, so the regression suite does not catch it.
Proof of concept
The PoC drives the real security boundary, files.NewScopedFs, with the same flags http.writeFile uses, and shows the write landing outside the scope. A control test shows the existing-target case is still blocked, proving the guard is real and the gap is specifically the dangling case.
const writeFlags = os.O_RDWR | os.O_CREATE | os.O_TRUNC // == http.writeFile
scope := filepath.Join(root, "user") // the low-priv user's jail
outside := filepath.Join(root, "outside") // sibling dir = another tenant / host path
// Precondition: a dangling escaping symlink inside the scope.
os.Symlink(filepath.Join(outside, "pwned.txt"), filepath.Join(scope, "evil")) // target does not exist yet
fs := files.NewScopedFs(afero.NewOsFs(), scope)
f, _ := fs.OpenFile("/evil", writeFlags, 0o644) // not rejected
f.WriteString("OWNED-OUTSIDE-SCOPE")
// assert: outside/pwned.txt must NOT exist
Observed result:
=== RUN TestDanglingSymlinkWriteEscapesScope
poc_test.go:49: VULNERABLE: write escaped the scope and created
/tmp/.../001/outside/pwned.txt with content "OWNED-OUTSIDE-SCOPE"
--- FAIL: TestDanglingSymlinkWriteEscapesScope (0.00s)
=== RUN TestExistingTargetSymlinkIsBlocked
poc_test.go:78: guard correctly blocked existing-target escape: permission denied
--- PASS: TestExistingTargetSymlinkIsBlocked (0.00s)
The dangling test "fails" by design: the assertion fires because the file escaped. The control test passes: an escape_link -> outside (existing dir) write to escape_link/injected.txt is rejected by OpenFile with permission denied and nothing is created in outside/. That is exactly the scenario the project's own tests cover.
End-to-end HTTP equivalent:
POST /api/resources/escape?override=true
X-Auth: <token for user scoped to /tmp/root/scope with Create+Modify>
body: http-outside
-> ScopedFs.OpenFile("/escape", O_CREATE|O_TRUNC) follows the dangling link
-> file created at the link's out-of-scope target with the request body
The handler returns 200 OK, and the outside file contains the uploaded body.
Impact
- Direct primitive (live-verified): arbitrary file creation with attacker-controlled content at any non-existent path outside the user's scope that the File Browser process user can write to.
- Cross-tenant integrity (source-reasoned): in multi-user deployments the scopes are sibling directories under one server root. A low-priv user can plant files into another user's home (a script, an HTML page later served, a config the victim trusts).
- Persistence / RCE on permissive deployments (source-reasoned): creating a not-yet-existent
~/.ssh/authorized_keysfor the service account, a file under a web-served or later-executed directory, a cron or profile fragment. The official Docker image runs as non-root UID 1000, which bounds this to whatever that user owns. Bare-metal/systemd deployments that run File Browser as root raise this to host-level file write and RCE. - Scope limit (honest): this is file creation, not overwrite. Overwriting an existing out-of-scope file is genuinely blocked, because an existing target makes the link "escaping" and
within()rejects it. The negative control confirms this.
Suggested remediation
For write/create/truncate operations, do not treat a dangling final symlink as safe merely because the nearest existing ancestor is inside the scope. The walk-up in within() should treat "the leaf is a symlink" as an escape candidate rather than validating its parent:
- In
guard()/within(),Lstatthe target. If it is a symlink,Readlinkit, resolve the link target lexically (join with the link's directory,Clean), and require that target to be within the scope root, regardless of whether it currently exists. - More robust: resolve path components one by one for the operation being attempted, or open the final component with
O_NOFOLLOW(unix.Openat(... O_NOFOLLOW)) so creating through a symlink fails withELOOP; orfstatthe descriptor after opening and verify it resolves within the scope before writing.
Add a regression test mirroring TestTusHandlersRejectSymlinkScopeEscape but with a dangling target (os.Symlink(filepath.Join(outside, "newfile"), ...)), asserting both a 4xx and that no file is created outside the scope.
References
- Incomplete fix of CVE-2026-54094 /
GHSA-239w-m3h6-ch8v. - Affected code:
files/scoped.go(ScopedFs.within,ScopedFs.OpenFile,ScopedFs.Create), reached fromhttp/resource.go(resourcePostHandler,writeFile) andhttp/tus_handlers.go. - Confirmed unpatched at
be23ab3a15bf957928ecfed88de5ab67850c1b9c(v2.63.15).
Affected versions
Go
| Package | Vulnerable | Fixed in |
|---|---|---|
| github.com/filebrowser/filebrowser | all versions |
No fix yet |
| github.com/filebrowser/filebrowser/v2 | < 2.63.16 |
2.63.16 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
github.com/filebrowser/filebrowser/v2 Go → 2.63.16
- go
go get github.com/filebrowser/filebrowser/v2@v2.63.16 && go mod tidy
Severity breakdown
CVSS 3.1 6.3
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:N/I:H/A:N
- Attack vector
- Network
- Attack complexity
- High
- Privileges required
- Low
- User interaction
- None
- Scope
- Changed
- Confidentiality
- None
- Integrity
- High
- Availability
- None
Weakness
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 to prevent it
- Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright. When validating filenames, use stringent allowlists that limit the character set to be used. If feasible, only allow a single "." character in the filename to avoid weaknesses such as CWE-23, and exclude directory separators such as "/" to avoid CWE-36. Use a list of allowable file extensions, which will help to avoid CWE-434. Do not rely exclusively on a filtering mechanism that removes potentially dangerous characters. This is equivalent to a denylist, which may be incomplete (CWE-184). For example, filtering "/" is insufficient protection if the filesystem also supports the use of "\" as a directory separator. Another possible error could occur when the filtering is applied in a way that still produces dangerous data (CWE-182). For example, if "../" sequences are removed from the ".../...//" string in a sequential fashion, two instances of "../" would b
- Architecture and Design: For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
- Implementation: Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked. Use a built-in path canonicalization function (such as realpath() in C) that produces the canonical version of the pathname, which effectively removes ".." sequences and symbolic links (CWE-23, CWE-59). This includes: realpath() in C getCanonicalPath() in Java GetFullPath() in ASP.NET realpath() or abs_path() in Perl realpath() in PHP
- Architecture and Design: Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482].
- Operation: Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481].
- Architecture and Design, Operation: Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
- Architecture and Design: When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs. For example, ID 1 could map to "inbox.txt" and ID 2 could map to "profile.txt". Features such as the ESAPI AccessReferenceMap [REF-185] provide this capability.
- Architecture and Design, Operation: Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software. OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations. This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise. Be careful to avoid CWE-243 and other weaknesses related to jails.
- Architecture and Design, Operation: Store library, include, and utility files outside of the web document root, if possible. Otherwise, store them in a separate directory and use the web server's access control capabilities to prevent attackers from directly requesting them. One common practice is to define a fixed constant in each calling program, then check for the existence of the constant in the library/include file; if the constant does not exist, then the file was directly requested, and it can exit immediately. This significantly reduces the chance of an attacker being able to bypass any protection mechanisms that are in the base program but not in the include files. It will also reduce the attack surface.
- Implementation: Ensure that error messages only contain minimal details that are useful to the intended audience and no one else. The messages need to strike the balance between being too cryptic (which can confuse users) or being too detailed (which may reveal more than intended). The messages should not reveal the methods that were used to determine the error. Attackers can use detailed information to refine or optimize their original attack, thereby increasing their chances of success. If errors must be captured in some detail, record them in log messages, but consider what could occur if the log messages can be viewed by attackers. Highly sensitive information such as passwords should never be saved to log files. Avoid inconsistent messaging that might accidentally tip off an attacker about internal state, such as whether a user account exists or not. In the context of path traversal, error messages which disclose path information can help attackers craft the appropriate attack strings to move through the file system hierarchy.
- Operation, Implementation: When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.
CWE-59: Improper Link Resolution Before File Access ('Link Following')
The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.
How to prevent it
- Architecture and Design: Follow the principle of least privilege when assigning access rights to entities in a software system. Denying access to a file can prevent an attacker from replacing that file with a link to a sensitive file. Ensure good compartmentalization in the system to provide protected areas that can be trusted.
References
Advisories
Packages
Other links
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-833g-cqhp-h72j File Browser: Share API exposes the password hash and bypass token | Low | Also affects github.com/filebrowser/filebrowser |
| GHSA-83xp-526h-j3ww File Browser: Archive builder turns backslash filenames into path traversal (zip-slip) | Medium | Also affects github.com/filebrowser/filebrowser |
| GHSA-7rc3-g7h6-22m7 File Browser: Colliding username normalization gives two users the same home directory | High | Also affects github.com/filebrowser/filebrowser |
| GHSA-fmm7-x4gx-8jhr File Browser: Out-of-scope file deletion by a Create-only scoped user via symlink-following RemoveAll in upload failure-cleanup | High | Also affects github.com/filebrowser/filebrowser |
| GHSA-xqp3-jq6g-x3qm File Browser: Authentication Bypass via Proxy Auth Header Forgery | Critical | Also affects github.com/filebrowser/filebrowser |
| GHSA-m93h-4hw7-5qcm File Browser: Command Injection via Authentication Hook Shell Substitution (Pre-Authentication RCE) | Critical | Also affects github.com/filebrowser/filebrowser |
| GHSA-8c9q-7855-wfxq File Browser has a Command Execution Allowlist Bypass via Shell Metacharacter Injection | High | Also affects github.com/filebrowser/filebrowser |
| GHSA-j9jx-hp4c-ghhh File Browser has incorrect access control for public directory shares via rule path rebasing | High | Also affects github.com/filebrowser/filebrowser |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor