I had to use cURL to upload files while rooting a Vulnhub image yesterday, so I figured I would post a tutorial on how to do it.
First I had to check what methods were allowed in a directory I found:
root@kali:~# curl -v -X OPTIONS http://192.168.1.224/test/
I see that PUT is allowed in this directory, I try to upload the file using cURL. You will see that I get an Expectation Failed message and the file was not uploaded:
root@kali:~# curl -v -T sickos.php –url http://192.168.1.224/test/
This particular server was expecting me to use HTTP version 1.0. I was able to force cURL to use 1.0 using the -0 option. So I tried again:
root@kali:~# curl -v -T sickos.php –url http://192.168.1.224/test/ -0
And this time it worked as expected.