Domain 3Exploit Dev & AV EvasionCORE

Locating Public Exploits

Study notes for Locating Public Exploits covering key PEN-200 methodology and lab techniques.

Domain: Domain 3: Exploit Mechanics & AV Evasion•Updated: 2026-09-05
#Locating Public Exploits#PEN-200

OSCP Study Guide: Locating Public Exploits

Table of Contents

  1. Introduction
  2. Exploit Databases and Resources
  3. Search Techniques
  4. Searchsploit Mastery
  5. CVE, CVSS, and CPE
  6. Exploit Evaluation
  7. Legal and Ethical Considerations
  8. Pentest Workflow Integration
  9. Exploit Library Management
  10. Exploit Formats
  11. Quick Reference Tables

1. Introduction

Why Exploit Research Matters

  • Core OSCP Skill: Finding and adapting exploits is fundamental to penetration testing
  • Real-World Relevance: Most vulnerabilities have public exploits available
  • Time Efficiency: Leveraging existing exploits saves development time
  • Knowledge Building: Understanding exploits deepens security comprehension

The Exploit Research Workflow

graph TD
    A[Identify Target] --> B[Enumerate Services]
    B --> C[Version Detection]
    C --> D[Search for CVEs]
    D --> E[Find Exploits]
    E --> F[Evaluate Reliability]
    F --> G[Test in Lab]
    G --> H[Adapt if Needed]
    H --> I[Execute Against Target]
    I --> J[Document Results]
    
    style A fill:#4CAF50
    style J fill:#f44336

Key Principles

  • Verify before exploiting: Always confirm vulnerability applicability
  • Test in isolated environments: Never test exploits directly on production
  • Document everything: Maintain detailed records of exploit research
  • Understand the code: Don’t blindly execute exploits you don’t understand

2. Exploit Databases and Resources

2.1 Exploit-DB (Offensive Security)

Overview

  • URL: https://www.exploit-db.com
  • Owner: Offensive Security (same organization behind OSCP)
  • Content: Curated collection of exploits, shells, and papers
  • Update Frequency: Daily updates with new submissions

Access Methods

Method Command/URL Description
Web Interface https://www.exploit-db.com Browse and search via browser
API https://www.exploit-db.com/search Programmatic access
Searchsploit searchsploit <query> Local command-line tool
Git Repository git clone https://gitlab.com/exploit-database/exploitdb.git Full database download

Search Techniques

# Basic search
searchsploit Apache 2.4

# Advanced search with filters
searchsploit -m Apache 2.4.49 path traversal
searchsploit -w "apache" "path traversal"

# Search by platform
searchsploit -p windows apache

# Search by type
searchsploit -t "remote" apache

Quality Assessment Criteria

  • Publication Date: Recent exploits may be less tested
  • Author Reputation: Known researchers often produce reliable code
  • Comments Section: Community feedback indicates reliability
  • Tested Status: Look for “Tested on Windows” or similar indicators
  • Code Quality: Well-commented, structured code is more reliable

2.2 CVE Details

Overview

  • URL: https://www.cvedetails.com
  • Content: Comprehensive CVE database with vendor/product filtering
  • Features: Statistics, trends, and vulnerability timelines

Search Strategy

  1. Navigate to https://www.cvedetails.com
  2. Select vendor from dropdown
  3. Select product version
  4. Filter by severity and date
  5. Click on CVE for detailed information

Key Features

Feature Description Usage
Vendor Search Filter by software vendor Find all vulnerabilities for a vendor
Product Search Filter by specific product Narrow down to exact software
Version Filter Filter by version range Find version-specific vulnerabilities
Severity Filter Filter by CVSS score Prioritize critical vulnerabilities
Timeline View Visual representation Understand vulnerability history

2.3 NVD (National Vulnerability Database)

Overview

  • URL: https://nvd.nist.gov
  • Authority: Official US government vulnerability database
  • Standard: Maintains CVE entries with standardized descriptions
  • Integration: Works with many security tools and frameworks

Search Capabilities

Advanced Search Parameters:
- CVE ID
- CWE (Common Weakness Enumeration)
- CVSS Version and Score
- Product (CPE)
- Publish/Last Modified Date
- Keywords

CPE Integration

  • CPE Format: cpe:2.3:a:vendor:product:version:update:edition:language:sw_edition:target_sw:target_hw:other
  • Example: cpe:2.3:a:apache:http_server:2.4.49:*:*:*:*:*:*:*
  • Usage: Precise product identification for vulnerability matching

2.4 GitHub Exploit Repositories

Major Repositories

Repository URL Focus Quality
ExploitDB Mirror Various Complete Exploit-DB High
Sploitus Various Aggregated exploits Medium
Personal Collections Various Individual researcher work Variable
Framework Modules metasploit/external-modules Metasploit modules High

Search Techniques

# GitHub search syntax
site:github.com "exploit" "apache" "2.4"
site:github.com "CVE-2021-41773" exploit

# Advanced search parameters
- in:name,readme,filepath
- language:python
- pushed:>2023-01-01
- stars:>10

Quality Indicators

  • Stars and Forks: Community validation
  • Issues Section: Bug reports and discussions
  • Commit History: Active maintenance
  • Documentation: README quality and examples
  • Contributors: Multiple contributors often indicate reliability

2.5 Packet Storm Security

Overview

  • URL: https://packetstormsecurity.com
  • Content: Exploits, advisories, papers, and tools
  • Categories: Multiple vulnerability categories
  • Update Frequency: Regular updates

Content Categories

Category Description Examples
Exploits Remote and local exploits RCE, privilege escalation
Advisories Security announcements Vendor advisories
Papers Research documents Technical analysis
Tools Security utilities Scanners, analyzers
Warnings Urgent notifications Critical vulnerabilities

Search Strategy

  1. Use category filters for targeted searches
  2. Sort by date for latest vulnerabilities
  3. Check advisories for context
  4. Review papers for technical details

2.6 0day.today

Overview

  • URL: https://0day.today
  • Content: Aggregated exploits from multiple sources
  • Features: Quick access to exploit code
  • Note: May contain unverified exploits

Usage Guidelines

  • Verification Required: Always verify exploit reliability
  • Cross-Reference: Check other sources for confirmation
  • Code Review: Examine code before execution
  • Legal Considerations: Ensure authorized testing only

2.7 SecurityFocus

Overview

  • URL: https://www.securityfocus.com
  • Content: Vulnerability research and analysis
  • Features: Bid (Bugtraq ID) database
  • Integration: Links to CVE and other resources

Bid Database

  • Bid Format: BID-XXXXX
  • Content: Detailed vulnerability descriptions
  • Links: References to exploits and patches
  • History: Long-standing vulnerability tracking

3. Search Techniques

3.1 Effective Search Strategies

Keyword Optimization

Good Search Terms:
- "Apache 2.4.49 path traversal exploit"
- "CVE-2021-41773 exploit python"
- "Windows 10 privilege escalation 2023"

Avoid:
- "hack apache"
- "exploit everything"
- "vulnerability"

Search Operators

Operator Example Purpose
Quotes "exact phrase" Exact match
Minus exploit -metasploit Exclude terms
OR python OR ruby Multiple terms
site: site:exploit-db.com Site-specific
filetype: filetype:py File type filter

3.2 Version-Specific Searches

Target Identification Process

graph LR
    A[Target Service] --> B[Version Detection]
    B --> C[Vendor Identification]
    C --> D[Product Name]
    D --> E[Exact Version]
    E --> F[Search Strategy]
    
    F --> G[Exact Match]
    F --> H[Version Range]
    F --> I[Product Family]
    
    style A fill:#2196F3
    style F fill:#FF9800

Search Hierarchy

  1. Exact Version: “Apache 2.4.49 exploit”
  2. Version Range: “Apache 2.4.40-2.4.49 exploit”
  3. Product Family: “Apache HTTP Server exploit”
  4. Vendor: “Apache Software Foundation vulnerabilities”

3.3 CVE-Based Searches

CVE Search Patterns

# Direct CVE search
"CVE-2021-41773" exploit

# CVE with technology
"CVE-2021-41773" python exploit

# CVE with platform
"CVE-2021-41773" windows exploit

# Multiple CVEs
"CVE-2021-41773" OR "CVE-2021-42013" exploit

CVE Information Extraction

  • Description: Vulnerability details
  • Affected Versions: Specific version ranges
  • CVSS Score: Severity rating
  • References: Links to exploits and patches
  • CWE: Common weakness classification

4. Searchsploit Mastery

4.1 Installation and Setup

Installation Methods

# Kali Linux (pre-installed)
# Verify installation
searchsploit --version

# Manual installation
git clone https://gitlab.com/exploit-database/exploitdb.git
cd exploitdb
./searchsploit --update

# Update database
searchsploit --update

Database Structure

exploitdb/
├── exploits/
│   ├── windows/
│   ├── unix/
│   ├── linux/
│   ├── macosx/
│   ├── ios/
│   ├── android/
│   ├── hardware/
│   ├── multiple/
│   └── webapps/
├── shells/
├── papers/
└── searchsploit

4.2 Basic Commands

Search Operations

# Basic search
searchsploit Apache

# Search with multiple terms
searchsploit Apache 2.4

# Search with wildcards
searchsploit "Apache*"

# Search by platform
searchsploit -p windows

# Search by type
searchsploit -t "remote"

Advanced Features

Command Description Example
-m Mirror to current directory searchsploit -m Apache 2.4
-w Wildcard search searchsploit -w "apache" "traversal"
-x Open in editor searchsploit -x 16891.py
-j JSON output searchsploit -j Apache
-mm Mirror multiple searchsploit -mm Apache 2.4

4.3 Practical Examples

Example 1: Apache Path Traversal

# Search for Apache path traversal exploits
searchsploit Apache path traversal

# Mirror the most relevant exploit
searchsploit -m 50383.py

# View the exploit
cat 50383.py

Example 2: Windows Privilege Escalation

# Search for Windows privilege escalation
searchsploit -p windows privilege escalation

# Filter by version
searchsploit -p windows 10 privilege escalation

# Mirror and examine
searchsploit -m 49409.py

Example 3: Web Application Exploits

# Search for web application exploits
searchsploit -t webapps

# Search for specific application
searchsploit -t webapps joomla

# Mirror multiple exploits
searchsploit -mm joomla "sql injection"

4.4 Searchsploit Tips

Efficiency Tips

  • Use Specific Terms: More specific searches yield better results
  • Check Multiple Platforms: Exploits may exist for different platforms
  • Review Comments: Exploit files often contain usage instructions
  • Verify Compatibility: Ensure exploit matches target environment
  • Update Regularly: Keep exploit database current

Common Pitfalls

  • Version Mismatch: Exploit may not work on different versions
  • Environment Differences: Testing environment may differ from target
  • Missing Dependencies: Exploit may require specific libraries
  • Antivirus Detection: Some exploits may be flagged by security software

5. CVE, CVSS, and CPE

5.1 CVE (Common Vulnerabilities and Exposures)

CVE Structure

  • Format: CVE-YYYY-NNNNN
  • Example: CVE-2021-41773
  • Components:
    • Year: 2021
    • Sequence Number: 41773
    • Unique Identifier: Global standard

CVE Information Fields

Field Description Example
ID Unique identifier CVE-2021-41773
Description Vulnerability details Path traversal in Apache
References Related resources Links to exploits, patches
CWE Weakness classification CWE-22: Path Traversal
CPE Affected products cpe:/a:apache:http_server:2.4.49
CVSS Severity score 9.8 (Critical)

5.2 CVSS (Common Vulnerability Scoring System)

CVSS Versions

Version Release Features
CVSS v2 2007 Basic scoring
CVSS v3.0 2015 Enhanced metrics
CVSS v3.1 2019 Refined calculations
CVSS v4.0 2023 Latest standard

CVSS v3.1 Metrics

Base Metrics:

Metric Values Description
Attack Vector (AV) N/A/L/P Network, Adjacent, Local, Physical
Attack Complexity (AC) H/L High, Low
Privileges Required (PR) N/L/H None, Low, High
User Interaction (UI) N/R None, Required
Scope (S) U/C Unchanged, Changed
Confidentiality (C) N/L/H None, Low, High
Integrity (I) N/L/H None, Low, High
Availability (A) N/L/H None, Low, High

Severity Ratings

Score Range Severity Color
0.0 None Green
0.1-3.9 Low Yellow
4.0-6.9 Medium Orange
7.0-8.9 High Red
9.0-10.0 Critical Dark Red

5.3 CPE (Common Platform Enumeration)

CPE Format

cpe:2.3:a:vendor:product:version:update:edition:language:sw_edition:target_sw:target_hw:other

CPE Components

Component Description Example
Part a=application, o=OS, h=hardware a
Vendor Software vendor apache
Product Product name http_server
Version Product version 2.4.49
Update Update level * (any)
Edition Edition * (any)
Language Language * (any)
SW Ed Software edition * (any)
Target SW Target software * (any)
Target HW Target hardware * (any)
Other Other information * (any)

CPE Usage

  • Precise Identification: Exact product matching
  • Vulnerability Correlation: Link CVEs to specific products
  • Automated Scanning: Tool integration for vulnerability assessment
  • Patch Management: Track required updates

6. Exploit Evaluation

6.1 Reliability Assessment

Quality Indicators

graph TD
    A[Exploit Found] --> B{Code Quality?}
    B -->|High| C{Tested?}
    B -->|Low| D[Review Code]
    C -->|Yes| E{Recent?}
    C -->|No| F[Test in Lab]
    E -->|Yes| G[High Confidence]
    E -->|No| H[Medium Confidence]
    D --> I{Understandable?}
    I -->|Yes| J[Modify if Needed]
    I -->|No| K[Find Alternative]
    F --> L{Works?}
    L -->|Yes| M[Document Results]
    L -->|No| N[Debug/Modify]
    
    style G fill:#4CAF50
    style H fill:#FF9800
    style K fill:#f44336

Assessment Criteria

Criterion High Quality Low Quality
Comments Detailed explanations Minimal or no comments
Structure Well-organized code Spaghetti code
Error Handling Proper exception handling No error handling
Dependencies Clear requirements Unclear dependencies
Testing Tested on multiple systems Untested or single test
Author Known researcher Anonymous or unknown

6.2 Relevance Determination

Target Matching Process

  1. Service Identification: Confirm target service
  2. Version Verification: Match exact version
  3. Platform Confirmation: Verify OS and architecture
  4. Configuration Check: Ensure vulnerability conditions met
  5. Environment Assessment: Check for mitigations

Version Matching Techniques

# Banner grabbing
telnet target 80
HEAD / HTTP/1.0

# Nmap version detection
nmap -sV -p 80 target

# Web application enumeration
whatweb target
wappalyzer target

# Service specific tools
apache-version-detect target

6.3 Exploit Metadata Analysis

Metadata Fields

Field Description Importance
Title Exploit name High
Author Creator information Medium
Date Publication date High
Platform Target platform Critical
Type Exploit type High
Tested On Testing environment High
CVE Associated CVE Medium
References Additional resources Medium

Metadata Extraction

# Example exploit header
#!/usr/bin/env python3
"""
Title: Apache 2.4.49 Path Traversal RCE
Author: Security Researcher
Date: 2021-01-01
Platform: Linux
Type: remote
Tested On: Ubuntu 20.04 with Apache 2.4.49
CVE: CVE-2021-41773
References:
    - https://httpd.apache.org/security/vulnerabilities_24.html
    - https://nvd.nist.gov/vuln/detail/CVE-2021-41773
"""

6.4 Success Rate Assessment

Factors Affecting Success

Factor Impact Mitigation
Version Mismatch High Verify exact version
Configuration Differences Medium Check target configuration
Environment Variables Medium Test in similar environment
Security Controls High Assess WAF, IDS, etc.
Patch Status Critical Confirm unpatched status
Network Conditions Low Ensure stable connection

Testing Methodology

  1. Lab Environment: Test in isolated lab first
  2. Version Matching: Use identical target version
  3. Configuration Parity: Match target configuration
  4. Multiple Attempts: Test multiple times for consistency
  5. Documentation: Record all test results

Authorization Requirements

Scenario Authorization Needed Documentation
Pentest Engagement Written contract Scope of work
Bug Bounty Program rules Acceptance criteria
Research Institutional approval Ethics committee approval
Personal Learning Own systems only Lab environment
Unauthorized Testing NEVER Illegal activity
  • Computer Fraud and Abuse Act (CFAA): US federal law
  • Computer Misuse Act: UK legislation
  • GDPR: Data protection regulations
  • Local Laws: Country-specific regulations

7.2 Ethical Guidelines

Responsible Behavior

graph TD
    A[Discover Vulnerability] --> B{Authorized?}
    B -->|Yes| C[Responsible Disclosure]
    B -->|No| D[Do Not Exploit]
    C --> E[Notify Vendor]
    E --> F{Response?}
    F -->|Acknowledged| G[Wait for Patch]
    F -->|No Response| H[Coordinate Disclosure]
    G --> I[Public Disclosure]
    H --> I
    D --> J[Report to Authorities]
    
    style C fill:#4CAF50
    style D fill:#f44336
    style I fill:#FF9800

Disclosure Timeline

Phase Timeframe Action
Discovery Day 0 Document findings
Initial Contact Day 1-3 Notify vendor
Vendor Response Day 3-30 Coordinate fix
Patch Development Day 30-90 Work with vendor
Public Disclosure Day 90+ Publish responsibly

7.3 Responsible Disclosure

Best Practices

  1. Private Communication: Contact vendor privately first
  2. Detailed Report: Provide reproducible steps
  3. Proof of Concept: Include safe PoC if possible
  4. Reasonable Timeline: Allow time for patch development
  5. Coordination: Work with vendor on disclosure timing
  6. Credit: Request proper attribution if desired

Disclosure Templates

Subject: Security Vulnerability Report - [Product Name]

Dear [Vendor Security Team],

I have discovered a security vulnerability in [Product Name] version [Version].

**Vulnerability Summary:**
- Type: [Vulnerability Type]
- Severity: [CVSS Score]
- Impact: [Description of impact]

**Technical Details:**
[Detailed technical description]

**Proof of Concept:**
[Safe PoC steps - no exploitation]

**Recommendations:**
[Suggested fixes]

I am willing to assist with verification and testing.
Please acknowledge receipt of this report.

Best regards,
[Your Name]

8. Pentest Workflow Integration

8.1 Exploit Research in Pentest Lifecycle

graph TD
    A[Reconnaissance] --> B[Scanning]
    B --> C[Enumeration]
    C --> D[Vulnerability Identification]
    D --> E[Exploit Research]
    E --> F[Exploit Selection]
    F --> G[Lab Testing]
    G --> H[Target Exploitation]
    H --> I[Post-Exploitation]
    I --> J[Documentation]
    
    E --> K[Search Databases]
    E --> L[Evaluate Exploits]
    E --> M[Adapt Code]
    
    style E fill:#FF9800
    style H fill:#f44336

8.2 Systematic Exploit Research Process

Step-by-Step Methodology

Step Action Tools Output
1 Service Identification Nmap, Banner Grabbing Service list
2 Version Detection Nmap -sV, WhatWeb Version info
3 CVE Research CVE Details, NVD CVE list
4 Exploit Search Searchsploit, GitHub Exploit candidates
5 Evaluation Code review, Metadata Ranked exploits
6 Lab Testing Isolated VM Test results
7 Adaptation Code modification Working exploit
8 Execution Target system Access achieved

8.3 Decision Making Framework

Exploit Selection Criteria

graph TD
    A[Multiple Exploits Found] --> B{Reliability Score}
    B -->|High| C{Ease of Use}
    B -->|Medium| D{Modification Needed}
    B -->|Low| E[Consider Alternative]
    
    C -->|Easy| F[Primary Choice]
    C -->|Complex| G[Secondary Choice]
    
    D -->|Minimal| H[Tertiary Choice]
    D -->|Extensive| I[Avoid]
    
    F --> J[Test in Lab]
    G --> J
    H --> J
    E --> K[Search Again]
    I --> K
    
    style F fill:#4CAF50
    style G fill:#FF9800
    style I fill:#f44336

Scoring System

Criterion Weight Score (1-5) Weighted Score
Reliability 30%
Version Match 25%
Ease of Use 20%
Documentation 15%
Community Feedback 10%
Total 100% Final Score

8.4 Integration with Tools

Automated Workflow

#!/bin/bash
# Exploit research automation script

# Input: Target IP and port
TARGET=$1
PORT=$2

# Step 1: Service detection
echo "=== Service Detection ==="
nmap -sV -p $PORT $TARGET > service_info.txt

# Step 2: Extract version info
VERSION=$(grep "Service Info" service_info.txt | awk '{print $3}')
echo "Detected version: $VERSION"

# Step 3: Search for exploits
echo "=== Searching for Exploits ==="
searchsploit "$VERSION" > exploits.txt

# Step 4: Filter reliable exploits
echo "=== Filtering Results ==="
grep -i "tested\|verified\|working" exploits.txt > reliable_exploits.txt

# Step 5: Display results
echo "=== Results ==="
cat reliable_exploits.txt

9. Exploit Library Management

9.1 Building a Personal Library

Directory Structure

exploit-library/
├── exploits/
│   ├── remote/
│   │   ├── web/
│   │   ├── network/
│   │   └── database/
│   ├── local/
│   │   ├── privilege_escalation/
│   │   └── post_exploitation/
│   └── denial_of_service/
├── tools/
│   ├── scanners/
│   ├── analyzers/
│   └── utilities/
├── research/
│   ├── notes/
│   ├── poc/
│   └── writeups/
└── documentation/
    ├── methodologies/
    ├── checklists/
    └── references/

Organization Principles

  • Categorization: Group by exploit type and target
  • Versioning: Track exploit versions and updates
  • Metadata: Include detailed information for each exploit
  • Testing Status: Mark tested vs. untested exploits
  • Success Rate: Track historical success rates

9.2 Documentation Standards

Exploit Documentation Template

# Exploit: [Name]

## Basic Information
- **CVE**: [CVE ID]
- **Author**: [Author Name]
- **Date**: [Publication Date]
- **Platform**: [Target Platform]
- **Type**: [Exploit Type]

## Technical Details
- **Vulnerability**: [Description]
- **Impact**: [Potential Impact]
- **CVSS**: [Score]

## Usage
```bash
# Usage example
python exploit.py [target] [port]

Testing Results

  • Tested On: [Environment]
  • Success Rate: [Percentage]
  • Notes: [Additional notes]

References

  • [Reference 1]
  • [Reference 2]

### 9.3 Tracking and Maintenance

#### Maintenance Schedule

| Task | Frequency | Description |
|------|-----------|-------------|
| Database Update | Weekly | Update exploit databases |
| Library Review | Monthly | Review and organize exploits |
| Testing | As needed | Test new exploits in lab |
| Documentation | Continuous | Update documentation |
| Cleanup | Quarterly | Remove outdated exploits |

#### Version Control

```bash
# Initialize git repository
cd exploit-library
git init

# Add initial structure
git add .
git commit -m "Initial exploit library structure"

# Regular updates
git add exploits/new_exploit.py
git commit -m "Add new exploit: Apache Path Traversal"

# Tag releases
git tag -a v1.0 -m "Version 1.0 release"

10. Exploit Formats

10.1 Python Exploits

Characteristics

  • Popularity: Most common exploit language
  • Readability: Easy to understand and modify
  • Portability: Cross-platform compatibility
  • Libraries: Rich ecosystem of security libraries

Common Libraries

Library Purpose Example Usage
socket Network communication Raw TCP/UDP connections
requests HTTP requests Web application testing
struct Binary data handling Protocol manipulation
subprocess Process execution System command execution
pwn (pwntools) Exploit development Buffer overflow exploitation

Example Structure

#!/usr/bin/env python3
"""
Exploit for [Vulnerability]
CVE: CVE-XXXX-XXXX
"""

import socket
import struct
import sys

def exploit(target, port):
    # Create socket connection
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((target, port))
    
    # Craft malicious payload
    payload = b"Malicious data here"
    
    # Send payload
    s.send(payload)
    
    # Receive response
    response = s.recv(1024)
    
    # Process response
    if b"Success" in response:
        print("Exploit successful!")
    
    s.close()

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print(f"Usage: {sys.argv[0]} <target> <port>")
        sys.exit(1)
    
    target = sys.argv[1]
    port = int(sys.argv[2])
    exploit(target, port)

10.2 Ruby Exploits

Characteristics

  • Metasploit Integration: Native Metasploit language
  • Web Focus: Strong web application support
  • Frameworks: Rich security frameworks
  • Community: Active security community

Common Frameworks

Framework Purpose Features
Metasploit Exploit framework Large exploit database
Rex Library Core utilities Network, encoding, crypto
Rack Web server Web application testing
Nokogiri HTML parsing Web scraping

Example Structure

#!/usr/bin/env ruby
# Exploit for [Vulnerability]
# CVE: CVE-XXXX-XXXX

require 'socket'
require 'base64'

def exploit(target, port)
  # Create socket connection
  socket = TCPSocket.new(target, port)
  
  # Craft payload
  payload = "Malicious payload"
  encoded_payload = Base64.encode64(payload)
  
  # Send request
  request = "GET /vulnerable?data=#{encoded_payload} HTTP/1.1\r\n"
  request += "Host: #{target}\r\n\r\n"
  
  socket.print(request)
  
  # Receive response
  response = socket.gets
  
  # Process response
  if response.include?("Success")
    puts "Exploit successful!"
  end
  
  socket.close
end

if __FILE__ == $0
  if ARGV.length != 2
    puts "Usage: #{$0} <target> <port>"
    exit(1)
  end
  
  target = ARGV[0]
  port = ARGV[1].to_i
  exploit(target, port)
end

10.3 Metasploit Modules

Module Structure

##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Exploit::Remote
  Rank = NormalRanking

  include Exploit::Remote::Tcp
  include Exploit::FileDropper

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'Example Vulnerability Exploit',
      'Description'    => %q{
        This module exploits a vulnerability in...
      },
      'Author'         => [
        'Your Name'
      ],
      'License'        => MSF_LICENSE,
      'References'     => [
        ['CVE', '2021-1234'],
        ['URL', 'https://example.com']
      ],
      'Privileged'     => false,
      'Platform'       => ['linux'],
      'Arch'           => ARCH_X86,
      'Targets'        => [
        ['Automatic', {}]
      ],
      'DefaultTarget'  => 0
    ))

    register_options([
      Opt::RPORT(80)
    ])
  end

  def check
    # Check if target is vulnerable
    # return CheckCode::Vulnerable, CheckCode::Safe, or CheckCode::Unknown
  end

  def exploit
    # Exploitation logic here
    print_status("Exploiting...")
    
    # Send malicious payload
    # Handle response
    # Spawn payload if successful
    
    handler
  end
end

Metasploit Integration

Component Description Usage
Handler Payload handler Reverse shell handling
Encoder Payload encoding Evasion techniques
Encoder Payload encoding Evasion techniques
Checker Vulnerability check Pre-exploitation verification
Options Module options Target configuration

10.4 Other Formats

C/C++ Exploits

  • Performance: Maximum execution speed
  • Low-Level: Direct memory manipulation
  • Complexity: Steeper learning curve
  • Use Cases: Kernel exploits, buffer overflows

PowerShell Exploits

  • Windows Focus: Native Windows scripting
  • Integration: Windows system integration
  • Evasion: Living-off-the-land techniques
  • Privilege: Windows privilege escalation

Bash Exploits

  • Linux Focus: Unix/Linux environments
  • Simplicity: Easy to understand
  • Integration: System command integration
  • Automation: Scripting capabilities

11. Quick Reference Tables

11.1 Resource Comparison

Resource Best For Update Frequency Quality Access
Exploit-DB General exploits Daily High Free
CVE Details CVE research Daily High Free
NVD Official CVE data Daily High Free
GitHub Latest research Real-time Variable Free
Packet Storm Tools and papers Regular High Free
0day.today Quick access Real-time Variable Free
SecurityFocus Historical data Regular Medium Free

11.2 Searchsploit Commands Reference

Command Description Example
searchsploit <term> Basic search searchsploit apache
searchsploit -m <id> Mirror exploit searchsploit -m 16891
searchsploit -w <term> Wildcard search searchsploit -w "apache"
searchsploit -p <platform> Platform filter searchsploit -p windows
searchsploit -t <type> Type filter searchsploit -t remote
searchsploit -x <file> Open in editor searchsploit -x 16891.py
searchsploit -j JSON output searchsploit -j apache
searchsploit --update Update database searchsploit --update

11.3 CVSS v3.1 Quick Reference

Metric Values Description
AV N/A/L/P Network/Adjacent/Local/Physical
AC H/L High/Low complexity
PR N/L/H None/Low/High privileges
UI N/R None/Required interaction
S U/C Unchanged/Changed scope
C N/L/H None/Low/High confidentiality
I N/L/H None/Low/High integrity
A N/L/H None/Low/High availability

11.4 Exploit Evaluation Checklist

Check Description Status
Version Match Target version matches exploit [ ]
Platform Match OS and architecture match [ ]
Code Quality Well-written and commented [ ]
Testing Status Tested on similar systems [ ]
Author Reputation Known security researcher [ ]
Recent Updates Updated for current versions [ ]
Dependencies Required libraries available [ ]
Legal Authorization Proper authorization obtained [ ]
Lab Testing Tested in isolated environment [ ]
Documentation Clear usage instructions [ ]

11.5 Common Exploit Types

Type Description Example
Remote Code Execution Execute code on remote system RCE via web app
Privilege Escalation Gain higher privileges User to root
SQL Injection Database manipulation Data extraction
XSS Client-side code execution Session hijacking
Buffer Overflow Memory corruption Code execution
Path Traversal File system access File read/write
Authentication Bypass Skip authentication Unauthorized access
Command Injection System command execution Remote commands

Summary and Key Takeaways

Essential Skills for OSCP

  1. Effective Search Techniques: Master search operators and databases
  2. Exploit Evaluation: Assess reliability and relevance systematically
  3. Code Understanding: Read and modify exploit code confidently
  4. Version Matching: Ensure exploit compatibility with targets
  5. Lab Testing: Always test in isolated environments first
  6. Documentation: Maintain detailed records of research and testing
  7. Legal Awareness: Understand authorization requirements
  8. Tool Mastery: Become proficient with Searchsploit and other tools

Study Recommendations

  • Practice Regularly: Search for exploits daily to build familiarity
  • Build Library: Create personal exploit collection with documentation
  • Lab Environment: Set up isolated testing environment
  • Code Review: Study exploit code to understand techniques
  • Stay Current: Follow security research and new vulnerabilities
  • Community Engagement: Participate in security communities
  • Legal Compliance: Always ensure proper authorization

Final Tips

  • Start Simple: Begin with well-documented, tested exploits
  • Understand Before Using: Never execute code you don’t understand
  • Document Everything: Keep detailed notes for future reference
  • Test Thoroughly: Verify exploits work in your environment
  • Stay Ethical: Follow responsible disclosure practices
  • Continuous Learning: Security landscape evolves constantly

This study guide provides a comprehensive foundation for locating and using public exploits in penetration testing. Remember that practical experience is crucial - apply these concepts in your lab environment to build real-world skills.