hi everyone welcome back to another video in the web security academy series in today's video we'll be covering lab number one in the ssrf module titled basic ssrf against a local server all right let's get started this lab has a stock check feature which fetches data from an internal system to solve the lab change that stock check url to access the admin interface at http localhost admin and delete the user carlos alright so our vulnerable parameter or vulnerable feature is the stock check functionality and the goal of the exercise is to change the stock check
url to access the admin interface and delete the user carlos so we're going to copy that right over here paste it hit enter and let's click on view toggle word drop perfect and then create an analysis section click on access the lab to access the exercise this might take some time to render so i'm going to open up burp suite in the meantime i'll be using the professional edition just because it's faster however you don't need the pro version of burp in order to complete this exercise and i won't be using features that are only
available in the pro version without letting you know first right let's click close hit next start burp make that a little bit smaller put that over here and click on the proxy tab all right so in foxy proxy set your browser to send requests to burp and now when we click on view details it should be intercepted in burp and it is all right perfect let's forward this and this one as well and look for the stock check feature if you go down you see that there's a product the description of the product and then
there's a check stock feature that allows you to check if this product is in stock so let's click on that and again it should be intercepted and burped and it is so what we're going to do is we're going to right click and send this to repeater and work from repeater from now and on all right going back to burp let's make this a little bit smaller you could see over here that in the stock track functionality there is a parameter called stock api that is sent and it looks like it's a url because you
could see over here there's an http colon slash stock.we like to shop.net so this is url encoded so what i'm going to do is ctrl shift u to decode it and look at the url all right so it takes in a url to the application and it's running on port 8080 and the path to the stock check feature is slash product slash stock and then slash check and then it takes in the product id so anytime you see a url in the application you definitely need to test for ssrf so the first thing i'm going
to do is click on send to see what a usual response looks like and it tells me it's missing a parameter that's probably because it's not url encoded so let's encode it again ctrl u hit send and here we go so a normal response is to get the number of items that are available in stock which in this case is 388. so let's go back the first thing that i will do is see if i could access the application itself so i'm going to hit send and it says missing parameter let's do control u to
url encode it hit send and it still says missing parameter so it's likely that you can't call this url without providing the parameter value to the stock that you want to check so the next thing that i usually do is check if there's an application running on localhost of course if this is not vulnerable to ssrf the request shouldn't be accepted so let's try first localhost hit send and perfect so we do get a response which immediately tells me that this is vulnerable to ssrf i'm going to click on render this is a feature that
is available both in the pro version and the community edition however i've never gotten it to work in the community edition so it might not be something that you could do if you're only working with the community edition so i'm going to click on render and see let's go back so we've clicked on render and let's see what appears to us so over here it looks like we're on the same application that we were on except that in this scenario we have something called an admin panel which we didn't have before now i don't have
the source code to this application however what likely happened is that the same application is running on localhost so locally on the server and the application does not require you to log in in order to access the admin panel because it's assumed that if you can access the server then you're already authenticated whereas in this scenario you're coming from an external perspective so in order to get to the admin page or any other account on the system you have to click on my account and we might be still intercepting this in proxy so let's set
intercept to be off yep so you have to click on my account enter your username and password and then log in however because we're exploiting the ssrf vulnerability and there's a trust relationship between the application and the server it's running on we're able to access the admin panel as if we're logged into the server itself all right so if we go to raw over here and we search for the word admin you could see that it's running on the path slash admin so we're gonna add that to our request so let's make some notes over
here so to access localhost all we had to do is visit the url localhost and then to access the admin interface we looked at the source code and we saw that the path for the interface is slash admin so this should work because as we saw in localhost the admin is already logged into the system and we don't need to authenticate so if we click on raw and then hit send we should see the admin interface again i'm going to click on render and see what i get and perfect so the admin interface allows you
to delete users and in this case these two users over here in order to delete the users you gotta click on the delete button perfect so we go back to raw and let's do a search on carlos and see what the path is in order to delete the user carlos and the path is admin slash delete question mark username and carlos so let's make note of that delete carlos and let's copy that over here all right again in order to perform this attack we have to go through the s the vulnerable parameter and perform another
ssrf attack so let's copy this put it in here and see if we successfully delete the carlos user all right hit send and we get a not found so we might have made a mistake and i know what we did so this is and let's remove it from over here because we're gonna use that for our script in a bit and save it and hit send again okay we get a 302 which is a really good sign that means that the request passed through and it's getting redirected to another page so let's follow redirection perfect
we get a 401 unauthorized all right and the reason we get a 401 unauthorized is because we're requesting the admin page from an external perspective versus from an internal perspective when we were exploiting it through the parameter that is vulnerable to ssrf so in order to confirm that this is worked we need to access the admin interface again let's go back and access the admin interface to see if it still allows us to delete the carlos user if it does that means that carlos user still exists in the database and at our attack field however
if it doesn't that means our attack was successful all right hit send and let's look for carlos there's zero matches that's a good sign if we click on render here we go we only have one user to delete because we successfully deleted the carlos user perfect so if we go back to our exercise we should see the sign congratulations you solved the lab all right so we successfully completed the exercise by manually exploiting an ssrf vulnerability in order to access the admin interface that was available on the application running locally on the server and delete
the carlos user if you would like to see a detailed version of the video where we first exploit the vulnerability manually and then script it in python check out the video linked on the screen also make sure to hit the subscribe button and check out my course if you're interested in seeing more videos like this one thank you and see you in the next video