Exploit Library Management
Why this matters for OSCP: During the 23-hour exam, you will not have time to search the internet for exploits. A well-organized local exploit library lets you find, adapt, and deploy known exploits in minutes instead of hours. This chapter teaches you how to build, organize, and maintain that library so it becomes your most valuable exam asset.
Table of Contents
- Building a Personal Library
- Organization Principles
- Documentation Standards
- Tracking and Maintenance
- Version Control with Git
- Importing from Exploit-DB
- Tagging and Search
- Backup and Portability
- Legal Considerations for Storage
- Tools for Library Management
1. Building a Personal Library
Why You Need a Structured Library
During OSCP prep and the exam, you will encounter dozens of vulnerable services. For each one, you need to quickly locate relevant exploits, check if they apply to the target version, and adapt them if necessary. A flat folder full of random .py and .rb files is useless under pressure. A structured library turns chaos into a reliable workflow.
Recommended Directory Structure
exploit-library/
├── exploits/
│ ├── remote/
│ │ ├── web/
│ │ │ ├── apache/
│ │ │ ├── iis/
│ │ │ ├── nginx/
│ │ │ ├── tomcat/
│ │ │ └── wordpress/
│ │ ├── database/
│ │ │ ├── mysql/
│ │ │ ├── mssql/
│ │ │ ├── postgresql/
│ │ │ └── oracle/
│ │ ├── mail/
│ │ │ ├── exchange/
│ │ │ └── postfix/
│ │ ├── ftp/
│ │ ├── smb/
│ │ ├── rdp/
│ │ ├── ssh/
│ │ └── other/
│ └── local/
│ ├── privesc-linux/
│ │ ├── kernel/
│ │ ├── sudo/
│ │ ├── cron/
│ │ └── capabilities/
│ └── privesc-windows/
│ ├── ms16-032/
│ ├── ms17-010/
│ ├── se-debug-privilege/
│ └── services/
├── tools/
│ ├── scanners/
│ ├── scanners-output/
│ ├── post-exploitation/
│ └── utilities/
├── research/
│ ├── notes/
│ ├── poc/
│ └── writeups/
├── documentation/
│ ├── cheat-sheets/
│ ├── templates/
│ └── references/
├── scripts/
│ ├── import/
│ ├── search/
│ └── maintenance/
├── backups/
├── .gitignore
├── README.md
└── INDEX.md
Why This Structure Works
| Design Decision | Rationale |
|---|---|
| Remote vs. Local split | Matches the OSCP exam flow: you first gain remote access, then escalate locally. Separating them mirrors your mental model during the exam. |
| Protocol-based subfolders | When you see port 445 open, you go straight to exploits/remote/smb/. No guessing, no searching. |
| Platform-specific local privesc | Linux and Windows privilege escalation have completely different exploit families. Keeping them separate prevents confusion. |
| Tools directory | Keeps your custom scripts, modified exploits, and helper utilities in one place, separate from raw exploit downloads. |
| Research directory | Stores your notes, proof-of-concept tests, and writeups. Critical for learning from each engagement. |
| Documentation directory | Holds cheat sheets and templates you can reference during the exam without browsing the web. |
| Scripts directory | Automation for importing, searching, and maintaining the library. |
Minimal Viable Library
If you are starting from scratch and want something functional quickly, begin with this minimal structure:
exploit-library/
├── exploits/
│ ├── remote/
│ │ ├── web/
│ │ ├── smb/
│ │ └── other/
│ └── local/
│ ├── linux/
│ └── windows/
├── tools/
├── README.md
└── .gitignore
Expand from here as your collection grows.
2. Organization Principles
Categorization Strategies
Use multiple categorization axes so you can find exploits from different angles:
By Exploit Type
- Remote Code Execution (RCE) — Full shell from outside the network
- Local Privilege Escalation (LPE) — Elevate from low-priv to root/admin
- Authentication Bypass — Skip login entirely
- Information Disclosure — Leak sensitive data
- Denial of Service — Crash or disable a service (less useful for OSCP)
By Platform
- Linux (kernel version specific)
- Windows (build/patch level specific)
- macOS
- Cross-platform (Java, Python, etc.)
By Protocol/Service
- HTTP/HTTPS (web servers, applications)
- SMB/CIFS
- FTP
- SSH
- RDP
- Database protocols (MySQL, MSSQL, PostgreSQL)
- Mail protocols (SMTP, IMAP)
By Vulnerability Class
- Buffer Overflow (stack, heap, ROP)
- SQL Injection
- Command Injection
- Path Traversal
- Deserialization
- Authentication Bypass
- Misconfiguration
Versioning Exploits
Each exploit should carry version metadata. Use this convention:
exploit_name_v{major}.{minor}.{patch}.{adaptation}
| Version Part | Meaning |
|---|---|
major |
Original exploit version from the source |
minor |
Bug fixes or compatibility updates |
patch |
Minor tweaks (encoding, payload changes) |
adaptation |
Your personal modifications (e.g., target-specific changes) |
Example: ms17-010_eternalblue_v1.0.2.1 means the original v1 exploit, with 2 community fixes, and 1 of your own adaptations.
Metadata Tagging
Add a .meta file alongside each exploit with structured metadata:
# ms17-010_eternalblue_v1.0.2.1.meta
title: "MS17-010 EternalBlue SMB Remote Code Execution"
source: "Exploit-DB"
source_id: "49179"
author: "Hacker"
date_published: "2017-03-14"
date_imported: "2026-06-15"
date_last_tested: "2026-08-20"
platform: "Windows"
affected_versions: "Windows 2000 through Windows 10 (unpatched)"
vulnerability_class: "Remote Code Execution"
protocol: "SMB"
port: "445"
type: "remote"
language: "Python"
reliability: "high"
success_rate: "95%"
tested_targets:
- "Windows Server 2008 R2"
- "Windows 7 SP1"
notes: "Works reliably on unpatched targets. Requires admin-level access for full exploitation. Test with check_only=True first."
dependencies: "impacket"
Testing Status Tracking
Use a simple status system for each exploit:
| Status | Meaning | Action |
|---|---|---|
untested |
Newly imported, never tested | Test on a lab VM before trusting |
tested-working |
Verified on at least one target | Trust for exam use |
tested-partial |
Works with caveats | Note the caveats in metadata |
tested-failed |
Does not work as advertised | Keep for reference but do not rely on |
deprecated |
No longer relevant (patched everywhere) | Archive or remove |
needs-update |
Requires modification to work | Schedule time to fix |
Success Rate Recording
Track your personal success rate for each exploit:
Exploit: ms17-010_eternalblue
Attempts: 47
Successes: 45
Success Rate: 95.7%
Last Success: 2026-08-20
Common Failure Reasons:
- Target had AV that blocked the payload (2 cases)
- Network timeout on slow connections (1 case)
This data helps you prioritize which exploits to try first during the exam.
3. Documentation Standards
Exploit Documentation Template
Create a standard template for documenting each exploit. Store as EXPLOIT_TEMPLATE.md in your documentation folder:
# [Exploit Name]
## Overview
- **Title:** [Full title of the exploit]
- **CVE:** [CVE identifier if applicable]
- **Source:** [Exploit-DB / GitHub / etc.]
- **Source ID:** [Exploit-DB ID or GitHub URL]
- **Author:** [Original author]
- **Date Published:** [YYYY-MM-DD]
- **Date Imported:** [YYYY-MM-DD]
- **Date Last Tested:** [YYYY-MM-DD]
## Target Information
- **Platform:** [Windows / Linux / macOS / Cross-platform]
- **Affected Versions:** [Specific version range]
- **Service/Protocol:** [e.g., SMB, HTTP, SSH]
- **Default Port:** [Port number]
- **Vulnerability Class:** [RCE, LPE, Auth Bypass, etc.]
## Technical Details
- **Language:** [Python, Ruby, C, etc.]
- **Dependencies:** [Required libraries or tools]
- **Exploitation Method:** [Brief description of the technique]
- **Reliability:** [High / Medium / Low]
## Usage
```bash
# Example command to run the exploit
python exploit.py --target 10.10.10.10 --port 445
Testing Results
| Date | Target | Result | Notes |
|---|---|---|---|
| 2026-08-20 | Win2008 R2 | Success | Clean shell |
| 2026-07-15 | Win7 SP1 | Success | Required encoding tweak |
Modifications Made
- [List any changes you made to the original exploit]
Exam Relevance
- [How often this appears in OSCP-like targets]
- [Tips for using this exploit during the exam]
References
- [Links to original advisory, blog posts, etc.]
### Naming Conventions
Use consistent, descriptive filenames:
{vuln_id}_{brief_description}_v{version}.{ext}
Examples:
- `ms17-010_eternalblue_smb_rce_v1.0.2.py`
- `cve-2021-41773_printnightmare_privesc_v2.0.py`
- `cve-2024-3400_exchange_rce_v1.0.py`
- `linux_kernel_4.4_overlayfs_privesc_v1.0.c`
Rules:
1. Always start with CVE or MS number if available
2. Include the vulnerability type (rce, privesc, bypass)
3. Include version number
4. Use underscores, no spaces
5. Lowercase only
### README Structure
Your library's root `README.md` should contain:
```markdown
# Exploit Library
## Quick Start
1. Clone this repository
2. Install dependencies: `pip install -r requirements.txt`
3. Search for exploits: `./scripts/search/search.sh smb`
## Directory Structure
[Link to structure documentation]
## Statistics
- Total Exploits: [count]
- Remote Exploits: [count]
- Local Exploits: [count]
- Last Updated: [date]
## Most Used Exploits (Exam Favorites)
1. MS17-010 EternalBlue — SMB RCE
2. CVE-2019-0708 — ZeroLogon
3. CVE-2021-1675 — PrintNightmare
4. Linux Kernel OverlayFS Privesc
5. Sudo Buffer Overflow (CVE-2021-3156)
## Search Commands
```bash
# Find all SMB exploits
grep -rl "smb" exploits/
# Find all Windows privesc exploits
grep -rl "windows" exploits/local/privesc-windows/
# Find exploits by CVE
grep -rl "CVE-2021" exploits/
Maintenance Schedule
- Weekly: Pull new Exploit-DB content
- Monthly: Review and test top exploits
- Quarterly: Clean up deprecated exploits
---
## 4. Tracking and Maintenance
### Maintenance Schedule
| Frequency | Task | Details |
|---|---|---|
| **Weekly** | Import new exploits | Pull new content from Exploit-DB, categorize and tag |
| **Weekly** | Update metadata | Fill in `.meta` files for newly imported exploits |
| **Monthly** | Test top exploits | Re-test your most-used exploits against lab VMs to ensure they still work |
| **Monthly** | Review success rates | Update success/failure counts in tracking spreadsheet |
| **Quarterly** | Clean deprecated exploits | Remove or archive exploits that no longer apply to any realistic target |
| **Quarterly** | Update documentation | Refresh cheat sheets, update README statistics |
| **Before Exam** | Final audit | Verify all exam-relevant exploits are present, tested, and documented |
### What to Track for Each Exploit
Maintain a tracking spreadsheet (CSV or Excel) with these columns:
```csv
Exploit Name,Source ID,Type,Platform,Protocol,Last Tested,Status,Success Rate,Exam Relevance,Notes
ms17-010_eternalblue,49179,remote,Windows,SMB,2026-08-20,tested-working,95%,critical,Works on all unpatched Windows
cve-2019-0708_zeroconf,46286,remote,Windows,SMB,2026-08-18,tested-working,90%,critical,Domain controller takeover
cve-2021-1675_printnightmare,50670,local,Windows,RPC,2026-08-15,tested-working,85%,high,Needs RPC access
Exam Relevance Rating
Rate each exploit for OSCP relevance:
| Rating | Meaning | Examples |
|---|---|---|
| Critical | Appears frequently in OSCP targets | MS17-010, ZeroLogon, PrintNightmare |
| High | Common in exam-like machines | Sudo exploits, kernel privesc, Exchange RCE |
| Medium | Occasionally relevant | Specific web app exploits, older vulnerabilities |
| Low | Rarely useful for OSCP | Very new exploits, obscure services |
5. Version Control with Git
Initializing Your Repository
# Initialize the repository
cd ~/exploit-library
git init
# Create initial commit
git add README.md .gitignore
git commit -m "Initial commit: exploit library structure"
.gitignore for Exploit Libraries
# OS files
.DS_Store
Thumbs.db
desktop.ini
# Python
__pycache__/
*.py[cod]
*.egg-info/
*.egg
dist/
build/
*.so
# Node
node_modules/
# IDE
.vscode/
.idea/
# Sensitive files
*.key
*.pem
*.p12
*.pfx
secrets/
credentials/
*.env
# Large binaries (optional - use Git LFS instead if needed)
*.bin
*.exe
*.dll
# Test outputs
test-results/
*.log
# Backup files
*.bak
*.swp
*~
Commit Strategies
Follow a consistent commit message convention:
# Adding new exploits
git add exploits/remote/smb/
git commit -m "feat: add 5 new SMB exploits from Exploit-DB (IDs: 49179, 49389, 50123, 50456, 50789)"
# Updating an existing exploit
git add exploits/remote/smb/ms17-010_eternalblue_v1.0.2.py
git commit -m "fix: update ms17-010 to v1.0.2 - fix encoding issue on Windows 2012"
# Adding documentation
git add documentation/cheat-sheets/smb-cheatsheet.md
git commit -m "docs: add SMB exploitation cheat sheet"
# Maintenance cleanup
git add exploits/remote/other/
git commit -m "chore: archive 12 deprecated exploits from 2015 and earlier"
# Testing updates
git add exploits/local/privesc-linux/kernel/linux_kernel_4.4_overlayfs_v1.0.meta
git commit -m "test: update overlayfs metadata - verified on Ubuntu 16.04"
Tagging Releases
Use tags to mark significant milestones:
# Tag your exam-ready version
git tag -a "v1.0-exam-ready" -m "Exam-ready exploit library - 200+ verified exploits"
# Tag after major updates
git tag -a "v1.1-post-exam" -m "Post-exam update with new findings"
# Push tags to remote
git push origin --tags
Branching for Experiments
# Create a branch for testing new exploits
git checkout -b experiment/new-smb-exploits
# Test and modify
# ... make changes ...
# If successful, merge back
git checkout main
git merge experiment/new-smb-exploits
# If not, discard
git branch -D experiment/new-smb-exploits
6. Importing from Exploit-DB
Manual Import Process
- Search Exploit-DB for relevant exploits
- Download the exploit file
- Rename using your naming convention
- Place in the correct directory
- Create a
.metafile - Commit to Git
Automated Import Script
Create scripts/import/import_exploitdb.py:
#!/usr/bin/env python3
"""
Import exploits from Exploit-DB search results into your organized library.
Usage: python3 import_exploitdb.py --search "smb remote" --output exploits/remote/smb/
"""
import os
import sys
import json
import argparse
import re
from datetime import datetime
def categorize_exploit(title, platform, description):
"""Determine the target directory based on exploit metadata."""
title_lower = title.lower()
desc_lower = description.lower() if description else ""
# Determine type (remote vs local)
is_local = any(kw in desc_lower for kw in ["local", "privilege escalation", "privesc", "lpe"])
exploit_type = "local" if is_local else "remote"
# Determine platform
is_windows = "windows" in platform.lower() if platform else "windows" in title_lower
is_linux = "linux" in platform.lower() if platform else "linux" in title_lower
# Determine subcategory
if "smb" in title_lower or "cifs" in title_lower:
subdir = "smb"
elif "http" in title_lower or "web" in title_lower or "apache" in title_lower:
subdir = "web"
elif "ftp" in title_lower:
subdir = "ftp"
elif "ssh" in title_lower:
subdir = "ssh"
elif "rdp" in title_lower:
subdir = "rdp"
elif "mysql" in title_lower or "mariadb" in title_lower:
subdir = "database/mysql"
elif "mssql" in title_lower or "sql server" in title_lower:
subdir = "database/mssql"
elif "exchange" in title_lower or "smtp" in title_lower:
subdir = "mail/exchange"
elif is_local and is_windows:
subdir = "local/privesc-windows"
elif is_local and is_linux:
subdir = "local/privesc-linux"
else:
subdir = "other"
return f"exploits/{exploit_type}/{subdir}"
def sanitize_filename(name):
"""Convert a title to a safe filename."""
name = name.lower().replace(" ", "_")
name = re.sub(r'[^a-z0-9_\-]', '', name)
name = re.sub(r'_+', '_', name)
return name[:100] # Limit length
def create_meta_file(exploit_path, metadata):
"""Create a .meta file for the exploit."""
meta_path = exploit_path + ".meta"
with open(meta_path, 'w') as f:
f.write(f"title: \"{metadata.get('title', '')}\"\n")
f.write(f"source: \"Exploit-DB\"\n")
f.write(f"source_id: \"{metadata.get('id', '')}\"\n")
f.write(f"author: \"{metadata.get('author', '')}\"\n")
f.write(f"date_published: \"{metadata.get('date', '')}\"\n")
f.write(f"date_imported: \"{datetime.now().strftime('%Y-%m-%d')}\"\n")
f.write(f"date_last_tested: \"\"\n")
f.write(f"platform: \"{metadata.get('platform', '')}\"\n")
f.write(f"vulnerability_class: \"{metadata.get('type', '')}\"\n")
f.write(f"reliability: \"unknown\"\n")
f.write(f"success_rate: \"N/A\"\n")
f.write(f"tested_targets: []\n")
f.write(f"notes: \"Imported automatically - needs manual testing\"\n")
return meta_path
def main():
parser = argparse.ArgumentParser(description="Import exploits from Exploit-DB")
parser.add_argument("--search", required=True, help="Search query for Exploit-DB")
parser.add_argument("--output", default="exploits/", help="Base output directory")
parser.add_argument("--dry-run", action="store_true", help="Show what would be imported")
args = parser.parse_args()
print(f"[+] Searching Exploit-DB for: {args.search}")
print(f"[+] Output base directory: {args.output}")
# In a real implementation, you would:
# 1. Use the Exploit-DB API or search interface
# 2. Parse results
# 3. Categorize each exploit
# 4. Download and save with proper naming
# 5. Create metadata files
# 6. Generate an import summary
print("[+] Import script template - implement API integration as needed")
print("[+] Remember to test each imported exploit before marking as 'tested-working'")
if __name__ == "__main__":
main()
Using searchsploit with Your Library
# Search Exploit-DB locally (requires searchsploit installed)
searchsploit -m "MS17-010" ~/exploit-library/exploits/remote/smb/
# Search and copy with automatic categorization
searchsploit -m --exploit-path ~/exploit-library/exploits/ "smb windows"
# List matching exploits without downloading
searchsploit "exchange rce"
7. Tagging and Search
Making Your Library Searchable
Using grep for Quick Searches
# Find all exploits mentioning a specific CVE
grep -rl "CVE-2021-1675" exploits/
# Find all Python exploits
grep -rl "windows" exploits/ | xargs grep -l "python"
# Find all SMB exploits with "remote" in the path
find exploits/remote/smb/ -type f -name "*.py"
# Search metadata files for high-reliability exploits
grep -rl "reliability: high" exploits/ --include="*.meta"
# Find exploits tested after a certain date
grep -rl "date_last_tested: 2026" exploits/ --include="*.meta"
# Count exploits by type
find exploits/ -name "*.py" | wc -l
find exploits/remote/ -name "*.py" | wc -l
find exploits/local/ -name "*.py" | wc -l
Building an Index
Create scripts/search/build_index.py:
#!/usr/bin/env python3
"""
Build a searchable index of all exploits in the library.
Generates INDEX.md at the root of the library.
"""
import os
import glob
from datetime import datetime
def parse_meta(meta_path):
"""Parse a .meta file into a dictionary."""
data = {}
try:
with open(meta_path, 'r') as f:
for line in f:
line = line.strip()
if ':' in line and not line.startswith('#'):
key, _, value = line.partition(':')
data[key.strip()] = value.strip().strip('"')
except Exception:
pass
return data
def build_index():
"""Build the exploit index."""
exploits = []
# Find all .meta files
for meta_file in glob.glob("exploits/**/*.meta", recursive=True):
meta = parse_meta(meta_file)
exploit_file = meta_file.replace('.meta', '')
if os.path.exists(exploit_file):
exploits.append({
'file': exploit_file,
'title': meta.get('title', os.path.basename(exploit_file)),
'source_id': meta.get('source_id', 'N/A'),
'type': meta.get('vulnerability_class', 'Unknown'),
'platform': meta.get('platform', 'Unknown'),
'status': meta.get('reliability', 'untested'),
'last_tested': meta.get('date_last_tested', 'Never'),
})
# Sort by last tested date
exploits.sort(key=lambda x: x['last_tested'], reverse=True)
# Generate INDEX.md
with open("INDEX.md", 'w') as f:
f.write("# Exploit Library Index\n\n")
f.write(f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
f.write(f"Total Exploits: {len(exploits)}\n\n")
f.write("## Quick Stats\n\n")
f.write(f"- Remote Exploits: {sum(1 for e in exploits if 'remote' in e['file'])}\n")
f.write(f"- Local Exploits: {sum(1 for e in exploits if 'local' in e['file'])}\n")
f.write(f"- Tested & Working: {sum(1 for e in exploits if 'working' in e['status'])}\n")
f.write(f"- Untested: {sum(1 for e in exploits if 'untested' in e['status'])}\n\n")
f.write("## Exploit List\n\n")
f.write("| File | Title | Type | Platform | Status | Last Tested |\n")
f.write("|---|---|---|---|---|---|\n")
for e in exploits:
f.write(f"| `{e['file']}` | {e['title'][:50]} | {e['type']} | {e['platform']} | {e['status']} | {e['last_tested']} |\n")
print(f"[+] Index generated: INDEX.md ({len(exploits)} exploits)")
if __name__ == "__main__":
build_index()
Tag-Based Search Strategy
Create a tag file for each exploit that lists all applicable tags:
# ms17-010_eternalblue_v1.0.2.tags
smb
windows
remote
rce
critical
exam-favorite
ms17-010
eternalblue
cve-2017-0144
python
Then search by tag:
# Find all critical exam exploits
grep -rl "critical" exploits/ --include="*.tags" | sed 's/\.tags$//'
# Find all Windows privesc exploits
grep -rl "privesc" exploits/local/ --include="*.tags" | sed 's/\.tags$//'
# Find all Python-based exploits
grep -rl "python" exploits/ --include="*.tags" | sed 's/\.tags$//'
8. Backup and Portability
Accessing Your Library Across Machines
Option 1: Git Remote (Recommended)
# Push to a private Git repository (GitHub, GitLab, Bitbucket)
git remote add origin git@github.com:yourusername/exploit-library.git
git push -u origin main
# On another machine
git clone git@github.com:yourusername/exploit-library.git
cd exploit-library
Warning: Never push exploit libraries to a public repository. Use private repos only.
Option 2: Cloud Storage Sync
Use a cloud storage service with selective sync:
# Sync only the exploit library folder
# Configure your cloud client (OneDrive, Dropbox, etc.) to sync this folder
# Ensure .git directory is excluded from cloud sync to avoid conflicts
Option 3: USB Portable Setup
For exam environments where you cannot access the internet:
# Create a portable archive
cd ~/exploit-library
tar czf exploit-library-portable.tar.gz --exclude='.git' .
# On exam machine
tar xzf exploit-library-portable.tar.gz
cd exploit-library
Backup Strategy
| Backup Type | Frequency | Method | Retention |
|---|---|---|---|
| Git commits | Every change | Automatic via Git | Infinite (full history) |
| Cloud backup | Weekly | Git push to private remote | Latest + 4 weekly snapshots |
| USB archive | Before exam | tar.gz archive | Keep last 3 versions |
| Full snapshot | Monthly | Compressed archive to external drive | Keep last 6 months |
Pre-Exam Checklist
Before the OSCP exam, verify:
- All critical exploits are present and tested
- Library is backed up to at least 2 locations
- USB portable version is created and tested
- INDEX.md is up to date
- All
.metafiles are complete for exam-relevant exploits - No sensitive credentials or personal data in the repository
-
.gitignoreis properly configured
9. Legal Considerations for Storage
What You Can Store
| Content | Legal Status | Notes |
|---|---|---|
| Public exploits from Exploit-DB | Generally legal | These are publicly available research documents |
| CVE descriptions and advisories | Legal | Public security information |
| Your own modified exploits | Legal | Your own work, for authorized testing |
| Proof-of-concept code | Legal | Educational and research purposes |
| Cheat sheets and notes | Legal | Your own documentation |
What You Should Avoid Storing
| Content | Risk | Reason |
|---|---|---|
| Exploits from private/leaked sources | High | May violate NDA or copyright |
| Credentials or access tokens | High | Security risk and potential legal issues |
| Data from unauthorized targets | Very High | Illegal in most jurisdictions |
| Commercial exploit tools (pirated) | High | Copyright violation |
| Zero-day exploits (unpublished) | Variable | May be subject to disclosure policies |
Jurisdiction Considerations
- United States: Storing publicly available exploits for authorized testing is generally legal under the DMCA exemptions for security research
- European Union: The EU Cybersecurity Act supports responsible vulnerability research; storing exploits for authorized testing is acceptable
- China: Strict regulations on cybersecurity tools; ensure all stored exploits are for authorized testing only
- General Rule: Always ensure you have proper authorization before using any exploit against any system. Storing exploits for educational and authorized testing purposes is widely accepted.
Best Practices
- Never store exploits obtained from illegal sources
- Keep a record of where each exploit came from (source URL, date obtained)
- Use private repositories only — never make your exploit library public
- Remove any sensitive data before backing up or sharing
- Follow your employer’s policies on storing security research materials
- When in doubt, consult legal counsel — this is not legal advice
10. Tools for Library Management
Essential Tools
| Tool | Purpose | Installation |
|---|---|---|
| Git | Version control | apt install git or download from git-scm.com |
| searchsploit | Exploit-DB search and download | sudo apt install exploitdb |
| grep / ripgrep | Search within library | Pre-installed on most systems |
| fd | Fast file finder | cargo install fd-find |
| bat | Enhanced cat with syntax highlighting | cargo install bat |
| fzf | Fuzzy finder for quick navigation | apt install fzf |
Custom Management Scripts
Quick Search Script
Create scripts/search/quick_search.sh:
#!/bin/bash
# Quick search across the exploit library
# Usage: ./quick_search.sh "smb"
QUERY="$1"
if [ -z "$QUERY" ]; then
echo "Usage: $0 <search_query>"
echo "Examples:"
echo " $0 smb"
echo " $0 windows privesc"
echo " $0 CVE-2021"
exit 1
fi
echo "=== Searching for: $QUERY ==="
echo ""
echo "--- Exploit Files ---"
grep -rl "$QUERY" exploits/ --include="*.py" --include="*.rb" --include="*.c" --include="*.pl" 2>/dev/null | head -20
echo ""
echo "--- Metadata Files ---"
grep -rl "$QUERY" exploits/ --include="*.meta" 2>/dev/null | head -20
echo ""
echo "--- Tag Files ---"
grep -rl "$QUERY" exploits/ --include="*.tags" 2>/dev/null | head -20
echo ""
echo "--- Documentation ---"
grep -rl "$QUERY" documentation/ 2>/dev/null | head -10
Library Statistics Script
Create scripts/maintenance/stats.sh:
#!/bin/bash
# Display exploit library statistics
echo "=== Exploit Library Statistics ==="
echo ""
echo "Total exploit files: $(find exploits/ -type f \( -name '*.py' -o -name '*.rb' -o -name '*.c' -o -name '*.pl' \) | wc -l)"
echo "Remote exploits: $(find exploits/remote/ -type f \( -name '*.py' -o -name '*.rb' -o -name '*.c' -o -name '*.pl' \) | wc -l)"
echo "Local exploits: $(find exploits/local/ -type f \( -name '*.py' -o -name '*.rb' -o -name '*.c' -o -name '*.pl' \) | wc -l)"
echo ""
echo "By status:"
echo " Tested & Working: $(grep -rl 'tested-working' exploits/ --include='*.meta' 2>/dev/null | wc -l)"
echo " Untested: $(grep -rl 'untested' exploits/ --include='*.meta' 2>/dev/null | wc -l)"
echo " Needs Update: $(grep -rl 'needs-update' exploits/ --include='*.meta' 2>/dev/null | wc -l)"
echo " Deprecated: $(grep -rl 'deprecated' exploits/ --include='*.meta' 2>/dev/null | wc -l)"
echo ""
echo "By platform:"
echo " Windows: $(grep -rl 'Windows' exploits/ --include='*.meta' 2>/dev/null | wc -l)"
echo " Linux: $(grep -rl 'Linux' exploits/ --include='*.meta' 2>/dev/null | wc -l)"
echo ""
echo "Git commits: $(git log --oneline | wc -l)"
echo "Last commit: $(git log -1 --format='%h %s %ai')"
Database-Backed Management (Advanced)
For very large collections (500+ exploits), consider using a lightweight database:
#!/usr/bin/env python3
"""
SQLite-based exploit library manager.
Provides fast searching, filtering, and reporting.
"""
import sqlite3
import os
import glob
from datetime import datetime
DB_PATH = "exploit_library.db"
def init_db():
"""Initialize the database schema."""
conn = sqlite3.connect(DB_PATH)
c = conn.cursor()
c.execute('''
CREATE TABLE IF NOT EXISTS exploits (
id INTEGER PRIMARY KEY AUTOINCREMENT,
filename TEXT UNIQUE,
title TEXT,
source_id TEXT,
exploit_type TEXT,
platform TEXT,
protocol TEXT,
port TEXT,
vulnerability_class TEXT,
language TEXT,
reliability TEXT,
success_rate TEXT,
status TEXT,
date_imported TEXT,
date_last_tested TEXT,
notes TEXT,
tags TEXT
)
''')
conn.commit()
return conn
def scan_and_import(conn):
"""Scan the exploits directory and import metadata into the database."""
c = conn.cursor()
count = 0
for meta_file in glob.glob("exploits/**/*.meta", recursive=True):
meta = {}
with open(meta_file, 'r') as f:
for line in f:
if ':' in line and not line.startswith('#'):
key, _, value = line.partition(':')
meta[key.strip()] = value.strip().strip('"')
exploit_file = meta_file.replace('.meta', '')
tags_file = meta_file.replace('.meta', '.tags')
tags = ""
if os.path.exists(tags_file):
with open(tags_file, 'r') as f:
tags = ",".join([t.strip() for t in f.readlines() if t.strip()])
c.execute('''
INSERT OR REPLACE INTO exploits
(filename, title, source_id, exploit_type, platform, protocol, port,
vulnerability_class, language, reliability, success_rate, status,
date_imported, date_last_tested, notes, tags)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
''', (
exploit_file,
meta.get('title', ''),
meta.get('source_id', ''),
'remote' if 'remote' in exploit_file else 'local',
meta.get('platform', ''),
meta.get('protocol', ''),
meta.get('port', ''),
meta.get('vulnerability_class', ''),
meta.get('language', ''),
meta.get('reliability', ''),
meta.get('success_rate', ''),
meta.get('reliability', 'untested'),
meta.get('date_imported', ''),
meta.get('date_last_tested', ''),
meta.get('notes', ''),
tags
))
count += 1
conn.commit()
print(f"[+] Imported {count} exploits into database")
def search(conn, query, field="title"):
"""Search the database for exploits matching a query."""
c = conn.cursor()
c.execute(f"SELECT filename, title, platform, status FROM exploits WHERE {field} LIKE ? OR tags LIKE ?",
(f"%{query}%", f"%{query}%"))
results = c.fetchall()
if not results:
print(f"No results found for: {query}")
return
print(f"\nFound {len(results)} results for '{query}':\n")
print(f"{'File':<50} {'Title':<40} {'Platform':<10} {'Status':<15}")
print("-" * 115)
for r in results:
print(f"{r[0]:<50} {r[1][:38]:<40} {r[2]:<10} {r[3]:<15}")
if __name__ == "__main__":
conn = init_db()
scan_and_import(conn)
# Example searches
search(conn, "smb")
search(conn, "windows", "platform")
search(conn, "critical", "tags")
conn.close()
Recommended Tool Stack for OSCP Prep
| Category | Tool | Why |
|---|---|---|
| Version Control | Git | Industry standard, free, portable |
| Exploit Search | searchsploit | Direct Exploit-DB integration |
| File Search | fd + fzf | Fast, fuzzy, keyboard-driven |
| Text Search | ripgrep (rg) | Blazing fast grep replacement |
| Viewing | bat | Syntax-highlighted file viewing |
| Documentation | Markdown + VS Code | Simple, universal, easy to search |
| Database | SQLite (optional) | Fast queries for large collections |
| Backup | Git remote + tar.gz | Redundant, portable, versioned |
Summary
A well-managed exploit library is one of the most valuable assets for OSCP success. The key principles are:
- Structure matters — Use a consistent directory hierarchy that mirrors your exam workflow
- Document everything — Metadata files and standardized templates save hours during the exam
- Track what works — Success rates and testing status help you prioritize under pressure
- Version control — Git gives you history, branching, and backup in one tool
- Automate what you can — Import scripts, search tools, and index builders keep the library maintainable
- Stay legal — Only store publicly available exploits for authorized testing
- Keep it portable — USB archives and cloud backups ensure access wherever you need it
Start building your library today. Even a small, well-organized collection of 20-30 verified exploits will give you a significant advantage during OSCP preparation and the exam itself.
Quick Reference: OSCP-Critical Exploits to Include
| Exploit | Type | Platform | Exam Frequency |
|---|---|---|---|
| MS17-010 EternalBlue | Remote RCE | Windows | Very High |
| CVE-2019-0708 ZeroLogon | Remote RCE | Windows DC | High |
| CVE-2021-1675 PrintNightmare | Local Privesc | Windows | High |
| CVE-2021-3156 Sudo Baron Samedit | Local Privesc | Linux | Medium |
| Linux Kernel OverlayFS | Local Privesc | Linux | Medium |
| Exchange ProxyLogon | Remote RCE | Windows | Medium |
| CVE-2024-3400 Exchange | Remote RCE | Windows | Emerging |
| Dirty COW (CVE-2016-5195) | Local Privesc | Linux | Low (old kernels) |
| CVE-2021-41773 PrintNightmare v2 | Local Privesc | Windows | Medium |
Focus your library on these high-frequency exploits first, then expand based on the targets you encounter during practice.