k3nn3dy commited on
Commit
630fc3a
·
verified ·
1 Parent(s): 00f45f1

Add HackTheBox_-_Runner.jsonl

Browse files
Files changed (1) hide show
  1. HackTheBox_-_Runner.jsonl +39 -0
HackTheBox_-_Runner.jsonl ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"text": "what's going on YouTube this is IP I'm doing runner from hack the box which starts out attacking an outdated version of Team city which is just like a cicd platform it is vulnerable to an authentication bypass allowing unauthorized users to get a authenticated session to team city as administrator and what happens after we get that session is not an exploit so it's going to be applicable to any team City instance the first thing we do is just as an administrative user create a backup and download the backup that has like a database backup so you get all the uh user hashes that are in the table um if there's any SSH Keys related to a project you get those and you can potentially use them but if nothing's good in the backup we also show a way to enable debug mode which will allow just running commands on the box after that", "start": 0.32, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
2
+ {"text": "the pesque is a vulnerable version of run C but the trick here is you're not a member of the docker's group but you can log into painer so you can set the current working directory of a container and run it and then get root that way so with that being said let let's just jump in as always we're going to start off with an end map so- SC for default scripts SV enumerate versions - VV for double re this gives us the TTL and things like that OA output all formats put the end map directory and call it Runner then the IP address of 1010 11113 this can take some time to run so we' already ran it looking at the results we have just three ports open the first one being SSH on Port 22 and its Banner tells us it's an auntu server we also have HTTP on Port 80 it's Banner tells us it's engine X also running on Ubuntu and it's directing us over to runner. hdb so let's go ahead and add", "start": 46.16, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
3
+ {"text": "this to a host file so Pudo VY host and then we can add 101 1113 runner.", "start": 98.0, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
4
+ {"text": "htb and the final one is Port 8000 end map is telling us it's nagio nsca um I don't know how it came to the conclusion this is part of nagios um whenever you go to the non-standard ports and Maps a bit flaky on the service ID ification but the first thing I would do would be trying to connect to it on with like netcat and see what it says back so we'll do netcat 10 10 11 13 Port 8,000 I always like adding the uh V flag so we can see it did indeed connect and it's not responding anything back we put some junk in and it tells us it's a bad HTTP request so I'm going to try a curl 10 10 113 Port 8000 let's add a-v flag so we can see the headers and it's not telling us anything about the server right we just get a44 not found nothing about like X powered buy or anything like that um so not exactly sure what this is I don't", "start": 105.079, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
5
+ {"text": "think it's nagio maybe nmap's doing some other requests maybe like the nagio NSA has some unique thing you can request that Flags it but um I don't know we'll find out when we get a shell in the box so let's go ahead and just check out the web page so I'm going to go to http runner.", "start": 161.68, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
6
+ {"text": "htb and it looks like we just have a page for cicd specialist I want to see that's like continuous integration continuous delivery um it's like automated deployments things like that so nagus doesn't really fit in cicd pipeline so I'm not sure exactly why we saw that Port 8000 Flagg do nagio still um right now I'm just looking for any type of Link maybe usernames we have uh that we could like spray passwords with if we found a login form there is a email address here uh contact us just has a link to mail to sales run. htb so it's not an actual site um I'm going to start up a gobster fuzzing for virtual host as we poke at the website some more CU I always like having some type of Recon going in the background so we'll do gobster vhost HTTP runner. htb and then the word list op secist Discovery DNS and then and I'm just going to use", "start": 181.36, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
7
+ {"text": "the first one here the bit Quirk subdomains and we'll see if we get any hits there while we poke at this um let's see I like getting 404 Pages because sometimes you can flag exactly what it is based upon the 404 this is just going straight to engine X we could try like index.php index.html it is a HTML document I'm leaning towards this being a completely static website uh we just see some CSS and I don't even see JavaScript here so nothing's really revealing anything that the site is created in I'm going to guess this is indeed um just a static website so going back to our gobster we don't have anything there um we click get a quote again it goes to the mail application so I'm just going to let the gobster finish and hope it finds a subdomain so let's go back back over here and I'll pause the video and", "start": 241.239, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
8
+ {"text": "resume when it's done about 20% done and we found a subdomain team city. runner.", "start": 302.039, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
9
+ {"text": "htb so let's go ahead and add this to a host file so stud VC host and then we can add team City Runner htb and let's go take a look at this actual page so if we go to Team city. runner. htb uh it looks like the site's taking a little while to load but we do get a page and it says log to team City so we could attempt to guess passwords or guess accounts right um maybe it's m plot G as a username if we click reset password does anything happen this whole page is going slow I wonder if this is because of the um gobster on the server but I can't imagine that uh let's see we're going to do something that doesn't exist so I'm just going to specify Root atp. RS and it brings us to a page that like it sent the email so we can't enumerate if emails exist so I'm going to move on we do see the version 2023 503 build", "start": 308.759, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
10
+ {"text": "12939 we can look for exploits here so I'm going to Google the build number that exploits team City and then let's go over to Google and we see exploits right off the bat so if I look at this we have some type of exploit with a get token URL delete token URL and it looks like it is going to um potentially create a new admin so we could just try running this and that's what we're going to do but after that we're going to take a look at exactly what this vulnerability does so I'm just going to call this exploit. piy will that did not paste everything I thought it would there we go uh Python 3 run it uh we need to give it the URL so we can do HTTP team city. runner.", "start": 373.52, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
11
+ {"text": "htb and it says it created an user City admin n1k K1 and then that password so let's attempt to log in so we going to do City admin and then put in this password and it's attempting to log in and we get logged in so before we go poking at this too much let's see exactly what we did so we can say build oh what was that um right here see this exploit team City let's see is there good right up uh this CER Source has a page and I always like looking at exactly what the vulnerability is because you learn new attack paths right and the key thing to point out here is when we um first during the exploit we got a random token right and if you look at exploit. um the first request it probably makes is this get token URL so it's doing a G app rest users ID is equal to one tokens rpc2 right and supposedly it just makes request there and it gets the token so it looks like it's some type of idore vulnerability", "start": 426.12, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
12
+ {"text": "and if we read this um they talk about um how the authentication is performed within the team City application and then they have this one Interceptor which the Interceptor runs whenever like a client makes a web request it goes to this Interceptor middleware that just um determines if it needs authentication or not and right here this one Interceptor right um it's saying we've disabled authentication for anything that ends in/ rpc2 so any type of URL if it ends in rpc2 won't require authentication and looking at the tokens um you should just request app rest users the locator than tokens that last field this isn't us saying hey we're making an rpc2 request this is just the token name we're generating we're generating like a application token and saying hey this app token we're going to call it rpc2 so we can um invalidate it later if we want to but because it's called rpc2 it doesn't have", "start": 513.88, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
13
+ {"text": "authentication right so we can play with this to test real quick um if I do a curl let's actually grab that URL so we'll GP get out of that uh curl team city. runner. htb slapp rest users id1 tokens and then we say we just Cur this we need to authenticate if we do slpc we need to authenticate if we do rpc2 it says it's not supported um let's see check URL method request it allows delete post and options so let's send a post request uh the token already exist exist so let's S A delete request we've deleted the token then we do a post and it gives us this token which is just a um JWT I want to say if we Echo base 64- d uh what they give us double Bas 64 so I don't think this is a JWT token um tcv I have no idea what token this is It's formatted like a JWT but it's not um I guess I'd have to see exactly what this is uh coded in uh so we have the", "start": 583.519, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
14
+ {"text": "type it's a tcv 2 this is probably going to be some type of signature since this was just a blob we got back and then this was a ID so not exactly sure what it is but that's what we use to authenticate and we use this token in order to create a account so with this account we can go over to Administration and then we can backup the project so if I go to let's see backup I'm going to create a backup let's do everything uh we want build artifacts too I'm just going to select everything and then do start backup and then and once we have this we can download the backup so it's processing it should only take a minute or two uh backup file done in one second so it's not done just yet oh no backup completed successfully I was doing that be like it will be done in a second but nope it's done so let's move the downloads so", "start": 674.44, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
15
+ {"text": "downloads team City back up here I'm going to make a directory called back up just in case it doesn't create a directory first and then we can unzip it good thing I moved into this directory and now we have a um dump of Team City so if we go to the database dump we can cat users um permission denied that is unique uh chod - capital r let's do 744 on everything database dump cat users there we go now we can read it so we want to get this hash so what I'm going to do is pipe it over to a and I always like giving the um username and then col in the hash I think we need to put this in double quotes there we go I can let's see said let's remove the comma or the a field we can just say the field separator is a comma and then we have spaces that's annoying so we still end up using said to clean it up", "start": 744.0, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
16
+ {"text": "but we have three hashes so I'm going to grab these let's go vhes text paste this and now I'm going to go over to the Kraken which is just a box I running on my network um you can just run hashcat on your computer I would not run in a VM because if you run in a VMS it's going to go really slow but let's create the hash so I'm going to do V hashes we'll call it Runner um paste in this and we can say/ hashcat uh Bin then we can say let's see hashes Runner then opt word list rocky. text I also need to specify um d d is it username because I put the username in first I did username colon password and then it wants us to specify an algorithm this is probably going to just be bcrypt so we'll specify 3200 and it's going to attempt to crack it now I probably should have um removed the one hash we had right because the password it created it's pretty unique I doubt it's going to be in rocku um but oh well", "start": 823.519, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
17
+ {"text": "it just just means it's going to take a little bit longer to go uh so we have one already cracked Piper 123 and that is cu period M so if I just go here let's go in runner cat hashes it looks like Matthew's password is Piper something right Piper 123 so let's try logging in to the Box Matthew at 10 10 113 put in the password that is what's on my clipboard and we don't get logged in it could also be Matt so we could try logging in with that put this in and we don't get anything I'm going to go into the backup real quick we can go in database dump and I just want to look at his email because sometimes it would be like M and then last name or something like that and we'd get it but but nope we don't so we just have Matthew's password right now nothing else um let's see what other files are in this database dump or in this backup all together so let's see we do find", "start": 898.759, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
18
+ {"text": "period we have a list of all files I'm going to do type f and then let's see I want to just show me extensions so let's see how can I do this CU I don't want like 1.2 I'm going to said we can say um period digit plus let's see 0 to 9 and then we go like that is that just going to remove all the numbers it does not there we go that removed the numbers so now I'm going to do a and then we can say let's see we'll separate on slash and then we'll going to print the last um field so NF is the very last item and now what I want to do is the same thing except I'm going to do it on period and we will print NF again and now we can sort and then uni- C and this gives us all the file extensions this doesn't look like it's going to be um that handy so config we probably want to look at config that's a good one uh we looked at users I guess config", "start": 973.36, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
19
+ {"text": "may be a database dump uh there's a SSH key we can look at and that's what sticks out to to me so I'm going to go back here I'm going to GP config uh let's see it ends so that's in metadata let's see metadata backup. config nothing there uh let's look at where that idsa was uh let's see config projects all projects plugin data sh keys and then we got idsa so if we want to see exactly where this idsa goes to or the SSH key um the best thing to do is a g-v let's get rid of the header INF ferter there's like Das D Dash begin and open SSH keys and then we just base 64d code this and that gives us a bunch of gibberish right I'm going to type reset here oh my God there we go um we're going to pipe this over to xxd to do a hex dump and then at the very end of the SSH key even though it's a private is the public", "start": 1069.2, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
20
+ {"text": "key I I want to say this piece is public right here and we have the user that generated it JN so this is going to be J's SSH key so we can s-i let's do idsa John at 1010 1113 and it's an unprotected key file so let's chod 600 uh ID a and there we go we get logged in I'm going to copy this key real quick so we can say ID RSA htb Runner I'm going to call this john. ID RSA just so we have it easier found so now we have a shell on the box but before we go enumerate what John has access to I actually want to take a step back because we got a shell to the Box because we found a SSH key in the backup now that's probably going to be the case a lot of times right because team city is a cicd platform and a lot of times they use SSH keys to Aid an lateral movement to the runner so they can push fils run commands things like that but", "start": 1143.96, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
21
+ {"text": "if you didn't have a SSH key that got you anything maybe team city was um in a DMZ that you could talk to but you couldn't talk via SSH to anything it talks to right and you wanted to run commands on the team City box there is a way and it's not even an exploit so I do want to show this because there's going to be plenty of times where you may get like administrative access to team City and want to pop it right so to do this I want to look for the actual cve and we're going to just Google upon this because this gets us to a another article that is pretty good where is it um I don't see it actually uh let's see exploit right here is the page this pre- n and it's going to talk about some hidden end points that we can use um so we get the token so let's do that first um we got a curl uh Team City Runner", "start": 1214.799, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
22
+ {"text": "htb and then we give it this endpoint that gives us the token and we're probably going to have to run this in delete first um because the key already exists for rpc2 so going to delete that then going to get a new key okay let's just grab this and then let's see we can say DH how do they use this is it just authorization Bearer token so sxh authorization colon Bearer authorization Bearer like that awesome so we have that token and what they're going to do here is um let's see that is executing where is it here's the end point we're going to hit admin and then we're going to enable the rest debug process so we're going to do this uh we probably want that as a get I would think we need to do a slash here I'm also going to put this in single quotes because bash May process this Ampersand sign right okay if we do A- V what", "start": 1275.12, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
23
+ {"text": "happens nothing I expected it to respond with something um we just did H wonder if this needs to be a post see what do they do expost don't respond with anything they also send the content type text plane I don't think that does anything The Bu Quest will create the following under internal property so supposedly now we can just run commands on the box let's try this real quick I may have done something wrong but if I didn't this should work so it goes to app rest debug process app rest debug processes did I spell that right 1 C 2s 1s okay and then exe path is equal to we'll give it who am I hey we got it working right so if I set this to false run this again it still runs not sure we're doing this right but we got command execution so I guess everything's good they have two slashers it can't be two", "start": 1362.64, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
24
+ {"text": "slashes there okay well we have command execution um not going to ask too many questions oh wait it looks like it's failing now um this server is not configured to allow process debug via rest debug awesome so it just took a second for it to restart so let's set this back to true and I guess it's important to know that team City doesn't really tell you anything um when you change the config parameter which is just weird to me but okay so we have the exe path at who am I I'm going to actually let's set this to burp Suite so I'm going to do X um HTTP Local Host 880 let's go over here intercept it uh weird I think that's proxy right 12701 okay we have it so we want to run commands I'm going to do Echo test and we get a error so in order to do parameters let's see does this tell me it's probably going to be like e exe pams right", "start": 1469.32, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
25
+ {"text": "exe let's just guess that and exe pams equals test uh Pam see how do we send parameters they're running the command let's see debug process let's just Google this string see if it gives us way to do arguments debug endpoint that's still loading okay they just say params Rams there we go test and then do we do two okay so we can send parameters to this so if we want to do bash we can say bash and then prams um let's do ID and it can't execute the binary file so we want to do- C ID and this is in the URL so we have to do like percent 20 for space if we do plus does that work it probably works um but it's passing - c% 20 ID to pram one of bash which is inv valid right this is very much like the video we just did yesterday uh not yesterday last week um what video was that youtube.com formula X right formula X we", "start": 1556.0, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
26
+ {"text": "had a way to um run commands in Open Office but we can only do one parameter so uh we ended up writing a file there's a way we can get around that in this though we don't have to we could just do two pams so we could say and pams equals d c and then this one ID right and that works just fine but in a case where you only have access to one argument using a is actually a good way to go because a you can send um everything to just pram one and get to execute commands um I'm going to go back on my box real quick because I think I know the syntax I think it's a uh begin system ID is this the syntax we need Maybe like that there we go so this is what we want to send to pram one uh you want to send the begin the system and then the command so we're going to send this and see if this works so we do a like that and we get an error", "start": 1684.88, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
27
+ {"text": "message so what I'm going to do is Echo and we still get an error message on this so we're going to URL encode if I press control U it doesn't encode anything let's just convert selection URL encode all characters and there we have it so if I put this back to a um we get a unexpected character it's probably going to be the single quote so I'm going to get rid of that single quote and then we have the command awesome so what we want to do here is now send a reverse shell so we're going to say b c b-i Dev TCP 10148 910 and one like that uh and that quote that looks good we can copy this and then we will go back here we're going to paste and then we're going to URL in code every single character 91 run this and we get a shell so this is another way we could um show the box but it doesn't matter if you were TC user or John the next step is going to be the same so I'm just going to close out of this and we", "start": 1753.6, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
28
+ {"text": "will move on and the first question I have is what was Port 8000 I do it ps- EF and we can't see processes by other users and that's just because the um proc is mounted with hide pit equals 2 so this just hides the processes from other users so we can't just do a PF and look at if Port 8,000 is in any argument right I could go to like um Etsy and we can GP for 8,000 and pipe errors to devn if I could type um let's see gp-r 8000 like that and we don't see 8,000 anywhere in Etsy so I don't know exactly what is listening on Port 8000 if we do an SS we see there are other ports we have eight and then three ones so I'm going to do curl Local Host eight and then 3 ones uh this looks like it may be a team City thing right because when we were trying to access tokens without specifying rpc2 um this is the thing it responded to so I think that's team City let's try", "start": 1840.48, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
29
+ {"text": "9443 and that's probably going to be an https because it ends in 443 and we get a bunch of HTML back if we look at the top of this or I just notice something right here we have painer so this looks like it is going to be a painer instance there we go what else do we have SS lntp uh let's see curl Local Host 50005 um that is not a web server I don't know what this is I just close the connection C Local Host 9000 and that's probably portainer as well so what I'm going to do is the first line I'm going to hit is contrl C or not control C that squiggly C that drops me in this SSH prompt and I'm just going to say create a dynamic proxy on um Port 1080 so now if I go over here I can click on socks and then let's go to 1271 Port 9000 and this is going to be portainer so we need some type of credential we could go Etsy let's see um CD Paul find. g-i", "start": 1907.48, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
30
+ {"text": "Port let's see engine X we see as sites available see let's go to Etsy engine X sites enabled uh painer that's on 9443 I was hoping to find exactly like where painer is installed there we go we found it um let's see those are all binaries right yeah that I should have just ran a file command find dot- type f I was looking if we had like a password and I don't see anything so this is probably just going to be a Docker container or something um we did crack Matthews password right that was Piper 12 three I believe that was from the um Team City database and we get logged in as Matthew now I spent a lot of time here when doing the Box the first time trying to figure out a way to exploit this because the exploit path is not going to be um very apparent um it's a pretty easy thing once you um figure out but figuring out is definitely not easy so looking at this", "start": 1990.76, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
31
+ {"text": "looking around what I tried to do is create a new container and find a way to map things right because painer this allows us to like run Docker images um we're not a member of the docker group but the portainer whatever user running this is so um if it can like run a dock command with- v um slash and then Mount that to SLT then we can access the host's operating system but I couldn't find any way to do that in portainer I think that's just because Matthew is a regular user so you can't edit the docker files um individually and it doesn't give you a way to um map volumes or you can map a volume but you can't use the volume that's on the HST dis so the actual path here is exploiting Docker itself and if you ran a runc dash I think it's D- version you'll get the runc version here and this is the key piece in order to", "start": 2066.119, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
32
+ {"text": "find out exploitable if you Google run C like this let's see disable let's run this um runc this version we'll probably find many exploits um right here F descript or leak so this was a pretty big exploit around the time the box came out I believe so it's a bit easier to find I was trying to find other good ways to find this vulnerability right I found this package the vs GitHub this looked very promising but even though when I scanned it um it didn't find it didn't call out this run C vulnerability uh so if you're looking for vulnerability scanning software you may want to check this out but it doesn't help in this exact uh predicament right if you do a d package list let's see that's going to be part of the container package so if we looked at this container diio um D like this exploit let's see I think this actually will have", "start": 2129.76, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
33
+ {"text": "it this version of container D is what installs um run C so if something analyzed the D package found that then chances are um it would be able to discover the vulnerability I think the issue mainly with like all the open source software discovering these type of vulnerabilities you may think it's easy but keep in mind how many flavors of Linux there are and how many versions of Ubuntu and all the package names are specific to that flavor right so um I'm guessing maybe that's why it just didn't Discover It although that's not the case here um I may miss BS if we just do GitHub container IO let's see is that going to be where the releases packages sure um let's see releases I found it somewhere where I actually saw this version and they called it out but let's just move on um the exploit is super simple all we have to do is set the working directory to proc self FD", "start": 2209.48, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
34
+ {"text": "and then we'll be able to escape um we'll explain a little bit on why that's the case after we do it but I've rambled enough so let's just go ahead and um exploit it right see I guess I need to go back on the socks proxy and then we can go to Containers let's add a container uh let's see what container do we call this I'm just going to call it exploit and then we have to give it a image um if we looked at the images here I think there was a team City and a Ubuntu right so we can pick from one of these images so I'm just going to do Ubuntu latest uh we don't need to pull the image and then let's see the command the working directory we're going to do proc self fd8 interactive and TTY entry point um that should be fine the default should be bsh let's deploy this container and now the container is", "start": 2278.24, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
35
+ {"text": "running let's go to the console uh let's see where is console there it is connect let's try Ben sh uh root that did not actually work uh oh I'm not sure what happened here I'm probably going to end up retrying this container details there's the image let's try this again test Mo buntu and don't want to do search like that see that should be fine we can Auto remove it entry point I'm just going to do B sh working directory par self that should be fine user let's set the user as root okay deploy console there we go I'm not sure what was wrong the last time maybe I just had to specify the user as root but if we look at this um we can't get the Parent Directory and we do LS we're in this weird directory and then we can go up a few directories I know this is going to seem like magic real quick um we're now at", "start": 2348.319, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
36
+ {"text": "that root of the file system we can go CD root and then we can get root. text we could also drop a SSH key right so what exactly happened here if we look at this post this one explains it the best um when we set this proc self fd8 we're actually winning a race condition and getting the follow descriptor to I want to say it's cgroup right before it tries to um drop all the permissions in Pur in jail we get access to a directory or the file handle of the directory and just by having that means the host now can no longer close it and once you leak a file handle and get access to it then you can just go in the directory and behave as you were right um so I definitely recommend reading this to kind of showcase what it is um this is the best way I can think of real quick to show it off so I'm going to make a directory here we'll make ipac right and we'll go in IAC and we can touch", "start": 2484.599, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
37
+ {"text": "um super secret file here so we have this file and I'm going to move IPC to um new directory right however I'm still in IPC here if I touch new new file and we do LS on new directory it's still behaving just like that right because once we go into the directory the name is not really that important we have a handle to directory and by moving the directory to something else uh we just changed the name we didn't change the handle right we're still in IPC despite um it being here and that's kind of what we're doing with the cgroup thing right um we're setting our working directory to the file descriptor that is going to limit our permissions and because we get into that directory when it removes itself and starts limiting permissions we're still in there we have the handle so we know where the root directory is we set a", "start": 2548.079, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
38
+ {"text": "working directory there and now um when we open the container we're on the root file system so that's essentially what is happening here you can kind of see the same thing if we did a file so we can say Echo please subscribe to I'm just going to put on IPC so we can tail-f IPC and then if we Echo more to this file right we're going to see it and then if we move the file to be um let's see I'm going to call it new file because I'm not creative and I write to IPC we're not seeing anything anymore because despite this command saying we're tailing ipac uh we already opened that file and we got the handle so we're now going to um be on new file right that's exactly what is happening here if we want to do it without tail um I'm sure we can do it with python so if we like um let's see f is equal to open uh", "start": 2608.96, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}
39
+ {"text": "we called it new file with read permissions f. read we have that let's now um Echo more stuff to new file and we're going and call read we have more stuff we're going to move new file to be um we'll call it IPC again and then we're going to say Echo please subscribe to ipac then we read it um it's probably because I didn't do the two dashes that's probably what happened there shoot let's try that again going to open ipac f. read okay we're going to move IPC to be not IPC we call f. read again nothing there let's Echo this to not and we get the file um we don't do the append I don't know what it's doing maybe it's deleting and recreating the file which would then give it a new handle I'm not sure exactly what happened there the last time when I did it but um hopefully this all makes sense so with that being said take care all and I'll see you all next time", "start": 2681.68, "duration": 0.0, "meta": {"video_id": "5G0sCI3DUtE", "title": "HackTheBox - Runner", "url": "https://www.youtube.com/watch?v=5G0sCI3DUtE"}}