Post-Exploitation: Token Impersonation Lab Report

Author: Basit Hassan 

Date: 2025-10-13

Environment: The same AD environment i have been simulating from the begining of this journey.

Scope:Scope: Demonstration in a lab environment of token impersonation using Meterpreter incognito.


Overview

I used the credential of a user I obtained in an earlier post and launched Metasploit’s psexec module against a target in my simulated AD lab. From the psexec exploit I obtained a Meterpreter session on the host. Inside Meterpreter I loaded the incognito extension and ran list_tokens -u to enumerate available user tokens. I identified a privileged token corresponding to an Administrator account and used impersonate_token to assume that context. I then spawned a shell under the impersonated token and verified privileges with whoami, which confirmed LABDOMAIN\\Administrator (sanitized).

Walkthrough

  1. Launched msfconsole on the attacker VM.

  2. Used psexec (via Metasploit) with valid credentials to get a Meterpreter session on the target VM.

  3. In the Meterpreter session: load incognito and list_tokens to enumerate tokens.

  4. Found an Administrator token and used impersonate_token  to assume the admin context.

  5. Spawned a shell under the impersonated token and verified privileges with whoami.





i was able to get administration shell the highest priviledge i will ever get this is the domain contoller admin

Important: This impersonation succeeded because the Administrator account already had an active session token on the target (the admin had previously logged in). If the machine had been restarted — clearing session tokens — the impersonation would not have worked until an Administrator session existed again.

Mitigation & Hardening Recommendations

  1. Least privilege: Remove unnecessary privileges like SeImpersonatePrivilege from non-privileged service accounts.

  2. LSA Protection & Credential Guard: Enable LSA protection and Microsoft Defender Credential Guard where possible.

  3. Rotate local admin credentials: Use LAPS (Local Administrator Password Solution) to manage/rotate local admin passwords.

  4. EDR & Monitoring: Deploy EDR that detects LSASS memory reads, token duplication, and common post-exploitation tools (Meterpreter, Mimikatz).

  5. Network segmentation & MFA: Limit lateral movement opportunities and require multi-factor authentication for privileged accounts.

  6. Harden service accounts: Ensure service accounts do not hold interactive or excessive privileges and rotate their credentials regularly.

Comments

Popular posts from this blog

Using Hydra to Brute-Force SSH And WI-Fi Login Portal

Discover AWS Organization ID Via S3 Bucket

SMB Relay Attack in AD Lab (Step-by-Step)