k3nn3dy commited on
Commit
1ca383c
·
verified ·
1 Parent(s): 0999f0a

Add HackTheBox_-_Drive.jsonl

Browse files
Files changed (1) hide show
  1. HackTheBox_-_Drive.jsonl +70 -0
HackTheBox_-_Drive.jsonl ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"text": "what's going on YouTube this is ipag I'm doing drive from hack the box which starts out with a file upload site it has an ID door vulnerability so you can look at any file that has been uploaded and one of those files has credentials to log into the box once you logged in you discover there are some backups but they are password protected there is also a g instance listening on Local Host which is just like a GitHub or gitlab type of website logging in there you can look at an older version of the website that has the password used for the backup so then you can decrypt them and then crack the old passwords and then you get access to a different user this user can access the doodle grive binary which has two vulnerabilities in it the first one is a SQL injection that you can use to get root which is really", "start": 0.12, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
2
+ {"text": "fun to do the second one is a traditional buffer overflow and we're going to be showing you um three ways there's two different ways we can exploit this through SQL and then the Third Way is going to be through binary exploitation so with that being said let's just jump in as always we going to start off with an end map so- SCC for default scripts SV enumerate versions OA output all formats put in the end map directory and call it drive and then the IP address of 1010 11235 this can take some time to run so I've already ran it looking at the results we have three ports open actually it looks like two ports open cuz one is filtered but the first one is SSH on Port 22 and its Banner tells us it's an auntu server we also have HTTP on Port 80 and bar tells us it's engine X also running on Ubuntu and is", "start": 44.399, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
3
+ {"text": "directing us to drive. htb so let's go ahead and add this to our host file so we have that DNS entry so 10 10 11235 drive. htb save it and then the final thing is Port 3000 and that is filtered it's probably not going to be PPP which I think is point to point protocol it's probably some type of web server and the default languages at like 3,000 to my knowledge are like node.js with Express goang likes 3,000 um I think Ruby on Rails likes 3,000 as well a lot of python stuff defaults to Port 8,000 but doesn't really help us ex um speculating it's just just ideas what could be running on the back end right so let's go take a look at the web server so 101 11 to35 and this will probably redirect us over to drive. htb as nmap showed us and we see welcome to Doodle drive so the very first thing I like doing is trying", "start": 93.92, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
4
+ {"text": "to fingerprint the server so I'm going to turn nmap on and inspect the headers just to see if there's like an X powered by header I'll go over here send it over to repeater looking at this we have XF frame but that is not powered by nothing really is leaking too much um there is one thing I notice that kind of leaks what it is it's not guaranteed it's just an educated guess and if you can see it kudos to you um if not if you're curious it's this CF token right um that D Jango likes defaulting to this if it was C surfcore token um let me send this over to oh okay if it was C surfcore token it would probably be flask I think if it's something like umore C surf I think this is node js's or expresses default one um if it's like XC surf token I think a lot of rails apps and Lille uses this or maybe it's xsrf what is the default lville one um default Lille csrf token I", "start": 154.44, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
5
+ {"text": "know it's an x- something I know don't know if it's x- csrf or xsrf I have burp site intercepting let's turn that off let's see it's probably not going to be that easy to find Cookie name there we go X x- xsrf token is default for larval so these type of things just help you fingerprint the application if you understand what framework it uses you know what type of attacks to use against it right um You should use all them all the time but if it was Ruby on Rails I always start with mass assignment vulnerabilities because I think it's scaffolding they use internal terminology to it just makes it likely vulnerable um there's probably newer things in rails where Mass assignment isn't as big of a deal but that's one uh vulnerability I've seen a lot of rails apps so let's see um I'm going to assume this", "start": 218.879, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
6
+ {"text": "is Jango and let's just try logging in to see if we have anything if we do admin admin um enter a correct username and password we can try the register here to create an account I'm going to do IPC root i.r and the password is going to be password and let's intercept this so we can kind of see what the request is oh so we have the csrf middleware token that is probably Jango uh google.com the the first result Jango so this is definitely going to be a Jango app so let's see anything else interesting not really let's just forward it along and password is too common so let's do password with an at and a 01 I don't think I put an exclamation point man I probably did there we go and let's log in and we can upload file or go to a dashboard if I go to the dashboard it just is slome it says welcome to Doodle drop drive and if I do view we can see", "start": 272.88, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
7
+ {"text": "information right so let's send this over into repeater intercept on I don't have it here so what I'm seeing right now is we have a file ID and then we have get file detail right the very first thing I do is this is probably going over to a database as the ID let's just try a SQL injection and we get an internal server error this field ID expected a number but got this so this is probably going to be pantic it's going to be I'm going to get the name wrong um exactly what it does it's like a static typing thing so um if the field is coded to be integer and we pass it a string and that's based upon um just having string characters in it it's going to fail so so I'm not going to bother with SQL injection at all because we can only pass numbers in this field so the very first thing I want to do is", "start": 364.0, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
8
+ {"text": "probably look for some type of um idor vulnerability right let's send this over to fuff and send one through 2,000 and see what we get back right and before I do that I'm going to get rid of the Cerf token to see if I need it it looks like maybe I do it says hello IPC so if I leave this in get file ID 100 okay so we don't need that it just simplifies um the fuff command if we don't have as many cookies I'm guessing we definitely need session ID because that's going to say we're logged in if I got rid of all the cookies it redirects us to login so let us do a f so I can do fu- HTTP drive. HTP and we're going to fuzz the ID and I'm going to give it the git file detail field and we're going to do DW I'm going to do this little thing if you don't know what this does it's going to run a command", "start": 427.52, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
9
+ {"text": "but put the output to a file so if I did like Echo SEC 010 it creates this temporary file and if you viewed this file when this command was running it would be the output of this command so it comes really handy to make this word list because we don't have to go find a word list that has Z to 2,000 on it we just specify it this way okay then we want to give the header and it's going to be cookie Dash um we want to grab this okay and I think that could be good okay it is so we have a bunch of status 500s um um what if we gave it 100 I'm going to do sequence 99 to 100 that's going to be a 200 and oddly enough we got 401 so let's just filter out all um what do we say 500s and we probably want to go to 2000 I'm going to do D FC for filter code 500 so that's going to hide it if we look at the matcher these are all the things we're matching against without", "start": 497.96, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
10
+ {"text": "this and 500 is here with that filtered we are now filtering that out and we can see all the IDS that have something we have 79 9899 and 101 so far um let's see V IDs text 7998 19911 okay so those are going to be the valid IDs um what happens if we create our own let's go to files upload I think I'm still intercepting we can upload a test file and see exactly what this looks like intercept on upload so we just post to/ upload and give it the contents the file name read me.", "start": 578.079, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
11
+ {"text": "license get home and we have the test file here we can look we have a few more options when we have our test file when welcome to do a drive we have just view if we go over to a test file we have change properties which is update we have delete edit content and View and I guess we could have looked at exactly what 79 or 98 is the reason why I didn't is because it's a 401 error code anything 400s is going to be some type of error this is probably going to be like unauthorized right I mean you could do HTTP status 401 and that is unauthorized right so let's look at all the functions if we go here we can do update so if I tried 79 update is that what it was change properties 112 update we have a trailing slash if I get rid of that we just get it unauthorized so it looks like the functions we don't want a trailing", "start": 640.16, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
12
+ {"text": "slash uh the other thing I want to see is case sensitive if I do a capital it's not found so this is a case sensitive thing we can go to edit content let's go back here unauthorized see what happens if we change property so I'm going to now intercept apply and let's see how we specify it so we make a post to update let's try posting to 79 unauthorized okay so let's see is there anything else there is this reserve and that goes over to SL block if we go to 79 SL block it looks like we can view it and this one happens to have a credential we have this credential right here and it says I've created the user Martin on the server so let's try logging in s Martin 101011 235 basted in the password and we get logged in now there is one thing I want to go over because if we didn't find the SL block thing that way another good", "start": 712.959, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
13
+ {"text": "way to do it is just through fuzzing right um let's actually exit this Sate session to go back to a fuff so we're going to fuzz what is our ID of the one we uploaded 112 and then I'm going to put the fuzz here and then we're going to change the word list to opt SEC list Discovery web content API there it is API and we can try things in this one I like objects. text and you can also do ra small words you can use a lot of word list but if we do this hopefully we'll get a response back and we probably are not getting a response back now because I forgot the trailing SL exist there right we just want fuzz so there we go we can Delite let's see what else there is just Delite right now I'm hoping block shows up it's near the end it did not is blocked not on this word list let's grab block on this only blocks so that's why that did not show up um unblock so I guess it's not in any", "start": 813.32, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
14
+ {"text": "of these a API word list so maybe you're best off using raft small words let's use that one web content raft small words. text and that will take a while because we have 43,000 things to go and there we go we have a block I enough block redirects us because block has a trailing slash but update didn't weird and no file matches 112 update I wonder if we accident oh I know what happened that is awful so this is always the danger when you stand like automated test against a web application I know I've been burned this by the this before sending like acuns or net sparker at a application and then it goes and hits some dangerous functionality what is the first API endpoint we hit on our fuzz I'll give you a hint it was delete so the very first thing we hit when we fuzzed all the functions was a delete and then That's why nothing else came back we", "start": 898.04, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
15
+ {"text": "deleted our post and then everything subsequently just didn't respond so whenever you do fuzzing always be careful with that um I'm going to do 100 for that reason because delete isn't a thing to us in 100 so if I went to let's try the objects again and I'm going to change it to 100 do we hit more things there's delete there's update so we are hitting more things block is not on that word list but um yeah that is something to take note and one of the benefits of doing ctfs and exploring things like going Beyond route like this because you do learn those tips I now know always be careful when fuzzing an API endpoint where you could potentially delete something it's just something to test first so before I run fuzz I may want to look to see if delete is possible right so let's get back to this it was what", "start": 982.92, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
16
+ {"text": "79 then block I want to say 79 block there we go let's view it copy this password again so we can SSH um hopefully you enjoyed that small tid bit or rant there uh did not expect that to happen but I'm always glad when things fail in a CF because it's a good learning opportunity right so as Martin let's see what we have uh just a snap directory the first thing I want to do is go over the the web application so that's probably going to be in Doodle grive was it doodle grive the whole time it was I think I've been saying drive but it's grive okay we can't go in that directory if we look at it only dubdub dub data can there is a backup directory we can go in so we could grab all the backups so if we go into let's just um drop our SSH key here real quick let's go CD home m.sh then we'll s key gen-f", "start": 1045.799, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
17
+ {"text": "Drive cat drive.", "start": 1120.679, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
18
+ {"text": "Pub the authorized keys there we go this will just make it easier for me to SSH um copy things right we'll do Martin it was v dubdub dub backups need specify d r for recursive Martin at 10 10 11235 there we go it's copying each of these backups so let's go in and we can do 7z X to extract these I don't know why it wasn't tab Auto completing there we need a password um if we just do SQL light 3 db. SQL light 3. dump uh we have a lot of data definitely Django we see Jango right there is there like a it looks like oh that's accounts underscore select star from accounts G users oh man um dump L let's look for password there we go account custom user Maybe uh let's see this one high Team new backup schedule plan the database will be automatically highly compressed and copied to here small bat scripts that runs at midnight backup directory may", "start": 1127.2, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
19
+ {"text": "change strong password don't try to crack it nothing interesting so the password was under what was it a accounts custom user so we can do select star from this and there we go we have a few hashes see is there password guessing username there we go so we have some creds here I'm going to go over to the Kraken and this is just a box I have on my network so I can uh crack things not on my main computer because um it is a CPU intensive process and a lot of things can like slow down when you start cracking things so I like doing it just on a separate computer right so what I'm going to do is replace all the pipes with a colon because that puts it in a hashcat format and I'm can to do hash cat-- user this way when we crack things it ignores the username and I just like keeping the username there because when we crack it I don't have to go like", "start": 1246.2, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
20
+ {"text": "compare hashes this just makes it so much easier it tells me oh this password went to this user so let's do hashes Drive opt wordlist rocky. text does it have a autodetect mode for this it looks like it does it is cracking in mode 124 Django sha one so while that goes let's keep poking at this um server so back in SSH land what do we have if we go to home there are a few users I do find. dtype F I can only see files in Martin I see lxd if I look at my groups I am not a member of the lxd group if I was that is a quick prives um the thing I am curious about is what was on Port 3000 right because we do have that listening probably since IP tables was blocking us so I'm going to forward that to my host and if you don't know how I just did that if the very first thing you type on a ss8 session is this squiggly C", "start": 1328.679, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
21
+ {"text": "then it you drop you in this command line mode where you can just enter the SSH flag um I think you do DH it gives you the helps to do Port forwards so definitely helps I now have Local Host bound to my host and it looks like there is get T and this is a goang version of let's say GitHub so let's try signing in username or email address well we know Martin um his password will be over over here so if I do Martin the password it does not work but if we went over to what we are cracking we did get one if we do D- show we can see we got Tom Hans his password is John 316 but if I look at the hashes and go to drive Martin is Martin Cruz here so we can also try this one oh whoops Martin Cruz and I gotta copy his password again and we can log in I would also try logging into as Tom hands but that does", "start": 1403.52, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
22
+ {"text": "not work I will save us the five minutes it would take to test um we have this repo highly enough it goes to 404 so whenever I specify Local Host it isn't going I don't know what's happening but we have to specify 1271 um that is bizarre I'm guessing what's happening is um Local Host on my box could be going to IPv6 and I'm not forwarding IPv6 yeah that is probably what is happening um let's test this out real Qui because I am curious I'm going to turn burp Su off let's go to Local Host 300 44 so let's pseudo V Etsy host and I will comment out that one so Local Host is 1271 that is not it or maybe DNS is cast or something weird I'm not sure what's going on there that is odd but anyways if we just specify 1271 we do have a application so let's try to download this and where does it let us download Right Here download repo download as", "start": 1488.399, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
23
+ {"text": "zip and it's probably oh that looks better htb drive save let's see if it downloads or downloaded the 404 page uh file doodle looks like it's a zip so we'll make a directory Source 7zx doodle go in here and I'm just going to open this up in Visual Studio code to explore it it's G to take a second to open up hopefully where are you there we go and let's see we have manage.py it's definitely going to be Jango I'm going to go over to sneak to make sure um the code security test runs it looks like it is downloading some updates if we go over here let's see exactly how does this work so if we go over to admin custom user apps it looks like my visual studio is hung I'm going to give this some time just to fully load up because my VM looks like it's struggling this thing stopped updating so it may just need a", "start": 1583.6, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
24
+ {"text": "few seconds because I think updates are being installed at visual studio and just hung things okay it looks like my computer has calmed down we still have the code scanning going on one thing we could also do since it was a get repo is do like a get log um I wonder oh because I downloaded at as I did I don't have the get history so let's go over here to the commits and we can see what else there is we have change the password hashes to sha one change the password hashes to bcrypt returning the default Django hashes this is where they added the database backup so if we look at it they have a shell script to do database backup they're using 7zip dap and it says hack this password if you can so it looks like that could be the password we may not even have to do any code analysis so let's go uh back to where we have the backups 7zx star.", "start": 1659.12, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
25
+ {"text": "7z uh 7z X I guess it did not like how I did that 7z oh is is every file going to be db. SQL 83 or is it this I think it I'll put it here um so let's do SQL 8 3 doodle Drive DB select was it password from account custom was that what it was called uh let's just do dump strong password account custom user accounts custom is it underscore like this there we go that's a different format okay do to users okay let's get the next file so one November uh what is that password yep overwrite it still have new hashes SQL light 3 7zx one October paste overwrite copy it over to users and the final one go over right there we go so if I cut users we have quite a few it looks like the password was not changing between them but we have some more so let's go ahead and grab all of these go back over to hashcat um I'm", "start": 1726.36, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
26
+ {"text": "going to do hashes Drive 2 put these and then we want to replace all the pipes with colons just like we did the last time and now we can crack this so let's do hashes drive to opt wordless rock. text and we'll see if it detects the correct mode we have it in 10,000 which is D Jango pbkdf2 sha 256 so it looks like we are cracking and let's see I don't know how long this is actually going to take um if we look at it it says up to 2 hours I'm going to let this go for a few seconds to see if anything does pop and there we go we have one password and that is John Mayor 7 and that is this hash um it doesn't tell us the user it goes to we could um open a new window or quit this out and do show um to see exactly the user or we could have just grapped it right but I'm just going to look at the user it looks like Tom Hans his password is going to be John Mayor 7 so let's try this", "start": 1871.12, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
27
+ {"text": "password on the box so we go back here and we can do su- Tom hands oh it's probably just Tom let's cat Etsy pass WD uh it is just Tom we see it right here so we can do su-tm put in this password and we get logged in as him if we look at the readme here it looks like there is a binary of Google gr doodle grive if we try to execute it we want a username we can try IPC and a password and it says invalid username and password so at this point I want to copy this binary over to my box so we can see if it has any hardcoded credentials what is it doing here is it trying to access a database when it does username password is it accessing a file I don't know so let's stand up a netcat listener we'll call this doodle grive is it CLI or something d c oh well um and we can C this over to our box so Dev TCP 101 148", "start": 1945.919, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
28
+ {"text": "901 looks like it's sent let's just md5 some both files to make sure they are the same thing and it looks like they match so let's go open up gidra and see exactly what this binary is about so let's do file new project doesn't matter what we put here cuz I'm not saving any of my analysis open up the little dragon and then we will import the binary once this loads there we go it's disassembling let's analyze it okay and I guess we never even um did a file against it to see exactly how it is because if it was like go Ling or something like that it would tell us here uh we could also run strings against it to see if anything sticks out of what could be like a password but the easiest thing to do is just look at G and it looks like my VM has slowly Frozen we see it hung right there it's probably just loading this binary so I'm going to pause the video", "start": 2011.76, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
29
+ {"text": "give it a couple seconds for this to finish loading and then we will look at what gidra says about this okay so now gedra is loaded I'm going to go over to the exports and let's see is there an entry how about main if we go here it looks like there is a main so we can see the code here here's it loading it's doing the set uid and G ID then it does enter username and then enter password and it's comparing the username here so if we look at and a username it's assigning it to local 58 we can say username and if we look at password there it is so we can say password Here and After we relabel those I was just clicking and hitting L if you don't know how to use that it calls sanitize string on the password and then it's going to compare the username against moror and then it's going to look for this password so we have credentials to", "start": 2086.119, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
30
+ {"text": "this so so if we went back here we can now um execute this enter the username and then enter the password looks like Sherlock Holmes themed and then we have options right we can show user list we can show the group list check the server Health um look at the request log active uh like activate accounts I bet if we read the read me we don't understand exactly the purpose of it all so if we log in it says welcome and then calls main menu so going to main menu we can look at what each of these things do so we go to show user list it's going to execute SQL light 3 and then just do this Command right so if we do groups list it is going to again call system with SQL L 3 doing all the commands so it looks looks like all of these are sqlite I guess server log this would prob cat a file so it's using pseudo- dubdub duub data so this is telling us that um W data can", "start": 2155.8, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
31
+ {"text": "have a pseudo Rule Do we have any access to um the web server right if we go over dubdub duub doodle Drive no we did HTML can we drop files in HTML let's see tou T permission denied who can write in here uh only root so let's see yeah only root can write there so we don't have any way to drop a file and what I was thinking is if we could drop a file on the web server maybe as the PHP module enabled drop a PHP shell and then gain code execution that way right um but it doesn't look like we have have any ability to do that so let's keep looking we do want to look at the pseudo rules for that though because I keep that in mind because if we could ever find a way to get to this user that may be a prives right so let's go back look at activate user account and this is doing something similar right we have this equal L three but it's also prompting us for uh", "start": 2228.88, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
32
+ {"text": "username so this is going to be let's see it's loading the username where is it um 148 here this is probably it it does fgs yeah so username activate so let's look at the sanitized string because right away this looks like we could just do Straight command injection right because we got a system command here we're inputting data at this percent s so if we just put a double quote a semicolon we should be able to execute commands right it does call saniti string though and this is a weird way of gidra decompile showing us a loop but essentially this is looping through this variable and each of these hex is a character so we can see like backslashes the skirt uh curly brace what other thing is bad uh pipe new line character n bite all those are bad characters and we also got this one which is a semicolon and it's just", "start": 2304.76, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
33
+ {"text": "treating this I want to say as a double word which is eight characters but if we look at the Loop here it is actually going through nine right so we end this we go through this variable and then this one so all of these are the bad characters um so since the pipe the semicolon was like dollar bad dollar is not bad I don't I wonder if that will work let's see that may work will parentheses bad no let's try that so let's go back to our home directory execute this enter the username we have to grab the password where is it uh here it is now we want to activate account I did exit and then what we wanted to do is make sure we get a single quote in which still it's anti string activate user account we want to get a single quote in so we get out of this username and then let's try a command so if we do let's do sleep", "start": 2378.599, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
34
+ {"text": "five to see if we sleep for 5 seconds uh we did not and it said unrecognized token this dollar so it doesn't look like we can um use that because it's going to be part of the sqlite command uh oh because it's in single quotes and a single quote was a bad character so that's why we can't escape that um so where we're left with is we have to find some way to exploit this and since we're just doing the SQL light 3 binary we can probably use some type of SQL injection in this the binary also is vulnerable to a buffer overflow but I find the SQL injection route the more interesting one so that's the one I'm going to be showing so if we look at SQL lights um help so SQL light 3 maybe if we just do help a man let's see command line shell this will talk about the command line client for SQL light and you can see all the things it supports and there is one really interesting thing that will help us um", "start": 2469.48, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
35
+ {"text": "Escape out of the SQL query and that is the edit function so we could just read this but um it would be easier to just show it first so if we do SQL light uh see sqlite 3 doesn't matter what file name it's going to automatically create it if it doesn't exist if I just do a select one we get one but if I use this edit function we do select edit one it's going to say no editor for edit so then we're going to specify user bin Vim like this and let's do it in single quotes because I already Ed double quotes for this command okay I'm going to say um this is not one this is please subscribe we're going to save and exit and now my select command says what we put there so this command is a way to um open up an Editor to write something I don't know an exact purpose of it maybe if you're editing a line and want to use", "start": 2539.64, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
36
+ {"text": "them to do like search and replace or something or like an update command not exactly sure I've never used this function before but it exists and we can trigger it right and there's going to be one thing that will help us um bypass Bad characters and that is the visual environment variable so if we went back to this we have no editor but if we did visual is equal to user bin Vim then it now executes it right because if it doesn't get the second parameter it defaults to an environment variable and environment variables are very useful in set uid binaries at least exploiting them because unlike PSE sudo your environment normally doesn't get reset so you can pass environment variables into um whatever program is being executed so let's go to activate account and we will say um a double quote let's see let's go back to what the command looks like so we're", "start": 2595.48, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
37
+ {"text": "here um where usern name is equal to that I wonder if I can just do edit right away um let's try edit one will this work I doubt it uh near syntax error so that doesn't do it so we just want to make this a valid query I wonder if we can do and edit one no editor that is what we wanted to see right so if we did a five double quote and edit one uh user bin Vim like this we see it's dripping out all the slashes and I think that's all like the sanitized string function right let's look at exactly what sanitized string is filtering out again so let's see filtering back slash slash squirly pipe new line not sure if it's doing everything let's see I'm going to try v test let's make a bin Bash and let's call bash I'm going to see if I can ex uh exploit this quickly without using um the environment", "start": 2656.839, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
38
+ {"text": "variable where's the password grab this Marti put the password five so we do that and edit test oh um hold on five edit one test like that and that does not seem to have worked maybe it's just not executing in this current working directory I don't know where this um is executing but let's try setting the visual variable now so if I do visual is equal to user bin Vim um put in the password or the username now we put in the password Let's Go activate user account we'll do a single quote and edit one and we get dropped to Vim so now I can just do um a colon to enter command mode then exclamation point B Bash and we're root because we use the edit function after we set uid executed vim and that lets us go here I don't know if I explained that well so the set uid binary changes to root and then as we are root we executed", "start": 2764.92, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
39
+ {"text": "the SQL late 3 binary and because we root when we're executing that when we did the edit function it executed vim and that executed as root and Vim we can just escape with the command right so now I can just do cat root root. text uh we don't have a path set right what if I do bash um let's see is it Ben cat root user bin cat where is cat installed I think that's it root.", "start": 2874.839, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
40
+ {"text": "text hold on one second Echo path let's just fix our path and then do this okay Mar oh man I'm have to take that password again copy paste activate user edit one bin bash export path is equal to that I'm guessing it failed because I can't read well I was thinking I was in my home directory but again because of the weird environment variables and everything it thought um my home directory is home Tom despite me being root because I'm guessing like is there like a echo home yeah the home was not reset so because the environment variables weren't reset set that's why I couldn't get root. text when it looks like I am in Roots home because uh yeah if I exported home to be SL root now my um terminal prompt says that so anyways let's look at another way we could have done this SQL injection so I'm going to get out of this and we will run this", "start": 2922.04, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
41
+ {"text": "again uh let's go for the password and grab this oh wait before I grab the password we have to create a file so I'm going to make t or we'll make lowercase a and that's going to be bin bash and then this will just execute bash and let's make this executable uh we made it a and what we're going to do here is very similar to what we did before with sqlite so we do sqlite 3 test. DB select one like this we can see that one there's also a load extension so if we look here um oh this even calls out potentially harmful side effects such as edit we found that one I don't know what this tokenizer is but we have load extension and this is going to attempt to load an extension since it's executable it'll just execute code so I'm going to um make this whoops there we go b bash okay I have a here I thought I", "start": 3024.599, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
42
+ {"text": "do there we go so I have a in my direct and we'll do a load extension and we'll call a uh it attempted to load a.so so maybe we have to actually make this a script um I wonder if we move a to A.L and try this again no such file or directory that does exist right yeah do we have to specify the full path home ipac htb drive a.so file to short so maybe it wants us to actually make a program so let's create um C.C and we can do in a net let's make sure we are setting the uid and GID I don't think we have to to do this since the program does it but might as well and then let's do system um where's bash which bash user bin bash like that okay and then we need to compile it so we're going to do um GCC shared cy.", "start": 3112.64, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
43
+ {"text": "C we'll call this a do so and we want no start files and function we do have a.so so let's try this now undefined symbol so I think instead of anit we need this recompile and there we go um I bet if I exit here there we go we have the select one um if we wanted to make it more obvious we may want to like uh print something instead of doing this bash because we just executed this right um when I exit that's when the select statement comes so let's do Python 3 HTTP server WG 1010 148 8000 uh- o a.so a.so okay so now let's go back to Doodle CLI and we'll want to copy this password paste this in then we'll activate account and we're going to close out of the SQL then we'll do a comma we'll do load extension and then we want to specify a like that and that's a bad character the single quotes were bad I wonder if we can do double like this and then let's end it with a", "start": 3203.0, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
44
+ {"text": "comment syntax error near that let's see what was the query we're in sanitize string right now so we update accounts where is active one where username is this okay so this is a we username right and what we did whoops was do a comma we probably want a and here here or we can use this and as well because a comma is invalid right there so let us change this activate account we'll do that and load extension a uh should not have capitalized the a no such follow directory okay so we have to specify um the current directory and since slashes are bad characters that's going to make it somewhat tough right we had the problem here where we can't do it but if I did a slash then it loads so slash is a bad character however um we can do encoding right so in sqlite I think we do care and then 42 maybe lower case", "start": 3321.799, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
45
+ {"text": "um SQL light encode care is it CH AR there we go so that's what it is man asky let's go to where the star is we did 42 so we're encoding it as where is it decimal so we want a period so period is going to be where is that right here 46 so we're going to want care 46 we see that now we want a slash that is going to be 47 and then we want a which is 97 so that we'll put SLA so this is a way we can get around the bad characters so let's load this extension again and then we will select the care like that and that did not work let's see what did we do we did load extension care I guess we should test this out we need a select that does drop us in bash so where did we screw up maybe I copied that single quote and we don't want to let's just try it again activate user we terminate comment like that 8 out o not", "start": 3426.44, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
46
+ {"text": "found care 46 47 97 we must have a bad character somewhere or something let's see where did I paste that load extension I don't think I have any bad characters comma is not one dash is not one unless space is if has a space let's get rid of that real quick five is pound one no still did not work let's try five and we'll put the load extension also so in parenthesis like that copy this payload a.so does exist right file a.so what that is not what I wanted well that explains your error that looks better so I don't know exactly what I screwed up there my WG failed me um I'm guessing we had it working a while ago it just wasn't learing the file because it didn't have bad code in it try this five let's load extension uh we don't want that single quote like that there we go that was it so that is the second SQL injection we could do so", "start": 3569.799, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
47
+ {"text": "we could either do it through the edit or the load extension you may be able to do it through other parameters here um I don't know exactly what the harmful side effect of fts3 tokenizer is we could probably write the SSH key as root so that's something else we could do um as long as the SSH directory exists right it doesn't look like SSH exist so we wouldn't be able to write the SSH key key unless right file can create a directory which I doubt it can uh we can easily test that out let's see select right what is it file T how do we use WR file um one cat T so we wrote one so if I do does not exist LS we don't have that directory so it did not create does not exist if I make the directory oh wait do slash oh it does create the directory I probably just created that on my um slash or I did not because I don't have permission so I'm likely we could write", "start": 3747.92, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
48
+ {"text": "an key let's try that real quick I have not done this one um okay so let's see we'll likely want to okay we will have to encode that slash or yeah we will so let's say and write file let's see Select care what is slash was that 47 it is can we append that way that did not work is there a concat function um SQL light join strings let's try this oh we do two pipes that's right pipe is a bad character okay let's just um encode everything so we want dot which was 46 then 47 then we want SSH so where is s 115 then 115 and I'm just realizing this is probably going to become a massive massive pain because our SSH key is going to have bad characters I think and I don't feel like encoding everything although we could probably just go to cyber chef and encode it right uh 104 Select Care like that okay oh we have to do authorized Keys um I guess it's time we go to", "start": 3833.319, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
49
+ {"text": "cyberchef which we should have done much earlier because we can just easily get this done I'm going to do dot so I um can see what it is I think we're in decimal format right two decimal 46 and SL was 47 right that is correct so authorized keys and let's look for replace oh we can do delimiter comma there we go okay so SSH uh this needs to be a 47 there we go so let's see if we can make this on the server so we WR file that ugly thing and we'll do one real quick and we'll close us out so 1 2 3 and a comment okay so I think we can write um see let's go to our other one I think I lost it shoot um yeah that sucks I wasum I could just get my root shell back really quickly so we could um look at that file because I think we're going to run into potentially the buffer overflow if this is where it exists I haven't actually done it maybe we'll do it at the end of this video", "start": 3996.24, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
50
+ {"text": "um let's see sh key gen small Pub Key what is that format generate Ed 2559 that's it s keyen DF root- T that so this is a much smaller key than anything else and of course we have slashes if we do this enough I wonder if it's possible we get one without slashes we'll try it twice more oh there we go oh no we have one slash slash at the end that's got a plus but no slash so this may be a better key to do okay so we want to do uh we lost the whole command that's annoying um it was right file right and write file we want to write to this then the contents of that is going to be this I guess I should copy this and we should put a commment at the end I don't think that worked because it like looped over this a few times and now we exited so I think we're hitting the buffer overflow or something", "start": 4121.44, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
51
+ {"text": "um if we look at this if we do a select statement again where is it we can test to see if it would work so select like that uh unexpected token I think because I have quote setion going on select one two three there we go we got sh and we got authorized keys so it does WR um we don't have the period though let's see do we forget the period on an incode we did not oh we did we have slash SSH so we want slash SSH like that so 46 and then two parentheses this should be the payload so to try this one real quick because we were having errors in our SQL command base this and WR file oh we already have it like that and then we could try sh- I root root at 101 or let's just do drive. htb because I forgot the IP and it doesn't work so I think we're definitely hitting the Overflow just because of how many times this um menu option shows up right", "start": 4297.08, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
52
+ {"text": "we can do visual user bin was it VI is that what Vim is which VM yeah war and then what was it and and what was the thing edit one like that we need to okay do we have cat uh B cat SSH yeah SSH doesn't even exist so we never wrote the file um and we weren't writing the file because we did Slash shoot uh ver where are we uh Tom bwd oh this is actually where we are too so dudo Drive does exist we're trying to create the SSH directory here honestly um by mistake because I was just doing. SSH and this is where the directory was so we never would have actually wrote to root we'd have to to do SL root. SSH but either way it did not create the file uh Bin LS on SL root and that does exist but that's not our key at least I don't think it is yeah so we don't have enough length to actually write this key unfortunately so I guess let's look into", "start": 4463.96, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
53
+ {"text": "the buffer overflow and it's been a while since I did anything binary exploitation on this channel so hopefully I can still explain this um the first step is let's run chec against the binary so we know what built-in protections are at play here and we see aslr is not enabled so any Gadget we find in this binary we can just immediately reuse we see dep is enabled we also see stack canaries are um enabled as well so let's go take a look at the binary I'm going to go over to the main function and we can take a look at these things so the first two plays that we have user input is username and password and we're using fgs so we can see when we're loading the username we're only loading 16 bytes which is the size of a buffer so that is fine however when we load password we're loading 400 bytes here and we've only allocated 56 so this is where the buffer overflow", "start": 4585.199, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
54
+ {"text": "comes into play however there are stack protections here so if we attempted to um overflow the stack this will uh block us in theory right how the stat Canary works is it puts something in between where the like stack is and all the registers and that just does checks because if you overflow the stack to get into the registers you're going to overflow the canary and this check's going to fail we can see this being um allocated right at the top of the program so uh pretty much the first thing it does is builds this Canary so we'll look into that in just a minute but let's validate our buffer overflow so I'm going to run doodle drive I'm going to enter the username IPC and this is going to be one piece of the vulnerability it echoing this data back but we'll get into that in a second um let's just throw a bunch of A's at it we probably only need like 60 since 56 was", "start": 4643.08, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
55
+ {"text": "the limit um we see stack smashing detected it terminated so that's preventing us however because it's echoing this back and we're just doing a print f um we can leak memory addresses so let's show this real quick it's just a format string vulnerability right if we enter the username um LX we're going to leak the very first memory address if we do LX LX we're going to leak two um the second one is zero um if we do percent two dollar LX this is going to be long hex to leak um a long field right so we have enter password for zero so if we wanted to we could say let's go to eight um long X there's our first potential memory address now that's not the canary because canaries are null B terminated so we just want to run this program a bunch of times and find a potential Canary so let's do this first let's call", "start": 4701.36, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
56
+ {"text": "a program leak Canary pi and then we're going to do from pone import Star and then we're going to load the doodle grive CLI program and then for I in range let's go through 100 things there's going to be the first 100 um variables we're going to say IO is equal to e process so loading the program uh we want to execute it we have two lines that it reads so we'll say io. receive line io. receive line so now we're at the user prompt so we can say io. send line and then we want to send um let's see the percent and then I then dollar LX and then then we want to receive the line so I'm just going to do a print io.", "start": 4769.08, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
57
+ {"text": "receive line and then we can say IO close and if we run this uh we have a bunch of data I'm going to disable logging but we can see we are leaking stuff so let us say um the level is equal to error so we got rid of um I believe this is debug this is info so we got rid of those two things so now we run it we just have what we want so here let's just say line is equal to this and I'm going to get everything but the last two bytes because the last two bytes is going to be that null B and then the colon and let's see we can probably do decode as well because I want this in a string format uh maybe not oh we're not printing print line there we go awesome and actually I was going to just do a split but we can also count how many characters this is Echo WCC that is 20 19 I did not do um a dashn so I added", "start": 4827.52, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
58
+ {"text": "a line break in there that's the correct number so now if we run this again we have a list of all the addresses now what we want to do is print this so we'll do F string um I and then we can do a tab and then line and we can prob say. dcode to turn that into a string so we get rid of all those B's and if we just GP for anything that ends in a n bite we can see a few potential um canaries at 25 23 19 and 15 I'm going to guess it's 15 because this is the length of this is 16 bytes or eight bytes I always get that mixed up but this looks like it's the correct length it's got a bunch of Randomness if I run it again all these are always zeros those are not good canaries this is um and since it's n bite terminated we have a lot of n bites here so that also can't be a canary so the is at position", "start": 4931.199, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
59
+ {"text": "15 so knowing that let's play with this program real quick um so we explained we want to we loaded the canary here so we can view it we could also view it down here so let's do GDB doodle drive I'm going to break main we going to run and let's step step This Is Us loading the canary so if we look at Rax we have the canary right here um let's do V I meant note but that's going to be the canary so I'm going to continue and let's enter my username so we're going to say what is it percent 15 long X there we go enter password for this is looking good right so leaked 0x that looks fine uh we want to smash the stack but before I do let's break on this and that's going to be 40 23 27 here x 40 23 27 continue let's mash the stack okay so this is going to be what we inputed so if we IR rcx we're all A's and if we look at this", "start": 5005.04, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
60
+ {"text": "this is going to be um the canary so we can say fscore base plus 0x 28 there's a canary so that xor is not going to equal zero so we fail the stack check right but now since we can leak the canary and that um enter password for whatever thing we can now smash the stack or we can um put the canary where it needs to be what we have to do is figure out exactly where that is so I'm going to say pattern create 100 to create this string whoops let's just copy and then we will rerun the program we can continue enter username we don't care here um enter password right there and now we have um overflow the stack and this is going to be where a canary is in rcx but since we have a pattern string um we can just do uh pattern offset this and we see after 56 bytes um we hit our thing if you wanted to instead of", "start": 5104.159, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
61
+ {"text": "doing register you could do print rcx and that stores it as dollar one so you could do pattern offset like this and get the same thing so we know after 56 that's when we hit this so what we want to do is create a script um we already Prov that we don't need it it changes every time so it doesn't really help us we can do python 3-c print a * 56 plus b * 4 of like that plus C * 8 and I should have done time 8 here because we're 64 bit okay so I'm going to put this in and what I want to see is um where's my break hold on let me break again what I want to see is all 42s on my canary cuz 41s would be a 42 is B 43 is C if I see any other than 42 um we have something wrong so we set the break point we can run it we can enter the username that doesn't matter put this and then print rcx and we see all 42s so now we can predict the", "start": 5181.719, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
62
+ {"text": "canary so let's start creating our script okay V exploit. pi and let's do from pone import Star e is equal to e.", "start": 5268.28, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
63
+ {"text": "doodle grive CLI and then I'm going to set my terminal to be t-mo so this will um enable us to debug easily so we want to split the window horizontal on the current pain I think that's right um let's do IO is equal to GDB debug let's do doodle grive CLI okay so we want to receive the line twice then we want to send it so we'll say IO send line um we want to say percent 15 long X like that okay and now let's grab how we have this so I can call this leak is equal to that then the canary we want to make that into hex and let's do log info Canary and then we can say hex Canary like that make that an F string and I'll just say IO Interactive and let's see if it works so we run it gdb's up and we have the canary there awesome so let's exit this and let's see we actually want to send this now so we're going to say", "start": 5283.92, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
64
+ {"text": "payload is equal to a * 56 because that gets us to where we overwrite then we can say payload plus equals the canary and then payload plus equals we'll say C * 16 and now I can say io. send line payload we run this I'm going to set the break point for the canar check then we're going to continue uh can't concat into byes p64 okay so we sent this Canary supposedly we're in where we have been every time we broke for the canary so I can say print rcx and that is what we thought it begins with 49 ends in a all bite so we sent that Canary now the question is does it match FS or the actual Canary so let's do a um XG FS base 0x 28 it does so if we continue um we hit this we crash because a return goes nowhere right that should be all um C's the RSP the stack pointer this is where we attempted to return to and no go right so we have to start", "start": 5416.04, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
65
+ {"text": "building our payload now so let's see if I look at exploit we have that um this is where we're going to use ropper whoops ropper DH and I'm going to look for the string bsh oh with specify file uh was it doodle drive there we go so bsh is here so we can go V exploit um let's put everything here so bsh is equal to p64 that um system should be in this program because we have have been calling system uh that will just be system is equal to e. Sim system let's do log info bsh string at bsh and this will be system address at system prone lib elf because I call it e yep so we have the addresses there um we have not converted them correctly uh let's see could I just p64 this is that going to work required argument oh because the memory addresses I already did p64 there so let's just add aex and that should fix", "start": 5524.04, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
66
+ {"text": "it let's see Bess say St fixed um system address did not in object has no attribute x what was system printing as is that fine already line 11 oh because we don't have a n parthy okay that is good I guess we could do b64 there there so we have everything um I think this formatting is wrong there but I don't think that will matter I think that's just for the printing thing so that looks good okay so in order to do this we need a pop RDI so we can say ropper let's go back to the command search for Gadget pop RDI return uh how do we search gadgets search there we go we have this okay so we should have the pieces to the payload so we can say payload plus equals pop RDI return payload plus equals bsh payload plus equals system okay let us run our exploit and we failed not exactly sure where we", "start": 5688.52, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
67
+ {"text": "failed let's run this again and we're going to set a break point on the return because this is where we should overwrite so 40 23 380x 40 23 38 run oh shoot continue okay this is where we are and if I look at this RSP is Ben should it be pop RDI first oh right here RBP so we step what's a code look like we do the canary then we do pop rdii but I swear that did not happen uh let's go back to a break oh I know what's happening um we assume we have right access right after the canary but we have the base pointer right here so we have to skip over this because the first instruction is going to be the um stack pointer so we just forgot to put a little bit of junk in our payload so our pop RDI never actually executed so after we send the canary we do payload plus equals uh we just send a junk we'll say", "start": 5870.199, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
68
+ {"text": "this is RBP do gets us to Canary leaked from username print F RBP first Gadget of our chain there we go that makes more sense and we are erroring here so I'm going to go on the return again our payload is not done yet but I do want to show what just happened so now we have the return if I look at RSP P RSP is pop RDI so what we're doing here is we're loading bsh right here so if I do SI we look at it um I think the next time we step yeah we have RDI now pointed to bsh so when we call the system command it's going to pull the first argument which is RDI and it's going to run system bsh right so now we're in system bsh and then it airs still I don't know exactly where how far down the stack if I just do continue we hit it so this where it's erroring I think the move APS and our stack is not properly aligned um move APS I want to say wants um 16 bytes and", "start": 5990.56, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
69
+ {"text": "we only have eight I believe so we're just going to put a return beforehand and that should um aligner stack so let's go back to proper and let's just find if there's a return which there's pop RDI so there definitely is just return uh we can probably use this one return zero let's try this and let's see we'll put it we don't have any crashes if I do LS we get not found but bin LS it is we just don't have anything set in our path so we now have a working exploit so what we want to do is run this on the target so in order to do that try to think the best way I guess we have to SSH and execute right because I don't think um our Target wherever that is uh there we go has P tools right Python 3 import P yeah um import P tools is it yeah we don't have um P tools here so in our script we should be able to replace", "start": 6108.04, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}
70
+ {"text": "what we call GDB and have that be an SSH client so we can say SSH con is equal to SSH um host is equal to was it 101 11235 is that it it is then we'll say user is equal to um I forgot all the credentials what is Tom's password let's see Tom password is equal to we got that from the Kraken John Mayor 7 okay then we can say IO is equal to sh con. process and doodle grive CLI Python 3 exploit we connected it's not doing anything uh not executable it doesn't exist oh there's a dash there we go try this Now it connects it's going to log in and here we go if I do bin ID we now root right so I do bin LS on root we can get root. text so that is doing it through the buffer overflow and we'll conclude the video hope you guys enjoyed it take care and I'll see you all next time", "start": 6251.719, "duration": 0.0, "meta": {"video_id": "HM8_Pf8zxko", "title": "HackTheBox - Drive", "url": "https://www.youtube.com/watch?v=HM8_Pf8zxko"}}