Hack the Box Starting Point: Three

- 5 mins read

Series: Starting Point

Hack the Box Starting Point: Three

Pasted image 20251203130546.png Hello everyone and welcome back to the HTB Starting Point series I’ve been working on for way too long now. Took a little break for the Thanksgiving weekend, I hope everyone enjoyed themselves. Now however it is time to get back to work and so today we will be working on the next machine here in Tier 1. While we were away it looks like the main HTB platform has undergone some UI changes and so we don’t really get a sneak peak as to what we’ll be doing anymore, which honestly is totally fine, let’s spin up our respective attack machines and get to work!

Task 1

Pasted image 20251203130927.png Well, we all know the drill here. Pasted image 20251203131059.png Very good, just a couple ports open here, we’ll probably check out that web server here in a second.

Task 2

Pasted image 20251203131307.png Again, very straight forward. If we navigate to the targets URL… Pasted image 20251203131356.png It looks like the webpage for a popular band. Sure thing, let’s go to the Contact section and find that email. Pasted image 20251203131442.png And there we have it, so far so good let’s submit the domain of that email as our answer.

Task 3

Pasted image 20251203131654.png Okay so the answer to this question is the /etc/hosts file on our Linux boxes. I believe we messed with this just last box, but as a refresher. When our computers attempt to resolve IPs to URLs they will first reference their own configured hosts file. On Windows this file is found at C:\Windows\System32\drivers\etc\hosts and we can hardcode IPs to whatever domains. Because our computers reference these local files first before making any kind of DNS queries we could theoretically set it to whatever. Let’s add our newly discovered domain to our /etc/hosts file so that it should look like this. Pasted image 20251203134802.png So now if we navigate to that URL… Pasted image 20251203134852.png Very good.

Task 4

Pasted image 20251203132149.png Alright, let’s do ahead and do some sub-domain enumeration using gobuster… Okay, truthfully this step wasn’t quite as simple as I suspected. If you go ahead and try to use gobusters fuzz command or use ffuf you’re not gonna find anything which I thought was odd. Turns out this domain is using Virtual Hosting, which just means the web server is hosting multiple subdomains. In order to do this we are actually going to use the vhost command in gobuster. Pasted image 20251203150402.png Ah so that’s why this box is called Three. Looks like we have an AWS S3 bucket here. We’ll check that out here in just a second, let’s submit our answer first.

Task 5

Pasted image 20251203150831.png Okay, I actually haven’t messed with AWS stuff at all actually so I’m going to be doing a lot of learning as I go this time. If we visit the s3 subdomain in our browser, we’ll see: Pasted image 20251203151622.png Very cool. Well if we google for a “status running s3 subdomain”… Pasted image 20251203151806.png We see the Amazon S3 Storage Service, which yeah that’s pretty obvious now when you just think about it. In fact so much so that in that other writeup there that’s probably a little better than this one our friend Ch0rum even make a comment. Okay, anyways Amazon S3, right, moving on.

Task 6

Pasted image 20251203152014.png If we just google this question we’ll get our answer. Pasted image 20251203152438.png While all of these are true, the one we’re looking for is awscli. Using this command allows us to interact with the S3 bucket and get up to some shenanigans. If you just type aws into your shell with no arguments gives us some information. Pasted image 20251203152702.png Very nice.

Task 7

Pasted image 20251203152837.png Now what we’re looking for here is aws configure, this command sets a bunch of parameters we’re going to need in order to actually use awscli. Pasted image 20251203153021.png You see here it asks for a bunch of values, luckily they don’t need to be legit, but they need to be something so this should suffice… Pasted image 20251203153105.png There, now we’re configured and should be ready to interact with the S3 bucket.

Task 8

Pasted image 20251203153156.png So the command we need to use to view the contents of the bucket is going to be aws --endpoint=http://s3.thetoppers.htb s3 ls s3://thetoppers.htb. Pasted image 20251203153423.png We see here an image directory as well as a php file. Well knowing that this is a php web server maybe we can do a php rev shell? Oh also, technically the answer to the question is going to be aws s3 ls as that’s technically the command we ran, we just added a bunch of parameters to it.

Task 9

Pasted image 20251203153629.png … Like I said, php.

Root Flag

Okay let’s go ahead and try our rev shell theory by using awscli to upload a php file to the web server. Pasted image 20251203153933.png Okay, let’s send this bad boy over to the S3 bucket. Pasted image 20251203154042.png Okay, let’s give this a shot. If we navigate to where our php script should be in our browser and give it an argument… Pasted image 20251203154212.png You see me here referencing the script in the URL and giving cmd a value of id, which runs the id command and voila, there we have it. Okay now for the moment of truth, let’s make ourselves a little Bash reverse shell and have our target server curl it on over. Pasted image 20251203154749.png Paste this into a .sh file and name it something using your desired text editor. Obviously change your IP and desired port number you want netcat to listen on. Okay after that’s done we’re going to… Pasted image 20251203154900.png Run a Python HTTP server on our attacking machine and also Pasted image 20251203154935.png Set up our netcat listener. Okay everything should be in place, let’s go back to our compromised URL and… Pasted image 20251203155211.png Note: For spaces in your URL payload you’re going to want to use %20 instead of a space as the browser won’t like that and %20 is URL encoding for a space so just do that instead and the browser will interpret that correctly. Anywayssssss….. Pasted image 20251203155351.png Pasted image 20251203155435.png Pasted image 20251203155504.png

Conclusion

Not gonna lie, this one was tougher than I thought it was going to be. I haven’t messed with AWS too much and so I was referencing the official writeup quite a bit. Also that vhosts thing had be stuck for a while I wasn’t sure why ffuf and gobuster weren’t getting any hits even though we added the target domain to our hosts file. Just show how much further we’ve got to go here, thank you all so much for joining me. Again, hope you all had a good Thanksgiving and onto the next one!