WebDav
Last updated
Last updated
Use Trickest to easily build and automate workflows powered by the world's most advanced community tools. Get Access Today:
When dealing with a HTTP Server with WebDav enabled, it's possible to manipulate files if you have the right credentials, usually verified through HTTP Basic Authentication. Gaining control over such a server often involves the upload and execution of a webshell.
Access to the WebDav server typically requires valid credentials, with WebDav bruteforce being a common method to acquire them.
To overcome restrictions on file uploads, especially those preventing the execution of server-side scripts, you might:
Upload files with executable extensions directly if not restricted.
Rename uploaded non-executable files (like .txt) to an executable extension.
Copy uploaded non-executable files, changing their extension to one that is executable.
Davtest try to upload several files with different extensions and check if the extension is executed:
Output sample:
This doesn't mean that .txt and .html extensions are being executed. This mean that you can access this files through the web.
You can use this tool to connect to the WebDav server and perform actions (like upload, move or delete) manually.
Use Trickest to easily build and automate workflows powered by the world's most advanced community tools. Get Access Today:
This vulnerability is very interesting. The WebDav does not allow to upload or rename files with the extension .asp. But you can bypass this adding at the end of the name ";.txt" and the file will be executed as if it were a .asp file (you could also use ".html" instead of ".txt" but DON'T forget the ";").
Then you can upload your shell as a ".txt" file and copy/move it to a ".asp;.txt" file. An accessing that file through the web server, it will be executed (cadaver will said that the move action didn't work, but it did).
If the Webdav was using an Apache server you should look at configured sites in Apache. Commonly: /etc/apache2/sites-enabled/000-default
Inside it you could find something like:
As you can see there is the files with the valid credentials for the webdav server:
Inside this type of files you will find the username and a hash of the password. These are the credentials the webdav server is using to authenticate users.
You can try to crack them, or to add more if for some reason you wan to access the webdav server:
To check if the new credentials are working you can do:
Use Trickest to easily build and automate workflows powered by the world's most advanced community tools. Get Access Today:
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)