GHSA-ffx7-75gc-jg7c: File Browser TUS Negative Upload-Length Fires Post-Upload Hooks Prematurely
[!NOTE]
**This feature has been disabled by default for all installations from v2.33.8 onwards, including for existent installations**. To exploit this vulnerability, the instance administrator must turn on a feature and ignore all the warnings about known vulnerabilities. We're publishing this new advisory to make it clear that all vulnerabilities concerning this feature are disclosed.For more information about tracking vulnerability issues related to the Command Execution features, check https://github.com/filebrowser/filebrowser/issues/5199.SummaryThe TUS resumable upload handler parses the Upload-Length header as a signed 64-bit integer without validating that the value is non-negative. When a negative value is supplied (e.g. -1), the first PATCH request immediately satisfies the completion condition (newOffset >= uploadLength --> 0 >= -1), causing the server to fire after_upload exec hooks with a partial or empty file. An authenticated user with upload permission can trigger any configured after_upload hook an unlimited number of times for any filename they choose, regardless of whether the file was actually uploaded - with zero bytes written.Details**Affected file:** http/tus_handlers.go**Vulnerable code - POST (register upload):****Vulnerable code - PATCH (write chunk):****The completion check uses signed comparison.** Any negative uploadLength is always less than newOffset ( which starts at 0 ), so the hook fires on the very first PATCH regardless of how many bytes were sent.**Consequence:** An attacker with upload permission can:Initiate a TUS upload for any filename with Upload-Length: -1Send a PATCH with an empty body ( Upload-Offset: 0 )after_upload hook fires immediately with a 0-byte (or partial) fileRepeat indefinitely - each POST+PATCH cycle re-fires the hookIf exec hooks are enabled and perform important operations on uploaded files (virus scanning, image processing, notifications, data pipeline ingestion), they will be triggered with attacker-controlled filenames and empty file contents.Demo Server SetupPoC ExploitImpact**Exec Hook Abuse (when enableExec = true):**An attacker can trigger any after_upload exec hook an unlimited number of times with attacker-controlled filenames and empty file contents. Depending on the hook's purpose, this enables:**Denial of Service:**Triggering expensive processing hooks ( virus scanning, transcoding, ML inference ) with zero cost on the attacker's side.**Command Injection amplification:**Combined with the hook injection vulnerability (malicious filename + shell-wrapped hook), each trigger becomes a separate RCE.**Business logic abuse:**Triggering upload-driven workflows ( S3 ingestion, database inserts, notifications ) with empty payloads or arbitrary filenames.**Hook-free impact:**Even without exec hooks, a negative Upload-Length creates an inconsistent cache entry. The file is marked "complete" in the upload cache immediately, but the underlying file may be 0 bytes. Any subsequent read expecting a complete file will receive an empty file.**Who is affected:**All deployments using the TUS upload endpoint (`/api/tus`). The `enableExec` flag amplifies the impact from cache inconsistency to remote command execution.ResolutionThis vulnerability has not been addressed, and has been added to the issue where we're tracking all security vulnerabilities regarding the command execution (https://github.com/filebrowser/filebrowser/issues/5199). Command execution is disabled by default for all installations and users are warned if they enable it. This feature is not to be used in untrusted environments and we recommend to not use it.
CVSS v4.0: 5.3