The function's name says sandbox. The function's body says normalize.
Pre-patch storage/local_file_system.go:
func (sp LocalFileSystemProvider) GetFullPath(path string) string {
fullPath := path
if !strings.HasPrefix(path, sp.BaseDir) {
fullPath, _ = filepath.Abs(filepath.Join(sp.BaseDir, path))
}
return fullPath
}
The intent in code: if the caller's path already starts with BaseDir, trust it as already inside. Otherwise, glue the caller's path onto BaseDir and take the absolute form.
The "glue it onto BaseDir" call is filepath.Join. The Go standard library documents what Join does: "Join joins any number of path elements into a single path... The result is Cleaned." And what Clean does: "Eliminate each inner .. path name element along with the non-.. element that precedes it."
filepath.Join("/app/files", "../../../../../../etc/passwd") returns /etc/passwd. Six .. segments walk back through six non-.. segments; everything before etc/passwd is consumed; the resulting path is absolute and lives outside BaseDir. The function has run as designed. The documentation explains the design.
filepath.Abs then runs on /etc/passwd. Abs returns the absolute representation of a path. /etc/passwd is already absolute. Abs is a no-op.
The function returns /etc/passwd. The upload handler writes there. The handler does not verify after the fact. It does not need to. The handler trusts the function whose job is to put the file in the sandbox.
Both branches of the if-statement are exploitable.
Read the function again with adversarial eyes. There are two branches.
The first branch: path already starts with BaseDir. The function trusts the caller and returns path verbatim, no normalization, no resolution. A caller who supplies files/../../../../etc/passwd satisfies HasPrefix(path, "files/"), the function returns the input string unchanged, and the kernel's open(2) resolves .. at write time. The "is this path already inside BaseDir" check uses the same string the attacker controls; satisfying the check is a prefix away.
The second branch: path does not start with BaseDir. The function joins under BaseDir and absolutizes. This is the filepath.Join path described above.
Two branches, two bypasses. The HasPrefix check is itself the trust boundary; the attacker chooses which side of it to be on, and both sides write outside BaseDir. The function has no third branch.
The PoC supplies two inputs. The function distinguishes neither.
GetFullPath takes one string. That string is composed upstream from two attacker-controllable sources:
- The storage provider's
PathPrefix, set by an authenticated administrator at provider creation time via /api/add-provider and /api/update-provider.
- The
fullFilePath query parameter, sent by the caller on each /api/upload-resource request.
The PoC writes both. Provider creation, from CVE-2026-6815.py:
provider_payload = {
"owner": "admin",
"name": "path_traversal",
"type": "Local File System",
"method": "Normal",
"pathPrefix": "../../../../../../../../../"
}
session.post(f"{target_url}/api/add-provider",
data=json.dumps(provider_payload), ...)
File upload:
upload_params = {
"owner": args.orgname,
"user": args.usr,
"application": args.appname,
"tag": "custom",
"parent": "ResourceListPage",
"fullFilePath": args.rpath, # e.g. /home/casdoor/.ssh/authorized_keys
"provider": "path_traversal"
}
Both inputs flow downward into the same GetFullPath. The function does not know that one was supposed to be administrative configuration and the other was supposed to be a per-call file path. The function sees a string. The function calls Join. Join cleans.
The PoC's README leads with "the attacker must be authenticated with admin privileges." The PoC's defaults are --usr admin --psw 123, the credentials Casdoor ships out of the box and that operators forget to rotate. The architectural read of the bug is "admins can configure storage providers, so admins can write where storage providers write." The code read is that the storage provider has not been told where it is allowed to write. The admin role gates the API surface. The function GetFullPath is not on that surface; it gates nothing.
The patch is the function the author should have written the first time.
Commit fc03a30, by maintainer hsluoyz:
func (sp LocalFileSystemProvider) GetFullPath(path string) string {
fullPath := filepath.Clean(filepath.Join(sp.BaseDir, path))
sandboxRoot := sp.BaseDir + string(filepath.Separator)
if fullPath != sp.BaseDir && !strings.HasPrefix(fullPath, sandboxRoot) {
return sp.BaseDir
}
return fullPath
}
The diff is small. The reframe is large.
The if !strings.HasPrefix(path, sp.BaseDir) branch is gone. There is no "trust the caller already prefixed BaseDir" path. Every input is normalized; every input is checked. filepath.Clean is called. filepath.Join is called. The traversal still gets resolved. What changes is what happens after: ask whether the resulting path is BaseDir itself, or lives strictly under BaseDir + Separator. If neither, fall back to BaseDir. The result is no longer "wherever filepath.Join landed"; the result is "a path reachable from BaseDir without first leaving BaseDir."
This is what sandboxing-by-Join requires. The Go standard library does not provide a single-call sandbox helper. It provides filepath.Clean, filepath.Join, filepath.Abs, and filepath.Rel. The sandbox is a composition: join, clean, verify the result lives under the base. The pre-patch code reached for the piece that sounded like a sandbox and stopped one step short of being one.
The researcher fixed one layer. The maintainer fixed two and refined the first.
The same commit changes object/provider.go. Both AddProvider and UpdateProvider now reject a PathPrefix containing any .. path component, gated on the provider type:
if provider.Type == ProviderTypeLocalFileSystem {
for _, component := range strings.Split(provider.PathPrefix, "/") {
if component == ".." {
return false, fmt.Errorf("the pathPrefix: %s is not allowed", provider.PathPrefix)
}
}
}
The researcher's original pull request (#5458, opened the same day as the public PoC) had used strings.Contains(provider.PathPrefix, ".."). The maintainer rewrote it as a per-component check, gated on the storage type. The two are not equivalent. strings.Contains rejects every two-dot substring, including legitimate filenames like ..hidden and directories with two dots in their names. The component check rejects only path components that are exactly ... The type guard exists because providers like S3, Azure, and OSS have their own pathPrefix semantics where .. is a valid object-key character; rejecting it globally would corrupt them.
PathPrefix and fullFilePath are two separate inputs that flow into the same function with the same (zero) post-conditions. Closing one input leaves the other open. The maintainer closed both.
The PR was not merged. Its status reads "closed; replaced by fc03a30." The PoC repo ships the researcher's framing as gospel. The fix on disk is the maintainer's, and they are not the same patch.
An identity product's storage component had no identity in it.
Casdoor is an OAuth and SSO identity provider. The product's job description is "who can act with what authority." The storage backend that ships in the box takes a base directory and a per-call path and writes the file there. The function deciding where the file goes never asked whose authority it was running under and never asked whether the resulting path was a place authority extended to.
That is not a strange omission. Access control in an identity product lives at the API layer, not the storage layer. But the destination here is caller-controlled all the way down. The IdP's threat model trusted admins with identity. The storage backend treated admin-controlled input the same way it would treat any other input, which is to say, completely.
There is a name for this shape now: Join Is Not Sandbox. The Go standard library does not ship a "scope this path to that directory" call; the project that needs one has to compose it from Clean, Join, and either Rel or an explicit prefix check on BaseDir + Separator. GetFullPath, pre-patch, composed filepath.Join with filepath.Abs and called the composition a sandbox. Neither of those calls is one. Together they are not one. The patch is the line that finally is.
PoC: danilo-dellorco/CVE-2026-6815