The vulnerability exists in the public sharing feature of File Browser. When a directory is shared, the application creates a new virtual filesystem rooted at that directory to restrict access. However, the access control rule checking mechanism was not made aware of this change of root. The data.Check function, which is responsible for rule validation, would receive a path relative to the new root (e.g., /secret.txt) and compare it against rules defined from the user's actual filesystem root (e.g., /projects/private/secret.txt). The mismatch in paths caused deny rules to be bypassed, allowing unauthorized access.
The patch addresses this by introducing a checkerPrefix field in the data struct. This field stores the base path of the shared directory. The withHashFile middleware, which performs the filesystem rebasing, was modified to set this prefix. Subsequently, the data.Check function was updated to prepend this prefix to the incoming path, effectively reconstructing the original, absolute path before performing the rule check. This ensures that rules are correctly applied even when dealing with rebased public shares.
The identified vulnerable functions are the HTTP handlers (publicShareHandler, publicDlHandler) that serve as the entry points for the exploit, the middleware (withHashFile) that contains the core flawed logic, and the rule checking function (data.Check) that performs the incorrect validation.