davtest: Tests WebDAV servers for vulnerabilities

davtest: Tests WebDAV servers for vulnerabilities

When I first started digging into WebDAV misconfigurations during penetration tests, I kept running into the same problem — most web vulnerability scanners simply don’t know what to do with WebDAV’s PUT, MOVE, and COPY methods. That’s where DavTest comes in. It’s a small, purpose-built Perl tool that does one job extremely well: it checks whether a WebDAV-enabled server will let you upload files, and more importantly, whether it will let you execute them.

In this article I’m going to walk through what DavTest actually does under the hood, how to install and run it, how to read its output, and how I use it in real authorized engagements to identify exploitable file upload paths on WebDAV shares.

What Is DavTest?

DavTev tests a WebDAV server by attempting to PUT files of different extensions (.txt, .php, .asp, .jsp, .cfm, .pl, .html, etc.) into the target directory, then tries to access each uploaded file over HTTP to see which ones the server actually executes rather than just serving as static content.

The logic is simple but effective:

  1. Upload a small test file per extension.
  2. Request that file back over HTTP.
  3. Compare the response — did the server return the raw source, execute it, or reject the upload entirely?
  4. Report which extensions are “uploadable” and which are additionally “executable.”

This distinction matters a lot in real assessments. A server might happily accept a .txt upload but strip or reject .php — or it might accept everything, including live server-side scripts, which is a critical finding.

How It Works Internally

DavTest is written in Perl and relies on the HTTP::DAV module to speak WebDAV natively rather than shelling out to curl. Internally it:

Because it uses the DAV protocol directly instead of ordinary HTTP form uploads, it correctly exercises the exact attack surface that a real WebDAV client (like Windows Explorer’s “Map Network Drive” or cadaver) would use.

Installation

DavTest ships by default in Kali Linux. On other Debian-based distributions:

sudo apt update
sudo apt install davtest

To confirm it’s installed:

davtest --help

If you need to build from source (it’s a single Perl script), you can pull it from the Kali tools repository and just run it directly with perl davtest.pl, provided libhttp-dav-perl is installed:

sudo apt install libhttp-dav-perl

Basic Syntax

davtest -url <target_url>

Common flags I use:

FlagPurpose
-urlTarget WebDAV URL (required)
-auth <user>:<pass>Basic auth credentials
-cleanupDelete uploaded test files afterward
-moveAlso try COPY/MOVE methods for evasion (bypasses extension filtering on some servers)
-uploadfile <path>Upload a specific file instead of the built-in test set
-uploadloc <name>Custom name for the uploaded file
-sendbd <ext1,ext2>Restrict testing to specific extensions

Example Run

davtest -url http://192.168.56.101/webdav/

Sample output I’ve seen in a lab environment:

********************************************************
 Testing DAV connection
********************************************************
OPEN            SUCCEED:                http://192.168.56.101/webdav/
********************************************************
 NOTE            Random string for this session: mV3xQz
 Creating directory
********************************************************
MKCOL           SUCCEED:                Created http://192.168.56.101/webdav/DavTestDir_mV3xQz
********************************************************
 Sending test files
********************************************************
PUT             txt             SUCCEED:        DavTestDir_mV3xQz/davtest_mV3xQz.txt
PUT             php             SUCCEED:        DavTestDir_mV3xQz/davtest_mV3xQz.php
PUT             asp             FAIL
PUT             jsp             FAIL
PUT             pl              SUCCEED:        DavTestDir_mV3xQz/davtest_mV3xQz.pl
********************************************************
 Checking for successful uploads
********************************************************
txt             SUCCEED:        http://192.168.56.101/webdav/DavTestDir_mV3xQz/davtest_mV3xQz.txt
php             SUCCEED:        http://192.168.56.101/webdav/DavTestDir_mV3xQz/davtest_mV3xQz.php
pl              SUCCEED:        http://192.168.56.101/webdav/DavTestDir_mV3xQz/davtest_mV3xQz.pl
********************************************************
 Executable files
********************************************************
http://192.168.56.101/webdav/DavTestDir_mV3xQz/davtest_mV3xQz.php

That last section is the one that matters most — it tells me the server will execute uploaded PHP files, which is a direct path to remote code execution if I can then upload a proper web shell.

Real-World Use Case (Authorized Lab Only)

In a lab setup with an Apache server configured with mod_dav enabled and no extension restrictions, I’ve used the following workflow:

  1. Run davtest to confirm which extensions upload and execute.
  2. Once I know .php executes, switch to cadaver (see my companion article) to upload a proper web shell.
  3. Access the web shell through the browser to demonstrate code execution as part of the report.

This is exactly the kind of finding that goes into a penetration test report as “Unrestricted File Upload via WebDAV leading to RCE” — always with client authorization and inside a scoped engagement.

Workflow Integration

DavTest fits naturally into a broader WebDAV assessment chain:

Troubleshooting & Common Mistakes

Best Practices

FAQ

Does DavTest work against IIS WebDAV as well as Apache? Yes, it’s protocol-based, not server-specific, so it works against any server exposing standard WebDAV methods, including IIS.

Can DavTest bypass extension-based filtering? The -move flag tries uploading as a disallowed extension then renaming via MOVE/COPY to a dangerous extension — a classic bypass technique for filters that only inspect the PUT request’s filename.

Is DavTest safe to run in production? Only with explicit authorization. It writes files to the target server, so treat it like any other active exploitation tool.

Summary

DavTest is a focused, no-nonsense tool for one specific but high-impact question: can I upload and execute arbitrary files on this WebDAV server? Its simplicity is its strength — a two-minute scan gives you a clear yes/no answer on one of the more dangerous WebDAV misconfigurations, and it slots cleanly into a larger toolchain with cadaver and Burp Suite for full exploitation and reporting.

References

Exit mobile version