CompTIA Pentest Plus Study Notes
CompTIA Pentest Plus Study Notes
CompTIA Pentest+
Study Notes
*Pentest+ is a registered trademark of CompTIA. You can learn more about their active
trademarks on the USPTO website.
2
Table of Contents
Lesson 1 ....................................................................................................................................... 6
Scoping Organizational/Customer Requirements ......................................................................... 6
Define Organizational PenTesting ............................................................................................. 6
Acknowledge Compliance Requirements .................................................................................. 8
Compare Standards and Methodologies ................................................................................. 10
Describe Ways to Maintain Professionalism ........................................................................... 11
Lesson 2 ..................................................................................................................................... 12
Defining the Rules of Engagement ............................................................................................. 12
Assess Environmental Considerations .................................................................................... 12
Outline the Rules of Engagement ........................................................................................... 13
Prepare Legal Documents ....................................................................................................... 14
Lesson 3 ..................................................................................................................................... 15
Footprinting and Gathering Intelligence ...................................................................................... 15
Discover the Target ................................................................................................................. 15
Gather Essential Data ............................................................................................................. 16
Compile Website Information .................................................................................................. 17
Discover Open-Source Intelligence Tools ............................................................................... 18
Lesson 4 ..................................................................................................................................... 20
Evaluating Human and Physical Vulnerabilities .......................................................................... 20
Exploit the Human Psyche ...................................................................................................... 20
Summarize Physical Attacks ................................................................................................... 21
Use Tools to Launch a Social Engineering Attack .................................................................. 22
Lesson 5 ..................................................................................................................................... 24
Preparing the Vulnerability Scan ................................................................................................. 24
Plan the Vulnerability Scan ..................................................................................................... 24
Detect Defenses ...................................................................................................................... 25
Utilize Scanning Tools ............................................................................................................. 26
Lesson 6 ..................................................................................................................................... 27
Scanning Logical Vulnerabilities ................................................................................................. 27
Scan Identified Targets ........................................................................................................... 27
Evaluate Network Traffic ......................................................................................................... 28
Uncover Wireless Assets ........................................................................................................ 29
3
Lesson 7 ..................................................................................................................................... 30
Analyzing Scanning Results ....................................................................................................... 30
Discover Nmap and NSE ........................................................................................................ 30
Enumerate Network Hosts ...................................................................................................... 32
Analyze Output from Scans ..................................................................................................... 33
Lesson 8 ..................................................................................................................................... 35
Avoiding Detection and Covering Tracks .................................................................................... 35
Evade Detection ...................................................................................................................... 35
Use Steganography to Hide and Conceal ............................................................................... 38
Establish a Covert Channel ..................................................................................................... 39
Lesson 9 ..................................................................................................................................... 42
Exploiting the LAN and Cloud ..................................................................................................... 42
Enumerating Hosts .................................................................................................................. 42
Attack LAN Protocols .............................................................................................................. 43
Compare Exploit Tools ............................................................................................................ 45
Discover Cloud Vulnerabilities ................................................................................................. 46
Explore Cloud-Based Attacks .................................................................................................. 47
Lesson 10 ................................................................................................................................... 49
Testing Wireless Networks ......................................................................................................... 49
Discover Wireless Attacks ....................................................................................................... 49
Explore Wireless Tools ............................................................................................................ 50
Lesson 11 ................................................................................................................................... 52
Targeting Mobile Devices ........................................................................................................... 52
Recognize Mobile Device Vulnerabilities ................................................................................ 52
Launch Attacks on Mobile Devices ......................................................................................... 53
Outline Assessment Tools for Mobile Devices ........................................................................ 54
Lesson 12 ................................................................................................................................... 56
Attacking Specialized Systems ................................................................................................... 56
Identify Attacks on the IoT ....................................................................................................... 56
Recognize Other Vulnerable Systems .................................................................................... 57
Explain Virtual Machine Vulnerabilities ................................................................................... 59
Lesson 13 ................................................................................................................................... 61
Web Application-Based Attacks .................................................................................................. 61
4
Lesson 1
Context:
PenTesting Process:
1. Planning and Scoping: Define the rules of engagement, budget, technical constraints,
types of assessments, and selection of targets.
2. Reconnaissance: Gather as much information about the target as possible using
OSINT, social networking sites, and company websites.
3. Scanning: Identify live hosts, listening ports, and running services. Use enumeration for
detailed information.
4. Gaining Access: Attempt to gain access to the system and see how deep into the
network penetration can go.
5. Maintaining Access: Stay undetected within the system for as long as possible.
6. Covering Tracks: Remove evidence of penetration activities, including executable files,
rootkits, logs, and user accounts used.
7. Analysis: Review and analyze the results of the PenTest, summarizing the risk rating.
8. Reporting: Deliver results and remediation suggestions to stakeholders, providing a
realistic timeline for reducing risk and implementing corrective actions.
7
Risk Management:
Structured Approach:
Study Notes
These notes should help you understand the critical aspects of organizational PenTesting and
prepare for related exams and practical applications.
Compliance Standards:
Types of Assessments:
PenTesting Strategies:
Study Notes
● PenTesting: Evaluates security posture to ensure compliance and protect against data
breaches.
● Regulatory Standards:
○ PCI DSS: Secure handling of credit card data.
■ Requirements:
■ Secure infrastructure.
■ Change default passwords.
■ Continuous monitoring and anti-malware updates.
■ Strong access control and least privilege principle.
■ Compliance Levels:
■ Level 1: Over 6 million transactions/year, external audit by QSA.
■ Level 2: 1-6 million transactions/year, RoC required.
■ Level 3: 20,000-1 million transactions/year.
■ Level 4: Under 20,000 transactions/year.
■ Documentation: PCI Security Standards
(https://www.pcisecuritystandards.org/).
● GDPR: Protects EU and British consumer data.
○ Requirements:
■ Obtain and manage consent for data collection.
■ Right to be forgotten.
■ Minimal data collection.
■ Breach reporting within 72 hours.
○ Documentation: GDPR (https://gdpr.eu/).
● Other Privacy Laws:
○ SHIELD Act (New York): Enhances cybersecurity defenses.
○ CCPA (California): Guidelines for consumer data handling.
○ HIPAA: Protects electronic patient health information (e-PHI).
● Types of Assessments:
○ Goal-Based: Specific security goals.
○ Compliance-Based: Regulatory adherence.
○ Objective-Based: Target vulnerabilities.
● PenTesting Strategies:
○ Ensure compliance.
○ Identify and mitigate vulnerabilities.
○ Beneficial for both large and small organizations.
10
PenTesting frameworks and methodologies provide structured guidelines for effective security
testing. Key organizations like NIST, OWASP, and methodologies like OSSTMM and PTES help
security professionals identify vulnerabilities, ensure compliance, and protect data.
Understanding Common Vulnerabilities and Exposures (CVE) and Common Weakness
Enumeration (CWE) is crucial for identifying and addressing security weaknesses.
Vulnerability Databases:
1. Background Checks:
○ Verify credentials and skills through certifications.
○ Provide recent background checks, including credit scores and driving records.
○ Ensure no criminal records or felony convictions among team members.
2. Identifying and Reporting Criminal Activity:
○ Report any accidental or inadvertent breaches immediately.
○ Maintain awareness of legal implications and report criminal behavior.
3. Maintaining Confidentiality:
○ Handle sensitive information with care.
○ Adhere to policies on proprietary information.
○ Use encryption and password protection for PenTest reports.
○ Provide legal documentation for confidentiality when necessary.
4. Avoiding Prosecution:
○ Clearly outline the terms of the PenTesting contract.
○ Understand and comply with legal considerations.
○ Conduct tabletop exercises to anticipate and mitigate potential conflicts.
○ Ensure mutual consent and clarity in scope and methods used for testing.
5. Facing Fees, Fines, and Criminal Charges:
○ Discuss and define the scope and methods with stakeholders.
○ Notify authorities or security personnel about PenTesting activities.
○ Avoid actions that may inadvertently violate laws.
○ Research and understand legal ramifications independently.
12
Lesson 2
Before starting a PenTest, it is crucial to define the project scope, assess various network types,
and identify in-scope assets. Teams must consider environmental factors, legal restrictions, and
hosting methods to conduct thorough and compliant PenTesting.
1. Kick-off Meeting:
○ Essential for learning how to conduct the PenTest safely.
○ Define the rules of engagement, client expectations, and type of testing.
○ Validate the scope of the engagement.
2. Providing the Details:
○ Stakeholders must spell out all requirements and agree on terms.
○ Keep communication open; clarify any issues.
○ Ask open-ended questions to remove ambiguity.
○ Assess past breaches or potential advanced persistent threats (APT).
○ Agree on timeline and restrictions.
3. Adhering to a Timeline:
○ Timeline outlines events and time needed to complete testing.
○ Discuss with stakeholders to understand the testing procedure.
○ Include any time-of-day restrictions in the contract.
○ Maintain professionalism and focus to build a long-lasting relationship with the
client.
4. Understanding the Restrictions:
○ Identify allowable tests and acceptable actions.
○ Adhere to the scope defined in legal documents.
○ Recognize technical or location constraints.
○ Limit invasiveness based on scope.
○ Use approved tools and address any additional variables that will impact testing.
5. Choosing the Type and Strategy:
○ Gather information from stakeholders about their needs and objectives.
○ Determine the type of assessment: compliance-based, red team/blue team,
goals-based.
○ Select a strategy based on how much information is provided prior to testing:
unknown, partially known, or known environment.
6. Validating the Scope of the Engagement:
○ Review and confirm all requirements, scope, and details of the engagement.
○ Reconfirm system backups and recovery procedures.
○ Clarify any vague areas with the client.
○ Confirm scope, strategy, timeline, restrictions, third-party providers, and
communication.
○ Ensure the PenTest is valid only at the point in time it is conducted.
14
1. Legal Documentation:
○ Essential legal documents include Nondisclosure Agreement (NDA), Statement
of Work (SOW), and Master Service Agreement (MSA).
○ These documents define the scope, customer obligations, termination rights, and
other relevant details.
2. Ensuring Confidentiality:
○ Protecting data confidentiality is crucial, especially when specific laws like GLBA,
DPPA, and HIPAA apply.
○ Confidentiality measures include data encryption and proper disposal post-
testing.
○ Team members often sign an NDA to prevent sharing confidential information.
3. Permission to Attack:
○ Formal permission to conduct PenTesting is necessary to avoid liability.
○ The client must be aware of potential risks, such as system disruptions.
○ Legal documents must detail authorized individuals, networks, validity period,
data handling, and reporting guidelines.
4. Master Service Agreement (MSA):
○ MSA establishes guidelines for all transactions and recurring costs.
○ It includes project scope, compensation details, permits, safety guidelines, and
insurances.
○ The MSA must be modifiable to accommodate future changes.
5. Statement of Work (SOW):
○ SOW defines deliverables, responsibilities, payment milestones, and schedules.
○ It outlines the specific business arrangement and has a direct impact on team
activities.
6. Service-Level Agreement (SLA):
○ SLA details the terms of service provision, including performance metrics,
remedies, and penalties.
○ It covers security access controls, risk assessments, and third-party
authorizations.
○ SLA ensures compliance with performance standards and includes disclaimers.
7. Legal Review and Authorization:
○ Final documentation should be legally reviewed and signed by authorized
personnel.
○ Proper legal authorization is crucial to control liability during the PenTesting
engagement.
15
Lesson 3
● Google hacking involves using advanced search operators to find specific information on
the Internet.
● Common operators include:
○ site: searches within a specific site.
○ link: searches for pages linking to a specific page.
○ filetype: searches for specific file types.
○ inurl: searches for specific text in URLs.
○ inanchor: searches for specific anchor text.
● Combining operators can refine searches to find more relevant information.
● Archived websites can be accessed through web cache viewers or the Wayback
Machine.
● These tools allow viewing of older versions of websites to retrieve information no longer
available on current versions.
● Useful for finding old press releases, directories, and potentially sensitive information.
● Reverse image search engines like TinEye, Google, Yandex, and Bing can help find
similar images across the web.
● Useful for gathering actionable intelligence or assessing the status and reputation of a
target.
● Google Alerts can be set up to monitor and receive updates on specific image-related
queries.
17
Revoking Certificates:
● Methods:
○ Certification Revocation List (CRL): Lists invalid certificates.
○ Online Certificate Status Protocol (OCSP): Real-time validation of certificate
status.
Certificate Stapling:
Security Assessment:
● Task: Ensure SSL/TLS certificates are properly signed and secure to prevent attacks.
● Focus: Verify certificates during PenTest to identify potential vulnerabilities.
● Sources of OSINT:
○ Whois databases for registration information.
○ Public websites, social media profiles, job postings, blogs, news articles.
○ DNS server records, SSL/TLS certificates.
Searching Metadata:
● Metadata Definition: Information embedded within files revealing details like author,
organization, and document properties.
● Tools for Metadata Extraction:
○ Metagoofil: Extracts metadata from various document types (PDF, DOCX,
XLSX) on target websites using Python libraries.
○ FOCA (Fingerprinting Organizations with Collected Archives): GUI tool for
discovering metadata from documents, expanding to find associated domains
and more.
19
● Maltego Overview: GUI tool for visualizing relationships between gathered data points.
● Transforms: Automates querying of public data sources to identify connections (e.g.,
domains, IP addresses, social media profiles).
● Graphical Representation: Uses node graphs to depict hierarchical relationships and
commonalities among data sources.
● Shodan Functionality: Search engine for indexing IoT devices and other connected
systems.
● Use Cases:
○ Identifying security vulnerabilities in IoT devices (e.g., default credentials).
○ Locating publicly accessible devices (e.g., IP cameras, HVAC systems) for
potential physical or remote attacks.
Lesson 4
1. Pretexting
○ Definition: Creating a fabricated scenario to deceive the target into providing
information or taking actions.
○ Example: Impersonating a trusted individual to request sensitive information.
2. Elicitation
○ Definition: Extracting information from a target through casual conversation or
surveys.
○ Methods: Requests, interrogations, surveys, and observations to gather
actionable intel.
3. Phishing, Pharming, and Baiting
○ Phishing: Sending fraudulent emails or messages impersonating legitimate
entities to obtain sensitive data.
○ Pharming: Redirecting victims to malicious websites that mimic trusted sites to
collect personal information.
○ Baiting: Leaving physical media containing malware in public areas to entice
victims into using them.
4. Vishing and SPIT
○ Vishing: Voice phishing where attackers use phone calls to manipulate victims
into revealing sensitive information.
○ SPIT: Spam over Internet Telephony, sending unwanted messages over VoIP
systems.
5. Impersonation and Deception
○ Impersonation: Pretending to be a trusted individual or authority figure to gain
trust and compliance.
○ Deception Tactics: Creating urgency, scarcity, or fear to prompt immediate
action from the victim.
6. URL Hijacking
○ Definition: Registering domains similar to legitimate sites to intercept traffic and
steal information.
○ Example: Redirecting users to fake websites through typos or misspellings in
URLs.
21
Case Examples
Mitigation Strategies
● Awareness Training: Educating employees about social engineering tactics and how to
identify phishing attempts.
● Two-Factor Authentication: Implementing additional security measures to verify
identities and prevent unauthorized access.
● Regular Security Audits: Assessing vulnerabilities and updating security protocols to
mitigate risks.
Overview:
● Objectives of Assessment:
○ Review project scope and assess physical security controls.
○ Tasks include photographing restricted areas, stealing devices, and accessing
restricted systems.
● Evaluation of Physical Security Controls:
○ Assess locks (physical and electronic), surveillance systems, security personnel,
lighting, barriers, alarms, and motion sensors.
Badge Cloning:
Gaining Access:
● Bypassing Locks:
○ Methods include lock picking (for pin-tumbler locks), cutting tools, and exploiting
weaknesses in keyless locks (combination, card, biometric).
● Tailgating and Piggybacking:
○ Tailgating: Following authorized personnel through secured doors.
○ Piggybacking: Similar to tailgating but with target's awareness, often exploiting
courtesy or lack of scrutiny.
● Dumpster Diving: Searching trash for sensitive information like documents or storage
devices improperly discarded.
● Shoulder Surfing: Observing or capturing sensitive information from computer screens
or input devices unnoticed.
Security Considerations:
Overview:
● Objective: Use tools like the Social Engineering Toolkit (SET) and call spoofing tools to
manipulate targets into performing actions.
● Tools Covered: Social Engineering Toolkit (SET), VoIP call spoofing.
Spoofing a Call:
● VoIP Spoofing:
○ Utilizes Voice over IP (VoIP) to manipulate Caller ID information.
○ Allows caller to appear as a trusted entity (e.g., recognized vendor, company
president).
● Methods:
○ App-Based Spoofing: Simple method using apps to modify outgoing Caller ID.
○ Asterisk Tool: Open-source PBX software (Asterisk) for more advanced
spoofing setups, requires Linux administration skills.
● Voicemail Exploitation:
○ Spoofed caller IDs can access voicemail systems.
○ Exploitation involves trying default passwords or using Google Hacking
techniques to find vulnerabilities in VoIP systems.
Security Considerations:
Lesson 5
Zero-Day Vulnerabilities
Active Reconnaissance
Scanning Considerations
Detect Defenses
1. Load Balancers
● Purpose: Distribute network traffic across multiple servers for improved performance
and reliability.
● Detection: Use tools like lbd in Kali Linux to identify load balancing devices.
● Impact: Can misdirect scans or attacks, affecting scanning accuracy.
2. Firewalls
● Purpose: Control and monitor incoming and outgoing network traffic based on
predefined security rules.
● Types: Personal firewalls (software-based) and dedicated appliances (hardware-based).
● Detection: Conduct port scans and firewalking to test which traffic passes through.
● Testing: Check if crafted packets can bypass firewall rules, assessing for
misconfigurations or weaknesses.
● Web Application Firewalls (WAFs):
○ Designed to protect web applications from common attacks (e.g., XSS, SQLi).
○ Detection methods include HTTP headers, response patterns (e.g., error
messages).
3. Antivirus/Antimalware
● Tools: Use OSINT tools like Shodan and Censys to gather information on exposed
systems.
● Censys: Analyzes attack surfaces similar to Shodan, identifies services, ports, and
software vendors.
● OpenVAS: Conducts vulnerability scans, provides risk ratings, and lists CVEs for
identified vulnerabilities.
2. Packet Crafting
● Purpose: Customize IP packets to test firewall rules, evade intrusion detection systems
(IDS), or conduct denial of service (DoS) attacks.
● Techniques: Set unusual TCP flags (e.g., XMAS scan), fragment packets to evade IDS,
create packets to overload CPU resources.
● Tools: hping3, Scapy, Ostinato, Libcrafter for crafting and sending custom packets.
● Web Servers: Scan on TCP ports 80/443 for vulnerabilities, test nonstandard ports,
check for SQL injection vulnerabilities.
● Databases: Typically on TCP 1433 (SQL Server), vulnerable to SQL injection attacks.
● Tools: Arachni, Skipfish, OWASP ZAP, Metasploit Pro for web application vulnerability
scanning.
● SQL-specific Tools: SQLmap for detecting and exploiting SQL injection flaws.
4. Cryptographic Vulnerabilities
● SSL/TLS: Check for vulnerabilities like Logjam, Freak, Poodle that weaken encryption.
● Tools: Nikto for comprehensive testing on web servers, including SSL/TLS
vulnerabilities and other server misconfigurations.
27
Lesson 6
● Methods: Use Wireshark on LAN to passively gather data via protocols like NetBIOS
and Kerberos.
● Examples: Identify hosts via NetBIOS name service (NBNS) messages and extract user
account names from Kerberos traffic.
● Objective: Verify proper isolation of network segments using tools like Nessus.
● Methods: Employ subnets, VLANs, and firewalls to separate networks.
● Standards: Ensure compliance with regulations such as PCI DSS through segment
testing and reporting.
29
● Purpose: Obtain MAC addresses for network reconnaissance and potential attacks.
● Tools: Use Nessus, Nmap (nmap -PR -sn <target>), and Arping (in Kali Linux) for
ARP traffic collection.
● Technique: ARP poisoning (spoofing MAC addresses) for man-in-the-middle attacks.
● War Driving: Actively searching for open access points (WAPs) using mobile devices.
● Risks: Potential for rogue or improperly secured WAPs compromising network security.
● Challenges: Testing remote locations may require onsite visits or tools like WiGLE.
● WiGLE: OSINT tool for mapping and indexing access points globally.
WiGLE Usage
● Functionality: Search by location, date range, and filter options (e.g., "Possible
Freenet").
● Visualization: Displays APs as dots; open APs labeled as "Free Love".
● Views: Standard, Satellite, Nightvision, Greyscale, and Hybrid for varied perspectives.
Signal Amplification
Lesson 7
Basic Features
● Host and Service Discovery: Identify active devices and running services.
● Operating System Fingerprinting: Determine the OS of the target.
● Gathering MAC Addresses: Obtain MAC addresses of devices.
● Detecting Vulnerable Hosts: Identify hosts with known vulnerabilities.
Scanning Strategies
● TCP Scans:
○ Connection-oriented, providing detailed results.
○ Types:
■ TCP ACK Scan (-sA): Bypass firewall rulesets, detect filtered ports.
■ Full TCP Scan (-sT): Standard TCP handshake.
■ Christmas Tree Scan (-sX): Uses FIN, PSH, URG flags to bypass
firewalls/IDS.
● UDP Scans:
○ Connectionless, slower, and more challenging.
○ Responses:
31
Alternative Pings
Port States
OS Footprinting
● Passive OS Fingerprinting:
○ Collects traffic using tools like Wireshark.
○ Avoids detection by security devices but is less accurate.
● Active OS Fingerprinting:
○ Actively sends probes and analyzes returned packets.
○ Example: nmap -sV scanme.nmap.org
○ Detects services and versions running on open ports.
Zenmap Interface
● Testing DNS:
○ Footprinting and testing for vulnerabilities like flood attacks, cache poisoning, and
zone file exposure.
○ Normal behavior: DNS queries and responses between authoritative and
recursive servers.
○ Vulnerability example: nmap --script=dns-service-discovery -p 5353
<target>
○ Zone transfer vulnerability: nmap --script=dns-zone-transfer.domain
<target>
○ Cache poisoning check: nmap -sU -p 53 --script=dns-update --
script-args=dns-update.hostname=target.example.com,dns-
update.ip=192.0.2.1 <target>
● Exposing Vulnerable Web Servers:
○ Methods: Manual source code examination, web/access log review, and traffic
interception using proxies.
○ Proxy tool: Burp Suite (Community Edition available in Kali Linux).
■ Captures HTTP requests/responses.
■ Lists and details vulnerabilities.
● Burp Suite:
○ Acts as a local proxy for HTTP traffic.
○ Displays vulnerabilities and detailed request/response data.
○ Example vulnerability: OS command injection.
35
Lesson 8
Evade Detection
Key Concepts:
1. Evading Detection:
● Nmap Scans:
○ TCP SYN Scan: Default, fast, and can scan thousands of ports.
○ Stealth Options:
■ -sF: Sends TCP FIN to bypass non-stateful firewalls.
■ -f: Fragment packets to evade packet filtering firewalls and IDS.
■ --randomize-hosts: Randomizes order of host scans.
● Using a Decoy:
○ Creates bogus packets from decoys to blend in.
○ Command: nmap -D [decoy1, decoy2, etc.] <target>.
● Fake IP Address:
○ Command: nmap -S <spoofed source address> <target>.
● Fake MAC Address:
○ Random MAC: nmap -sT --spoof-mac apple <target>.
○ Specific MAC: nmap -sT --spoof-mac <MAC address> <target>.
● Modifying Port Number:
○ Commands: --source-port <portnum> or -g <portnum>.
● Rogue WAP:
○ Use an authenticated device to bypass NAC.
○ Example: On-path attack (man-in-the-middle).
36
● Fileless Malware: Uses built-in OS tools (PowerShell, WMI, VBScript, Mimikatz) instead
of external malware.
● Phishing with Macros:
○ Example: Phishing email with a Word document macro activating a PowerShell
task.
Objectives:
Techniques:
1. Evading Detection
3. Device Spoofing:
4. Bypassing NAC:
6. Covering Tracks:
● Clearing Logs:
○ Use Metasploit, CLI commands in Windows, and Linux.
● Removing Specific Entries:
○ Use SED to delete specific log entries.
● Changing Log Entries:
○ Modify logs to mislead investigators.
○ Use Incognito to impersonate tokens.
● Modifying Timestamps:
○ Use TimeStomp to alter file MACE attributes.
● Erasing Evidence:
○ Clear command history.
○ Shred files to securely delete them.
38
Study Notes
● Steghide
○ Function: Embeds payload in images and audio files.
39
Alternative Methods
Remote access tools allow attackers to manipulate systems from a distance while evading
detection.
1. Proxy Servers:
○ Mediate communications between a client and server.
○ Can filter, modify communications, provide caching for performance.
○ SOCKS5 is a common protocol for authenticated proxy communications.
2. ProxyChains:
○ A command-line tool for routing connections through multiple proxy servers.
○ Provides anonymity by masking the source IP address.
○ Configured with Tor by default in Kali Linux.
○ Command structure: --proxies <proxy:port, proxy:port...>.
Study Notes
Lesson 9
Enumerating Hosts
Enumeration Overview:
● Purpose: To query devices or services for configuration and resource information post-
exploitation.
● Information Obtained: Operating systems, services, user details, network devices, and
more.
● Methods: Can be done with or without credentials, focusing on obtaining as much
detailed information as possible.
Enumerating Websites:
Study Notes:
1. Purpose of Enumeration:
○ Essential for identifying potential attack vectors and gathering detailed system
information.
2. Indexing the Network:
○ Use tools like Nmap and Metasploit to catalog services, shares, and websites.
3. Discovering Services and Shares:
○ Tools such as Metasploit and ShareEnum help enumerate FTP, SMTP, DNS,
HTTP, SMB, and NFS services.
4. Enumerating Websites:
○ Employ Nmap scripts and Metasploit modules to discover web server
technologies and open ports.
5. Enumerating Windows Hosts:
○ Use PowerShell for detailed enumeration of Windows hosts, including shares
and Active Directory objects.
6. Enumerating Active Directory:
○ PowerShell commands (Get-NetDomain, etc.) are crucial for querying AD for
user, group, and domain information.
7. Enumerating Linux Systems:
○ Metasploit and nmap are effective for enumerating Linux systems, focusing on
system configurations and network details.
● Techniques:
○ DNS Cache Poisoning: Sending bogus records to redirect traffic.
○ ARP Spoofing: Falsely associating MAC address with IP address to intercept
traffic.
○ MAC Address Spoofing: Modifying MAC address to intercept traffic intended for
another device.
● Obtaining Hash:
○ Relay Attack (NTLM): Using captured hash instead of password for
authentication.
○ Kerberoasting: Extracting service tickets encrypted with NTLM hash to crack
plaintext password.
Chaining Exploits
● Impacket Tools:
○ Purpose: Open-source tools for Windows environment PenTesting.
○ Capabilities: NTLM and Kerberos authentication attacks, pass the hash,
credential dumping, packet sniffing.
● Responder:
○ Function: Command-line tool for poisoning NetBIOS, LLMNR, and MDNS name
resolution requests.
● mitm6:
○ Usage: IPv6 DNS hijacking tool to redirect victims using DHCPv6 and DNS
queries.
● Exploit DB:
○ Purpose: Comprehensive collection of public exploits and vulnerable software.
● SearchSploit:
○ Function: Tool to search Exploit DB from the command line in Kali Linux.
● Metasploit: Offers extensive modules and payloads with graphical and command-line
interfaces.
● Impacket: Specializes in Windows-specific attacks like NTLM and Kerberos.
46
● IAM Concepts:
○ Defines user/device identities and access based on roles and permissions.
○ Types include personnel, endpoints, servers, software, and roles.
● IAM Risks:
○ Poor credential management, excessive privileges, and shared accounts pose
threats.
○ Requires auditing, compliance management, and policy enforcement.
Mitigation Strategies
47
● Best Practices:
○ Implement strong access controls and least privilege principles.
○ Regularly audit and update configurations, credentials, and permissions.
● Description: Injecting malicious code like SQL injection (SQLi) or Cross-Site Scripting
(XSS) into cloud applications.
● Risk: Compromise of data integrity and confidentiality.
● Example: Wrapper attacks to bypass security measures.
Side-Channel Attacks
Credential Harvesting
Privilege Escalation
● ScoutSuite: Multicloud auditing tool using API calls to assess security configurations.
● Prowler: CIS benchmark and compliance auditing tool specifically for AWS.
● Pacu: Exploitation framework for AWS to assess security post-compromise.
● Cloud Custodian: Policy-driven management tool for cloud security, governance, and
compliance.
49
Lesson 10
Eavesdropping
Deauthentication Attacks
Jamming Attacks
Cracking Encryption
● Description: Setting up rogue APs with the same SSID as legitimate networks to
deceive users.
● Methods: Use deauthentication to force client connection, then intercept traffic.
● Tools: Wireshark for eavesdropping, Aircrack-ng suite for cracking, and Wi-Fi Pineapple
for deauthentication and evil twin attacks.
● Legal Considerations: Understand the legality of tools and attacks in your jurisdiction.
Kismet
Wifite2
Spooftooph
● Precaution: Requires root privileges; useful for observing interactions with Bluetooth
devices.
Fern
EAPHammer
MDK4
Considerations
● Hardware Requirements: Use wireless cards supporting monitor mode and packet
injection.
● Security Protocols: Focus on cracking WPA/WPA2, as WEP is deprecated.
● Word Lists: Essential for password cracking; repositories like Rockyou.txt are
commonly used.
52
Lesson 11
Controlling Access
Identifying Vulnerabilities
Mitigation Strategies
1. Malware Types:
○ Spyware: Records activity, sends to remote site.
○ Trojans: Pretends to be useful, grants remote access.
○ Rootkits: Provides unauthorized access.
○ Viruses and Worms: Self-replicating, spread through various means.
2. Biometric Risks:
○ Implementation: Enhances security if correctly implemented.
○ Risk: Vulnerable to spoofing, granting unauthorized access.
3. Rooting and Permissions:
○ Rooting: Enhances device performance but increases vulnerability.
○ Permissions: Over-granting can lead to data exposure.
4. Social Engineering:
○ Techniques: Phishing, SMiShing (SMS phishing), vishing (VoIP phishing).
○ Targets: Exploits user trust, urgency, and lack of awareness.
5. Bluetooth Attacks:
○ Bluejacking: Sends unsolicited messages via Bluetooth.
○ Bluesnarfing: Retrieves data from Bluetooth-enabled devices.
6. Malware Exploitation:
○ Platform Specifics: iOS (restrictive, jailbreak risks), Android (open, root
vulnerabilities).
○ Exploitation Tools: msfvenom for creating malicious APKs.
7. Malware Analysis:
○ Reverse Engineering: Dissects malware code to understand functionality.
○ Sandbox Analysis: Runs malware in isolated environments for safe observation.
Mitigation Strategies:
54
● Best Practices: Update OS and apps, use security software, avoid unknown sources.
● Security Controls: Implement MDM/MAM solutions, enforce strong authentication.
● Awareness: Educate users about phishing, social engineering, and device security.
Introduction
● Objective: Understand tools and frameworks for testing mobile devices against
vulnerabilities.
● Importance: Mobile devices are prevalent but vulnerable; testing helps identify and
mitigate risks.
1. Kali Linux
○ Features: Built-in tools for penetration testing, including Ettercap for MITM
attacks, Android SDK for app development, and Burp Suite for web app testing.
2. Mobile Security Framework (MobSF)
○ Capabilities: Automated code evaluation and malware analysis through static
and dynamic analysis for Android and iOS platforms.
3. OWASP Mobile Security Testing Guide (MSTG)
○ Purpose: Provides guidelines and checklists for securing mobile apps
throughout their lifecycle, including security recommendations and testing
specifications.
● Drozer
○ Functionality: Formerly used for Android vulnerability testing, offers client-server
model for app security assessments (development ceased).
● APKX and APK Studio
○ Usage: Tools for decompiling and analyzing Android APK files to inspect Java
source code and behavior.
● Postman
○ Purpose: Interactive GUI tool for testing HTTP APIs, creating requests, building
test suites, collaborating within teams, and integrating with DevOps.
56
Lesson 12
● Definition: Represents all potential entry points for attacks on IoT devices.
● Components: Includes the device itself, cloud connections, APIs (like MQTT, CoAP),
business logic, and user interfaces.
● Potential Exploits: Attacks can exploit weaknesses in any part of the attack surface to
compromise devices or data.
● Botnet Attacks: Devices infected with malware (e.g., Mirai bot) can be weaponized to
launch DDoS attacks.
● Denial-of-Sleep Attacks: Continuously sending signals to IoT devices to prevent them
from entering sleep mode, draining their batteries.
● Protocol Vulnerabilities: MQTT and CoAP vulnerabilities like spoofing, packet
amplification, and data modification pose significant risks.
○ Network isolation and centralized management are critical for securing data
access.
● Vulnerabilities:
○ Weaknesses can be exploited through insecure configurations or outdated
software.
○ Common attacks include DoS, malware infections, social engineering, and
physical attacks.
● Exposed Data:
○ Vulnerabilities often stem from software flaws like SQL injections and
misconfigurations (e.g., default credentials).
○ Management interfaces like IPMI can expose networks if not properly configured.
● Error Handling:
○ Insecure error messages can leak sensitive information (e.g., directory paths)
useful for directory traversal attacks.
○ Best practices include minimizing error details to mitigate risks (e.g., generic
error messages).
● Fuzzing:
○ Technique involves sending random inputs to applications to uncover
vulnerabilities.
○ Targets configuration files, source code, logs, and web files to identify
weaknesses.
○ Feedback-based fuzzing is interactive and effective for detecting specific
vulnerabilities like SQL injections.
59
● Regular Assessments:
○ Conduct PenTests and vulnerability assessments to identify and mitigate
vulnerabilities.
● Secure Configurations:
○ Implement strong authentication and access controls to protect sensitive
systems.
● Educate Personnel:
○ Train users and administrators on security best practices to reduce exploitation
risks.
○
● Virtualization Basics:
○ Virtualization creates simulated computing environments that mimic hardware,
OS, and applications.
○ Components include host hardware, hypervisor (VMM), and guest operating
systems (VMs).
● Types of Virtualization:
○ Host-Based Model (Type II Hypervisor):
■ Hypervisor runs on a host OS (e.g., VMware Workstation, Oracle
VirtualBox).
■ VMs operate as guests on top of the host OS.
○ Bare Metal Model (Type I Hypervisor):
■ Hypervisor directly installed on hardware (e.g., VMware ESXi, Microsoft
Hyper-V).
■ Offers direct access to host hardware, enhancing performance and
security.
● Security Challenges:
○ Administration occurs at both hypervisor and VM levels, requiring robust security
measures.
○ Vulnerabilities similar to physical environments, including misconfigurations and
inadequate security practices.
● VM Sprawl:
○ Uncontrolled creation of VMs without proper management.
○ Increases attack surface and propagation of vulnerabilities across the
infrastructure.
60
● Protecting VM Repositories:
○ VM repositories store VM templates and configurations.
○ Ensure protection against malware and misconfigurations to prevent spread
within the VM environment.
Containerized Workloads
● Types of Attacks:
○ Class 1: Attacks originating outside the VM.
○ Class 2: Attacks affecting a VM directly.
○ Class 3: Attacks originating from within a compromised VM.
● VM Escape:
○ Malware in a VM exploits vulnerabilities to interact with the hypervisor or host
kernel.
○ Potential to compromise other VMs or access sensitive data on the physical
server.
● Hyperjacking the Hypervisor:
○ Attack where malicious actors gain control of the hypervisor.
○ Grants full access to VMs and data, posing significant security risks across the
environment.
Preventive Measures
Lesson 13
1. Injection
2. Broken Authentication
3. Sensitive Data Exposure
4. XML External Entities (XXE)
62
Common Vulnerabilities:
Study Notes
4. Error Handling:
5. Input Validation:
6. Code Signing:
7. Race Conditions:
1. Session Hijacking:
○ Description: Stealing a user's session credential (session ID or SID) from their
browser to impersonate the user on a website.
○ Mechanism: HTTP does not track state; cookies are used to maintain sessions.
○ Methods:
■ Stealing browser cookies.
■ Session fixation: user authenticates with a known SID.
■ Session replay: intercepting and repeating the authentication process,
often via a man-in-the-middle attack.
2. Cross-Site Request Forgery (CSRF/XSRF):
○ Description: Exploits the trust between a user's browser and a website, using
the user's saved authentication data to perform unauthorized actions.
○ Example: A crafted URL increases the quantity of an item in a shopping cart
when clicked by the victim.
○ Challenges: Requires finding a vulnerable form and the right parameters.
3. Server-Side Request Forgery (SSRF):
○ Description: Exploits the trust between a server and the resources it can
access.
○ Potential Impact: May provide access to internal resources otherwise
unavailable.
64
Privilege Escalation:
Study Notes
1. Session Attacks:
● Session Hijacking:
○ Steal session ID (SID) from browser cookies.
○ Use stolen SID to impersonate the user.
○ Methods: session fixation, session replay.
● Cross-Site Request Forgery (CSRF/XSRF):
○ Exploits user's saved authentication data.
○ Difficult to detect as it mimics normal user behavior.
○ Requires vulnerable form and known parameters.
● Server-Side Request Forgery (SSRF):
○ Exploits trust between server and resources.
65
2. Privilege Escalation:
● Examples:
○ Poorly implemented account lock mechanisms.
○ Vulnerable APIs (RESTful, XML-RPC, SOAP).
○ Common API target: XML-RPC in WordPress.
4. Mitigation Strategies:
● Definition: An attack where malicious SQL code is embedded in input fields, allowing
attackers to manipulate database queries.
● Identification Methods:
○ Single Quote Method: Submit an apostrophe (') in input fields and look for SQL
syntax errors.
○ Example:
66
Directory Traversal
Code Injection
Definition: Injecting JavaScript into web pages that execute on the client’s browser.
● Types of XSS:
○ Persistent (Stored) XSS: Malicious code stored on the server.
○ Reflected XSS: Malicious code reflected off a server response.
○ DOM-based XSS: Exploits client-side JavaScript.
● Example Injection: <script>alert("Got you!")</script>
Using Proxies
Web Proxy:
Identify Tools
truffleHog
Gobuster
DirBuster
Wapiti
WPScan
Brakeman
SQLmap
SearchSploit
CrackMapExec
Lesson 14
System Hacking
Running with .NET and .NET Framework
70
● PowerShell: A powerful scripting language and shell built on the .NET Framework,
offering enhanced functionality over the traditional Windows command prompt.
● Automation: PowerShell can automate tasks involving the Windows Registry, Active
Directory objects, Group Policy, and the Windows network stack, making it valuable for
penetration testers.
1. Empire:
○ A C2 framework utilizing PowerShell for post-exploitation tasks on Windows, with
a Python component for Linux.
○ Features include running PowerShell agents without powershell.exe, key loggers,
Mimikatz, and evading network detection.
○ Note: Empire is now maintained by a group within Kali Linux and can be found
here.
2. Covenant:
○ A .NET C2 framework similar to Empire, showing the attack surface of .NET and
facilitating cross-platform attacks.
○ Compatible with Windows, Linux, and macOS.
○ Covenant GitHub
3. Mythic:
○ Another cross-platform C2 framework with payloads like Apfell and Poseidon,
effective for PenTesting macOS.
○ Mythic GitHub
4. PowerShell Tools:
○ nishang: A collection of scripts for Windows post-exploitation.
■ nishang GitHub
○ NoPowerShell: Executes PowerShell commands without powershell.exe.
■ NoPowerShell GitHub
○ PowerLessShell: Alternative PowerShell execution method.
■ PowerLessShell GitHub
○ PowerShdll: Uses rundll32 to execute PowerShell commands.
■ PowerShdll GitHub
71
● Telnet: An older protocol for remote access that transmits data in plaintext, making it
insecure for modern networks but still used in some legacy systems.
● rlogin/rsh: Simple remote access tools for Linux, with rsh allowing command execution
directly without requiring credentials if configured with an .rhosts file.
● Netcat: A versatile command-line utility for TCP, UDP, or Unix domain socket network
connections. Known as the "Swiss Army knife" of hacking tools, it supports:
○ Creating or connecting to a TCP server
○ Acting as a proxy or relay
○ Transferring files
○ Launching executables
○ Port scanning
● Netcat Options:
○ -l: Listen mode
○ -u: UDP mode
○ -p: Specify port
○ -e: Execute program on connection
○ -n: No DNS lookups
○ -z: Zero I/O mode
○ -w <seconds>: Set timeout value
○ -v: Verbose mode
○ -vv: Very verbose mode
● Ncat: Developed for Nmap, enhancing Netcat with additional features such as SSL
encryption for secure communications. This is crucial for preventing detection during
data exfiltration or command execution.
Lesson 15
Benefits of Scripting
● Bash (Linux): Default shell for Unix-like systems. Used for automation and integrating
with system utilities.
● PowerShell (Windows): Built on .NET Framework, enhances Windows automation with
cmdlets like Clear-EventLog.
● Python: Cross-platform, emphasizes readability and simplicity. Widely used in
PenTesting for its extensive libraries.
● Ruby: Known for web development (Ruby on Rails) and Metasploit scripting. Flexible
syntax similar to Python.
● Perl: Designed for text manipulation and system administration tasks, supports efficient
code for PenTesting.
● Examples: Automating file creation, log analysis (e.g., using grep and cut).
Python in PenTesting
75
● Advantages: Rich library support for network scanning, exploitation, and more.
● Syntax: Whitespace-sensitive, supports object-oriented programming.
Script Overview:
Lesson 16
Test Credentials
Introduction to Credentials:
● Credentials are analogous to keys that grant access to accounts, networks, or systems.
● They are highly valuable to attackers, enabling theft, defacement, or leverage for
blackmail.
Password Attacks:
● Cain & Abel, Hydra, Medusa: Brute-force tools for various services.
● Hashcat: GPU-accelerated tool for hash cracking.
● Metasploit: Modules for automated scanning and credential testing.
Maintain Persistence
Objective: Perform post-exploitation techniques to maintain access in a network.
Persistence Techniques:
1. Creating a Foothold:
○ Definition: Persistence ensures continued access to a compromised system
without detection.
○ Goals:
■ Exfiltrate data gradually to avoid detection.
■ Monitor user behavior over time for information gathering.
■ Cause sustained denial of service attacks.
■ Compromise systems for prolonged periods.
2. Avoiding Advanced Persistent Threats (APTs):
○ Definition: APTs use sophisticated, long-term strategies to exfiltrate data or
disrupt operations unnoticed.
○ Targets: Often large institutions with significant data or influence.
3. Bypassing Restrictions:
○ Creating New Accounts:
■ Windows: net user jsmith /add
■ Linux: useradd jsmith
■ Privilege Escalation: Grant administrative rights for deeper access.
4. Using Backdoors and Trojans:
○ Backdoors: Hidden access points for continued unauthorized entry.
81
○ Remote Access Trojans (RATs): Tools like NetBus, Back Orifice, DarkComet,
providing hidden, persistent access.
5. Remote Access Services:
○ Examples: Telnet, SSH, RDP, VNC.
○ Challenges: Monitoring and transparency make them less stealthy.
6. Shell Types:
○ Bind Shells: Targets bind to a local port; limited by firewall and NAT restrictions.
○ Reverse Shells: Attacker listens on a specific port; more effective and bypasses
firewall/NAT issues.
7. Services and Daemons:
○ Windows Services: Background processes; start at system boot.
○ Linux Daemons: Run independently of user sessions; continuous availability.
8. Registry and Startup:
○ Windows: Add entries to Run keys in Registry for automatic execution on
startup.
9. Scheduled Tasks:
○ Windows: Use Task Scheduler (schtasks) for automated execution of
commands or scripts at specified times or events.
○ Linux: Utilize cron jobs for similar automation tasks.
82
Lesson 17
● Escalation Path: Defines how critical issues are reported and escalated within the
PenTest team and to the client.
● Chain of Command: Ensures structured communication flow, minimizing risks and
enhancing responsiveness.
● Thresholds and Protocols: Agreed upon points for notifying clients about operational
disruptions or system instability during testing.
● Client Notification: Clarifies when and how the client should inform the PenTest team
of interference with operations or system performance.
● Centralized Communication: All interactions between the PenTest team and the client
should go through designated points of contact.
● Immediate Response Capability: Ensures rapid response to incidents, unexpected
findings, or client requests to manage scope effectively.
Communication Triggers
Importance of Triggering Communication Events:
Lesson 18
● Cover Page: Includes report name, version/date, author, and target organization.
● Document Properties: Includes metadata like title, version, authors, activity dates, and
revision history.
● Version Control: Tracks changes with descriptions, authors, dates, and version
numbers.
3. Taking Notes:
● Internal notes aid in recalling detailed activities and decisions during tests.
● Flexibility in note-taking allows adaptation to team needs and client requirements.
4. Ongoing Documentation:
7. Providing Observations:
● Structure reports with sections like executive summary, methodology, findings, and
recommendations.
● Tailor reports to address client-specific risks and preferences.
● Securely handle and store reports according to established best practices.
Lesson 19
Recommending Remediation
Encrypting Passwords
○ Avoid insecure coding practices like lack of input validation and hard-coded
credentials.
● Job Rotation:
○ Reduces insider threats by rotating responsibilities.
○ Enhances skills and reduces stress among employees.
● Time of Day Restrictions:
○ Limits access based on operational hours to mitigate risks.
● Mandatory Vacations:
○ Prevents burnout and reduces vulnerabilities due to fatigue.
Recommended Actions
● Monitoring Effectiveness:
○ Measure security incident trends, response times, and vulnerability remediation.
Physical Controls
Controlling Access to Buildings
● Access Management:
○ Manage ingress using permissions.
○ Example: RFID access cards for elevators.
○ Vulnerabilities: RFID cloning and replay attacks.
● Biometric Authentication:
○ Uses unique biological features (e.g., fingerprints, iris).
○ Reliable access control method (e.g., fingerprint scanners, face recognition).
● Video Monitoring:
○ Uses cameras for monitoring.
○ Security considerations: Networked surveillance vulnerabilities (e.g., Wi-Fi
attacks).
○ Best practices: Use wired connections, network segmentation, and regular
firmware updates.
Security Measures
Mitigating Risks
● Risk Mitigation:
○ Analyze attack vectors and vulnerabilities.
○ Recommend remediation strategies.
○ Enhance physical security through integrated technologies.
93
Lesson 20
Post-Engagement Cleanup
Purpose
Cleanup Tasks
Considerations
Best Practices
Follow-Up Actions
Client Acceptance and Feedback
● Reviewing Findings: Discuss report findings with the client for acceptance.
● Mitigation Recommendations: Ensure report includes actionable recommendations.
● Client Engagement: Address client concerns and clarify report details if necessary.
● Proof of Findings: Provide evidence (e.g., screenshots, data samples) to validate
findings.
Planning Retests
Lessons Learned
Legal Considerations
● Evidence Integrity: Maintain chain of custody for evidence in case of legal scrutiny.
● Compliance: Ensure findings and actions comply with legal and regulatory
requirements.