WebDAV File Transfer

05.06.2024 ยท dadevel

File Transfer over the WebDAV protocol.

Client

WebDAV connections on Windows are handled by the WebClient service. It is preinstalled on desktops, but not on servers.

Starting the service explicitly requires local admin rights, but it starts automatically when a WebDAV share is accessed over the GUI. For example the command start \\1.1.1.1@80\ can be used to trigger the service. The command itself will fail, but that's intentional, so no Explorer window pops up.

Generally all Windows programs that expect absolute file paths also accept paths to network shares aka UNC paths. See SMB File Transfer for examples.

WebDAV path syntax:

# over http
\\192.0.2.1@8080\share\malware.exe
file://192.0.2.1@8080/share/malware.exe
# over https
\\192.0.2.1@ssl\share\malware.exe
\\192.0.2.1@ssl@8443\share\malware.exe
file://192.0.2.1@ssl/share/malware.exe
file://192.0.2.1@ssl@8443/share/malware.exe
# smb with fallback to webdav
\\192.0.2.1\share\malware.exe

Server

With rclone over HTTP.

rclone serve -v webdav . --addr :8080 --read-only

Alternatively over self-signed HTTPS.

openssl req -newkey rsa:2048 -nodes -x509 -days 365 -keyout ./webdav.key -out ./webdav.crt
rclone serve -v webdav . --read-only --addr :8443 --cert ./webdav.crt --key ./webdav.key

Python WsgiDAV over HTTP (source).

wsgidav --host 0.0.0.0 --port 8080 --auth anonymous --root .

Other tools:

  • goshs, simple HTTP and WebDAV server in Go
  • The Nginx WebDAV module is to bare bones and does not work with Windows.