0x0D-HackTheBox-Cascade

Command History Reference

masscan - effective
nmap - windows machine, smb2 message signing on and required, rpc service on - effective
rpcclient - logged in as anonymous user - effective
rpcclient - enumdomusers - get all users on the domain - effective - valuable
rpcclient - enumgroups - get all groups on the domain - effective - not valuable
rpcclient - queryuser - get user info - effective - valuable
smbclient - not effective
tftp - can connect - effective - not valuable
enum4linux - ineffective
nmap - scan for udp ports, found open ports 123 on ntp - effective
ldapsearch - found legacypwd - effective - valuable
base64 -d - decrypt legacypwd - effective - valuable
smbclient - connect to some directories, found sensitive information - effective - valuable
evil-winrm - cannot connect with `r.thompson` and his password - ineffective
irb - decode the VNC registry hex password - effective - valuable
evil-winrm - with s.smith and his cracked password - got user flag - effective
winpeas - found some unattend file - effective - not valuable
enum4linux - with s.smith and his password - got new information - effective - valuable
smbclient - connect to Audit$ folder, got a Audit.db file, which contains new credential - effective -valuable
evil-winrm - with arksvc and his password - effective
crackmapexec - no writable permission

Set up

Target Cascade at 10.10.10.182.

Recon

Masscan

在這裏插入圖片描述

Important ports 53, 139, 445, 88, 5985. It’s Active Directory related.

Nmap

在這裏插入圖片描述

Target services, kerberos, smb, RPC, winrm, and DNS seems to be missed by nmap.

在這裏插入圖片描述
Message signing enabled and required, means no NTLM hash relay attack.

Rpcclient

在這裏插入圖片描述
Logged in as anonymous user.

Try these commands to gather information as much as possible.

在這裏插入圖片描述
在這裏插入圖片描述
Most of these commands are access dined. But the following commands returns with valuable data.

在這裏插入圖片描述
Users on the host.

在這裏插入圖片描述
Groups on the host.

在這裏插入圖片描述
Domain info.

Write a script to query all the user info.

在這裏插入圖片描述

cat raw.txt | while read line; do echo $line | cut -d' ' -f2 | cut -d':' -f2 | cut -d'[' -f2 | cut -d']' -f1;done > user.txt

在這裏插入圖片描述

cat user.txt | while read line; do rpcclient -U "" --no-pass -c="queryuser $line" 10.10.10.182;sleep 1;done > userinfo.txt

在這裏插入圖片描述

Only pulled down 9 users’ info.

Rerun it.

在這裏插入圖片描述
Make sure I’ve pulled down all the userinfo.

Then I greped all sorts of things to see if there’s anything interesting, especially in users Description, but no, nothing found here.
在這裏插入圖片描述
One last thing here, I also cut all the user name out for later reference.

在這裏插入圖片描述

Smbclient

在這裏插入圖片描述
Nothing here.

enum4linux

Nothing useful.

Nmap

Nmap again for UDP ports.

在這裏插入圖片描述
Found this interesting port 123. Seach port 123, it’s a network time protocol used for time sync.

References:

在這裏插入圖片描述
Search ntp exploits

在這裏插入圖片描述
I’ve got a remote exploit, excellent!

References:

But, it’s for RedHat Linux. Not working.

Read More

Just be patient.I’ll read more about those enumeration tools. Maybe I missed something.

References:

After reading OSCP Common Ports, I finally found the solution.

ldapsearch

Let’s think about the services opening on the target machine and the techniques that I’ve tried already.

Samba on 139,445
  • smbclient - cannot enumerate shares because of auth restriction - ineffective
  • crackmapexec - cannot enumerate shares because I don’t have password - ineffective
  • enum4linux - listed users, but nothing about password - effective
Rpc
  • rpcclient - list users, but no password info - I’ve tried each and every one of the commands in rpcclient - ineffective
DNS on 53
  • I’ve read a lot about DNS but enumerating DNS is considered post exiltration, not when I haven’t got a single pair of credentials.
Kerberos on 88
  • nmap - with krb5 script, only list users, no passwords - ineffective

And the only thing that’s been missing out is ldap on 389,636,3682.

The answer is:

ldapsearch -h <dc-ip> -p 389 -x -b "dc=cascade,dc=local"

There are tons of information dumped. I went through them very carefully, and I found something like this.

在這裏插入圖片描述

LagecyPwd, and the = sign at the end means it’s highly likely base64 encoded. Let’s decrypt it.

在這裏插入圖片描述
At first, I was not sure if this is the real password of user r.thompson.

Let’s try smblclient now with user r.thompson:rY4n5eva.

在這裏插入圖片描述
That’s a confirm what I got here is the users password.

Now, let’s connect to some of the folders to check for informations.

在這裏插入圖片描述
The first folder that I have access to is the Data foleder, and I only have access to IT subfolder cause our poor little r.thompson here is of IT group.

Download all files.

在這裏插入圖片描述
I’m falling love with this box. This is the most real box that I have ever touched. Check this out. In the Email Archive folder I found an email.

在這裏插入圖片描述
在這裏插入圖片描述
Though the password wasn’t written out, but it is so real that enterprise information is leaked all the way out.

And in s.smith folder, a VNC Install.log file is found, which contains the hex password of the user. And there’s tools that can decode the hex value, so, another user password leaked.

在這裏插入圖片描述

And in NETLOGON folder, I found two vbs files. That’s in a lot of users execution path.

在這裏插入圖片描述

在這裏插入圖片描述
But, nothing’s going on here.

And there’s the print$ folder, where the hacker can find all sorts of printer information to leverage printer attack.

在這裏插入圖片描述
Last, is the SYSVOL folder. Remember to dump all things from it, it may contain username or password in Groups.xml through GPP executions.

在這裏插入圖片描述
Samba is complete, move on.

evil-winrm

在這裏插入圖片描述
what???

I remembered that our s.smith and arksvc are of group Remote Management, maybe this is why I cannot connect to winrm with r.thompson.

Seems I have to decode that hex password in last section.

在這裏插入圖片描述

So I simply worte a python script to decrypt hex to string.

在這裏插入圖片描述
But, when I saw the output, I think it cannot be right.

Maybe there’s something tricky with windows registry hex.

Need to dig deeper.

References:

Seems not possible. Quote from the article above:

Looks like it might be a DPAPI blob, which means without the master key, user’s password and possible entropy, you can’t decrypt it without being logged in as that user.

References:

I must be missing out something with r.thompson.

Keep digging.

I read a lot of things, and my angle is wrong.

I searched a lot of decrypt windows registry hex, but with nothing useful.

Insead, I searched the filename VNC Install.reg password, and the result is what I want.

Searching is kung-fu.

在這裏插入圖片描述
References:

在這裏插入圖片描述
I used the method from the third article above.

The encryption key is fixed, and I got the password, which means, I have user flag of the machine now.

Foothold

在這裏插入圖片描述
Now, it’s root time!

Final Thoughts

First, enumeration is the key! This is even true in a real world situation. If you get stuck, enumerate more.

Second, search more and search for different word combinations for the same thing. Like I did in the VNC password carcking, you can search for windows registry hex decryption, if that’s no good, search for VNC registry hex password or VNC install.reg, the file name.

Don’t give up. You’ll get what you want.

I haven’t rooted the machine yet. Still working on it! I’ll post here as soon as I get root access to the machine.

And, another thing, when I rooted the machine, I’ll write something ablout LDAP, because this is something that cracks the door open and let me get hold of the user flag. Need to understand it deeper.


Privilege Escalation to Root

Manual Enumeration

evil-winrm is very laggy on my machine, I don’t know why, so the first thing I do is to upload a nc.exe and connect back to my machine. The shell runs much smoother than evil-winrm.

在這裏插入圖片描述
在這裏插入圖片描述
I’m going to use some powershell tools or winpeas here. I just don’t know where to begin.

Before I begin, run some commands to see my groups and privileges.

在這裏插入圖片描述
在這裏插入圖片描述
Not much going on here.

I run winPEAs.exe, and it gives me this info.

在這裏插入圖片描述
But sensitive data deleted. The box maker is trolling us.

I check cbs_unattend.log, nothing’s there too.

I also tried bloodhound, nothing valuable there.

PowerView.ps1

在這裏插入圖片描述
Importing PowerView.ps1 gives me these whole lot of crap. It’s not working. 😦

Go Back to Check the Command List

Now, I’ve got a valid user credential, what have I missed from earlier attempts?

I decided to try enum4linux once more. And I got this piece of new information, which I hadn’t got when I use empty username and password.

在這裏插入圖片描述
I haven’t tried to connect to this Audit$ folder earlier, which I have access to.

Connecting.

Juicy, it contains this DB folder.

在這裏插入圖片描述
Check inside.

在這裏插入圖片描述
Download this Audit.db and take peek inside.

I cat the file, prints out ugly things. And I file it, it’s a sqlite3 database file.

References:

在這裏插入圖片描述
Hooray! Look what I’ve got here.

User Arksvc pwned.

Crack the LDAP Encoded Thing

It seems it’s a password. But when I try to base64 decode it, it prints garbage.
在這裏插入圖片描述

Then, I just copied the *******== thing and throw it into google, I got these two websites that’s already done the job for me.
在這裏插入圖片描述
I don’t even have to run the program.
在這裏插入圖片描述
Maybe the box maker leave the code here. He encrypted the password with key c4scadek3y654321.

Right, let’s try connect with this new credential

evil-winrm

在這裏插入圖片描述
I’m now arksvc.

Run some basic command.
在這裏插入圖片描述
arksvc’s privilege.
在這裏插入圖片描述

It shows that our arksvc is of the built-in users group.

在這裏插入圖片描述
crackmapexec shows no write permission on any of the share folders.

Some Assessment

I don’t know where to go. Come to an assessment of the current situation:

  • I’ve migrated to another user - arksvc
  • He has the same privilege as s.smith - so he cannot do much than s.smith
  • He is in more groups than s.smith - like the built-in group and others, might be a start point
  • No samba write permission - means no fancy exec meterpreter thing
  • The user arksvc is found in a Audit.db file - maybe he’s got something to do with auditing

I went back to the Audti$ share folder using s.smith's credential, and there’s a cascAudit.exe.

在這裏插入圖片描述
Download it and upload it and run it.

Too late… Carry on when wake up…

To be continued…

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章