Hello and welcome to the side. I bury secure coding Course my name Miss anywhere. And this is sans top 25.
Upload fire with dangerous type demo. Unrestricted file upload.
This is the demo for and restricted file upload. We're gonna use Mattila Day under others. There's an unrestricted file upload file upload menu item. When you come here,
it basically allows the upload of any type of file.
Now, what we would demonstrate here is a Web shell script in. So
what we're gonna do is actually upload a PHP file.
And if you'll notice it's going to be a standard form that will be able to take in any kind of command,
and that command is then going to execute in a shell
So you just take this code
and place it in a PHP file.
And of course, since there's no restriction or validation being done,
we're going to go ahead and upload that.
Now, before we click the upload button,
we do want to turn on burbs. Sweet, because we want to see if there are any hidden parameters here that might clue us in as to where our file might be positioned on the Web server. I've got my interceptor on.
And when you'll notice is that in the form there's specified an upload directory
and it actually gives us the
the actual location directory location
for where? Our files. We're going to be uploaded. Well, great. That makes it super easy.
From previous error messages, we've determined that Mattila day runs Inzamam
and it's running on a Windows system.
So using that information, we know that Zampa actually has an HT Docks directory. So we're changing the path to have the upload directory be this
I'm gonna go ahead and forward that,
and so this lets me know. Yes was indeed loaded there. Open up another window,
So now I have a great Web shell that allows me to then execute any command I like on this Web server.
So knowing it's a Windows machine, I could do D i r.
And you see the content etcetera. So, Eddie, any type of Windows Command I can now execute.
And of course, this is due to the fact that there's no validation being done on the server side
for what is able to be uploaded and executed