Page cover

EscapeTwo

Synopsis

EscapeTwo is a easy windows machine created by ruycr4ft arrow-up-right and Llo0zyarrow-up-right. The user rose is authenticated in SMB and we found Accounting Department Share which contains the files. The file contains the password for sql_svc user. By using the sql_svc credentials and leveraging xp_cmdshell we get the shell. The sql configuration file contains the password for user ryan. The shell is accessed using evil-winrm. The bloodhound shows us that the ryan has some privileges over ca_svc. The privileges is used to modify ownership of ca_svc. Gaining the full-control over ca_svc, the vulnerable certificate DunderMifflinAuthentication is found, which is vulnerable to ESC4 attack and which is exploited to privilege escalated into Administrator.

OS
Difficulty
Points
Release Date
Retired Date

Windows

Easy

20

11-01-2025

24-05-2025

The credentials is given for the following account rose / KxEPkKe6R8su.


OSINT

Previous Machines

The retired Escape Machine is a medium difficulty Windows machine. The machine allows the guest user in SMB and gets the credientials for MSSQL. The database stores the crackable hash of user ryan.cooper and we can get shell via winrm using the credentials. The enumeration of user ryan reveals that the vulnerable certificate template is exploitable to ESC1 attack and gain the administrator certificate and uses it to get the administrator hash.


Enumeration

Nmap

Started the nmap scan and found the Active Directory running.

nmap -Pn -sC -sV --min-rate=500 10.10.11.51
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-11 20:26 EST
Nmap scan report for 10.10.11.51
Host is up (1.8s latency).
Not shown: 988 filtered tcp ports (no-response)
PORT     STATE SERVICE       VERSION
53/tcp   open  domain        Simple DNS Plus
88/tcp   open  kerberos-sec  Microsoft Windows Kerberos (server time: 2025-01-12 01:27:08Z)
135/tcp  open  msrpc         Microsoft Windows RPC
139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn
389/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: sequel.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=DC01.sequel.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<unsupported>, DNS:DC01.sequel.htb
| Not valid before: 2024-06-08T17:35:00
|_Not valid after:  2025-06-08T17:35:00
|_ssl-date: 2025-01-12T01:28:52+00:00; 0s from scanner time.
445/tcp  open  microsoft-ds?
464/tcp  open  kpasswd5?
593/tcp  open  ncacn_http    Microsoft Windows RPC over HTTP 1.0
636/tcp  open  ssl/ldap      Microsoft Windows Active Directory LDAP (Domain: sequel.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=DC01.sequel.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<unsupported>, DNS:DC01.sequel.htb
| Not valid before: 2024-06-08T17:35:00
|_Not valid after:  2025-06-08T17:35:00
|_ssl-date: 2025-01-12T01:28:50+00:00; 0s from scanner time.
1433/tcp open  ms-sql-s      Microsoft SQL Server 2019 15.00.2000.00; RTM
|_ssl-date: 2025-01-12T01:28:51+00:00; 0s from scanner time.
| ms-sql-info: 
|   10.10.11.51:1433: 
|     Version: 
|       name: Microsoft SQL Server 2019 RTM
|       number: 15.00.2000.00
|       Product: Microsoft SQL Server 2019
|       Service pack level: RTM
|       Post-SP patches applied: false
|_    TCP port: 1433
| ms-sql-ntlm-info: 
|   10.10.11.51:1433: 
|     Target_Name: SEQUEL
|     NetBIOS_Domain_Name: SEQUEL
|     NetBIOS_Computer_Name: DC01
|     DNS_Domain_Name: sequel.htb
|     DNS_Computer_Name: DC01.sequel.htb
|     DNS_Tree_Name: sequel.htb
|_    Product_Version: 10.0.17763
| ssl-cert: Subject: commonName=SSL_Self_Signed_Fallback
| Not valid before: 2025-01-11T19:02:17
|_Not valid after:  2055-01-11T19:02:17
3268/tcp open  ldap          Microsoft Windows Active Directory LDAP (Domain: sequel.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=DC01.sequel.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<unsupported>, DNS:DC01.sequel.htb
| Not valid before: 2024-06-08T17:35:00
|_Not valid after:  2025-06-08T17:35:00
|_ssl-date: 2025-01-12T01:28:51+00:00; 0s from scanner time.
3269/tcp open  ssl/ldap      Microsoft Windows Active Directory LDAP (Domain: sequel.htb0., Site: Default-First-Site-Name)
|_ssl-date: 2025-01-12T01:28:50+00:00; -1s from scanner time.
| ssl-cert: Subject: commonName=DC01.sequel.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<unsupported>, DNS:DC01.sequel.htb
| Not valid before: 2024-06-08T17:35:00
|_Not valid after:  2025-06-08T17:35:00
Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
| smb2-time: 
|   date: 2025-01-12T01:28:15
|_  start_date: N/A
|_clock-skew: mean: -1s, deviation: 0s, median: 0s
| smb2-security-mode: 
|   3:1:1: 
|_    Message signing enabled and required

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 140.05 seconds

Add sequel..htb and DC01.sequel.htb in /etc/hosts file.

SMB - rose

The given credentials can be used to authenticate into SMB.

Enumerating the shares and downloading all the files from the share.

The Accounting Department share has accounting_2024.xlsx and accounts.xlsx files.

Files - Account Department Share [ rose ]

Checking both the files in linux system reveals that they are compressed files.

Extract the accounts.xlsx file and enumerate the files.

The shareStrings.xml file contains the password for some users.

circle-info

I have prettified the xml for more readability. You will get two lines of xml only.

MSSQL - sa

The above sa user password can be used to authenticate into mssql.

The database doesn't contains any credentials so we are going to use the xd_cmdshell of SQL for getting shell as sql_svc user.


Foothold

Shell - sql_svc [ xd_cmdshell ]

1

Create the exe file using msfvenom.

2

Open the python http server.

3

Run metasploit.

4

Upload the exe file using xp_cmdshell via nxc.

5

Execute the exe.

6

We got the shell in metasploit.


Privilege Escalation

Shell - ryan

The pillaging of C:/Users directory reveals that the user ryan is present.

The C:/ directory has a SQL2019 directory and pillaging the directory we got the config file of MSSQL which contains the ryan password.

circle-info

The user.txt file contains the user flag which is located in the Desktop directory 👏

Pillaging - ryan

Running the whoami /all command reveals that the user is the group member of Certificate Service DCOM Access.

Bloodhound - ryan -> ca_svc [ path ]

The nxc can also be used as bloodhound ingester. Start the neo4j database, run the nxc and upload the zipped file in bloodhound.

The ryan user has some of the privileges in ca_svc account which can be used for further escalation.

The WriteOwner privilage can be used to modify the ownership of ca_svc account to ryan for privilege escalation.

The ca_svc is a member of cert publishers which allows the user to manage certificate templates and publish certificates.

WriteOwner Abuse - changing ca_svc owner to ryan

1

Set the ownership of ca_svc to ryan by abusing WriteOwner privilage.

2

Granting ryan the full control over ca_svc account.

Shadow Credentials Attack - Getting NT hash [ ca_svc ]

Now we can add new certificate for shadow credentials attack and retrieve NT hash of that object. More details about it, is given in the link below.

1

Add the new certificate.

2

Getting authentication into DC using a newly created certificate.

3

Getting NT hash

Note: If Clock skew too great error occur use ntpdate to synchronize date and time with the machine.

Pillaging - Certificate Templates

The certify is used for enumerating and finding vulnerable certificate templates.

1

Export the ticket as environment variable.

2

Finding vulnerable certificate templates.

3

The json report reveals the vulnerable DunderMifflinAuthentication template and ESC4 attack path.

According to the json report the Cert Publishers has a Full Control, Write Owner, Write Dacl, Write Property principals and these permissions is vulnerable to ESC4 attack.

Shell - Administrator [ ESC4 Attack ]

ESC4 is an attack vector that exploits weak access control lists (ACLs) on Active Directory Certificate Services (AD CS) certificate templates. This attack allows a user to modify the configuration of a certificate template, potentially leading to privilege escalation within a domain. You can find more depth details about the ESC4 attack in below hacktricks article.

1

Select the vulnerable template [ DunderMifflinAuthentication ] by overwriting the configuration using certipy to make it vulnerable.

2

Request a certificate for administrator.

3

Request Administrator TGT.

Login via winrm using the above hash through evil-winrm.

circle-info

The root.txt file contains the user flag which is located in the Desktop directory 🎉

Proof of Concepts

The below video provides the PoC of EscapeTwo machine.

Last updated