Service Version Detection
Attack Chain Position
graph LR
A[Reconnaissance] --> B[Port Scanning]
B --> C[Service Detection]
C --> D[Version Detection]
D --> E[Vulnerability Research]
E --> F[Exploitation]
style D fill:#f9d56e,stroke:#c79632,stroke-width:3px
Where we are: After discovering open ports and identifying running services, version detection pinpoints the exact software version. This transforms a generic “HTTP service on port 80” into “Apache httpd 2.4.49 on Ubuntu” — a specific target for known exploits.
Why Service Detection Matters
The Power of Specificity
In penetration testing, the difference between knowing a service exists and knowing its exact version is the difference between a blind guess and a targeted attack. Here’s why:
| Generic Knowledge | Version-Specific Knowledge | Impact |
|---|---|---|
| “SSH is running” | “OpenSSH 7.2p2 on Ubuntu” | Can target CVE-2016-0777 (authentication bypass) |
| “HTTP server” | “Apache 2.4.49” | Can target CVE-2021-41773 (path traversal) |
| “FTP service” | “vsftpd 2.3.4” | Can target the famous backdoor (CVE-2011-2523) |
| “SMB service” | “Samba 3.5.0” | Can target CVE-2007-2447 (remote code execution) |
| “MySQL running” | “MySQL 5.5.21a” | Can target CVE-2012-2122 (heap overflow) |
Real OSCP Lab Examples
- DC-1: Apache 2.4.10 + WordPress 4.6 → WPScan plugin exploitation
- HackTheBox - Lame: Samba 3.0.20-Debian → CVE-2007-2447 remote code execution
- HackTheBox - Blunder: Apache 2.4.18 + PHP 7.1.12 → PHP object injection
- PentesterLab - Easy1: Apache 2.4.10 + PHP 5.5.9 → Source code disclosure
- MicroBuild: Apache 2.4.18 + PHP 7.0.13 → PHP deserialization
The Version-to-Exploit Pipeline
flowchart TD
A[Discover Open Port] --> B[Identify Service]
B --> C[Detect Exact Version]
C --> D{Known Vulns?}
D -->|Yes| E[Search Exploit-DB / CVE]
D -->|No| F[Search for Misconfigurations]
E --> G[Evaluate Exploit Reliability]
G --> H{Exploit Works?}
H -->|Yes| I[Gain Access]
H -->|No| J[Try Alternative Exploit]
J --> G
F --> K[Test Default Credentials]
K --> L[Test Service Misconfigs]
Nmap Version Detection Deep Dive
The -sV Flag
The -sV flag enables version detection in Nmap. When used, Nmap probes each open port with a series of probes designed to elicit version-specific responses.
# Basic version detection
nmap -sV <target>
# Version detection with service detection on all ports
nmap -sV -p- <target>
# Aggressive scan with version detection
nmap -A -sV <target>
# Version detection with output to file
nmap -sV -oN nmap_version_scan.txt <target>
How Nmap Version Detection Works
Nmap’s version detection engine follows a sophisticated probing strategy:
- Probe Selection: Nmap maintains a library of probes (
nmap-service-probes) containing known request patterns for different service types - Fingerprint Matching: Responses are matched against a database of known service fingerprints (
nmap-service-lines) - Confidence Rating: Each match receives a confidence score (1-10) based on how well the response matches the expected fingerprint
- Progressive Probing: If initial probes fail, Nmap escalates to more aggressive probes
Version Detection Output Interpretation
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.10 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
443/tcp open ssl/http Apache httpd 2.4.18 ((Ubuntu))
3306/tcp open mysql MySQL 5.7.21-0ubuntu0.16.04.1
Output Fields Explained:
| Field | Description | Example |
|---|---|---|
| Port | TCP/UDP port number | 22/tcp |
| State | Port state | open, closed, filtered |
| Service | Detected service name | ssh, http, mysql |
| Version | Exact version string | OpenSSH 7.2p2 |
| OS Hint | Operating system hint | Ubuntu Linux |
| Protocol | Protocol version | protocol 2.0 |
Version Detection Intensity Levels
Nmap supports intensity levels from 0 to 7, controlling the aggressiveness and thoroughness of version detection:
# Set intensity level (0-7)
nmap -sV --version-intensity 5 <target>
# Use maximum intensity
nmap -sV --version-all <target>
Intensity Level Comparison Table
| Level | Description | Time | Accuracy | Use Case |
|---|---|---|---|---|
| 0 | Lightest, only the most common probes | Fastest | Lowest | Quick reconnaissance, time-constrained |
| 1-2 | Minimal probing, basic service identification | Fast | Low | Initial triage, large target lists |
| 3 | Default level, balanced approach | Medium | Medium | General purpose scanning |
| 4-5 | Extended probing, more service types | Slow | High | Detailed assessment, medium priority targets |
| 6 | Very thorough, rare service probes | Very Slow | Very High | Critical targets, thorough assessments |
| 7 | Maximum intensity, all probes including TCP connect | Slowest | Highest | When accuracy is critical, --version-all |
Intensity Level Details
# Level 0 - Quick check, only most common services
nmap -sV --version-intensity 0 <target>
# Level 3 - Default (used when -sV is specified without --version-intensity)
nmap -sV --version-intensity 3 <target>
# Level 5 - Extended probing for less common services
nmap -sV --version-intensity 5 <target>
# Level 7 - All probes, including expensive TCP connect scans
nmap -sV --version-intensity 7 <target>
# Equivalent to level 7
nmap -sV --version-all <target>
Time vs Accuracy Tradeoff
xychart-beta
title "Version Detection: Time vs Accuracy Tradeoff"
x-axis [0, 1, 2, 3, 4, 5, 6, 7]
y-axis "Relative Value" 0 --> 100
line [10, 20, 30, 50, 65, 80, 90, 100]
line [5, 10, 15, 30, 50, 70, 85, 100]
- Line 1 (Accuracy): Increases steadily with intensity
- Line 2 (Time): Increases exponentially with intensity
Recommendation for OSCP:
- Start with default (
-sV) for initial scans - Use
--version-intensity 5-7on specific ports when default fails - Reserve
--version-allfor stubborn services
Advanced Nmap Version Detection Techniques
# Version detection with specific port range
nmap -sV -p 1-1024 <target>
# Version detection with timing template
nmap -sV -T4 <target>
# Version detection with retry count
nmap -sV --version-tries 5 <target>
# Version detection with light weight
nmap -sV --version-light <target>
# Version detection with specific probe
nmap -sV --version-all --reason <target>
# Combine with script scanning for deeper analysis
nmap -sV --script "version*,banner*" <target>
Nmap Version Detection Scripts
# Banner grabbing scripts
nmap --script "banner,http-headers,ssh2-protocol-version" -p 22,80,443 <target>
# Service enumeration scripts
nmap --script "http-enum,http-title,http-server-header" -p 80,443 <target>
# Version-specific vulnerability scripts
nmap --script "vuln" -sV <target>
# All HTTP-related scripts
nmap --script "http*" -p 80,443,8080,8443 <target>
Manual Service Banner Grabbing
When Nmap fails or you need more detailed information, manual banner grabbing is essential. This technique involves directly connecting to services and reading their initial responses.
Why Manual Banner Grabbing?
- Nmap may misidentify services behind proxies or firewalls
- Some services reveal version info only through specific commands
- Manual interaction can reveal additional configuration details
- Helps verify Nmap findings
- Works when automated tools are blocked
Essential Tools
| Tool | Purpose | Best For |
|---|---|---|
nc (netcat) |
Raw TCP connections | All TCP services |
curl |
HTTP/HTTPS requests | Web services |
telnet |
Interactive TCP sessions | Legacy services |
openssl s_client |
TLS/SSL connections | Encrypted services |
python |
Custom scripts | Complex interactions |
HTTP Banner Grabbing
Using curl
# Basic HTTP request to get server header
curl -I http://<target>:80
# Follow redirects and show headers
curl -IL http://<target>:80
# Get full response with verbose output
curl -v http://<target>:80
# Check HTTPS with verbose output
curl -vk https://<target>:443
# Get server header only
curl -I http://<target>:80 2>/dev/null | grep -i server
# Check for specific paths that reveal version info
curl -I http://<target>:80/server-status
curl -I http://<target>:80/server-info
curl -I http://<target>:80/phpinfo.php
curl -I http://<target>:80/info.php
Using nc
# Basic HTTP request via netcat
echo -e "GET / HTTP/1.1\r\nHost: <target>\r\n\r\n" | nc <target> 80
# With connection close
(echo -e "GET / HTTP/1.1\r\nHost: <target>\r\nConnection: close\r\n\r\n"; sleep 1) | nc <target> 80
# Check multiple ports
for port in 80 8080 8443 8000 3000; do
echo "=== Port $port ==="
echo -e "GET / HTTP/1.1\r\nHost: <target>\r\nConnection: close\r\n\r\n" | nc -w 2 <target> $port
echo ""
done
Interpreting HTTP Headers
HTTP/1.1 200 OK
Date: Mon, 01 Sep 2026 12:00:00 GMT
Server: Apache/2.4.49 (Ubuntu)
X-Powered-By: PHP/7.4.3
X-AspNet-Version: 4.0.30319
X-Generator: WordPress/5.8
Content-Type: text/html; charset=UTF-8
| Header | Information Revealed | Example |
|---|---|---|
Server |
Web server software and version | Apache/2.4.49 (Ubuntu) |
X-Powered-By |
Backend technology | PHP/7.4.3, ASP.NET |
X-Generator |
CMS or framework | WordPress/5.8, Drupal/9.1 |
X-AspNet-Version |
.NET version | 4.0.30319 |
X-Drupal-Cache |
Drupal presence | MISS |
X-WP-Total |
WordPress presence | 12 |
SSH Banner Grabbing
# Using nc to grab SSH banner
nc -v <target> 22
# Using nmap for SSH version
nmap -p 22 --script "ssh2-protocol-version,ssh-hostkey" <target>
# Using ssh client
ssh -v <target> 2>&1 | head -20
# Using python
python3 -c "
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('<target>', 22))
banner = s.recv(1024).decode()
print(banner)
s.close()
"
SSH Banner Format:
SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
SSH-2.0-SSHDD-1.28.0.48
| Banner Component | Meaning |
|---|---|
SSH-2.0 |
SSH protocol version |
OpenSSH_7.2p2 |
Software and version |
Ubuntu-4ubuntu2.10 |
Distribution-specific patch level |
SMTP Banner Grabbing
# Basic SMTP banner
nc -v <target> 25
# SMTP with EHLO command
(echo "EHLO test.com"; sleep 1; echo "QUIT") | nc <target> 25
# SMTP with STARTTLS
(echo "EHLO test.com"; sleep 1; echo "STARTTLS"; sleep 1) | nc <target> 25
# Check multiple SMTP ports
for port in 25 465 587; do
echo "=== Port $port ==="
nc -w 2 <target> $port
echo ""
done
SMTP Banner Examples:
220 mail.example.com ESMTP Postfix
220 SERVER Microsoft ESMTP MAIL Service, Version: 8.0.685.21.
220 mx.google.com ESMTP x12si1234567pjb.0
FTP Banner Grabbing
# Basic FTP banner
nc -v <target> 21
# FTP with USER command
(echo "USER anonymous"; sleep 1; echo "PASS anonymous@"; sleep 1) | nc <target> 21
# FTP with SYST command
(echo "SYST"; sleep 1; echo "QUIT") | nc <target> 21
# Using curl for FTP
curl -v ftp://<target>:21/
FTP Banner Examples:
220 (vsFTPd 3.0.3)
220 (vsFTPd 2.3.4) <-- Famous backdoor version!
220 Microsoft FTP Service
220 ProFTPD 1.3.5a Server
SMB Banner Grabbing
# Using nmap
nmap -p 445 --script "smb-protocols,smb2-security-mode,smb-os-discovery" <target>
# Using rpcclient
rpcclient -U "" <target>
# Using nbtscan
nbtscan -r <target>
# Using smbclient
smbclient -L \\\\<target> -U ""
# Using crackmapexec
crackmapexec smb <target>
# Using impacket
impacket-smbclient ''@<target>
impacket-smbversion <target>
MySQL Banner Grabbing
# Using nc (MySQL protocol handshake)
nc -v <target> 3306
# Using mysql client
mysql -h <target> -u root -p
# Using nmap
nmap -p 3306 --script "mysql-info,mysql-variables" <target>
# Using python
python3 -c "
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('<target>', 3306))
banner = s.recv(1024)
print(banner)
s.close()
"
Telnet Banner Grabbing
# Basic telnet connection
telnet <target> 23
# Using nc
nc -v <target> 23
# Check for telnet on non-standard ports
nc -v <target> 2323
nc -v <target> 992
HTTPS/TLS Banner Grabbing
# Using openssl s_client
openssl s_client -connect <target>:443 -servername <target>
# Get certificate details
echo | openssl s_client -connect <target>:443 2>/dev/null | openssl x509 -noout -text
# Check specific TLS versions
openssl s_client -connect <target>:443 -tls1_2
openssl s_client -connect <target>:443 -tls1_3
# Check cipher suites
nmap -p 443 --script "ssl-enum-ciphers,ssl-cert" <target>
# Using curl with SSL details
curl -vI https://<target>:443
Comprehensive Banner Grabbing Script
#!/bin/bash
# banner_grab.sh - Comprehensive banner grabbing script
TARGET=$1
if [ -z "$TARGET" ]; then
echo "Usage: $0 <target_ip>"
exit 1
fi
echo "========================================="
echo "Banner Grabbing for $TARGET"
echo "========================================="
# Common ports and their expected services
declare -A PORTS=(
[21]="FTP"
[22]="SSH"
[23]="Telnet"
[25]="SMTP"
[53]="DNS"
[80]="HTTP"
[110]="POP3"
[135]="MSRPC"
[139]="NetBIOS"
[143]="IMAP"
[443]="HTTPS"
[445]="SMB"
[993]="IMAPS"
[995]="POP3S"
[1433]="MSSQL"
[1521]="Oracle"
[3306]="MySQL"
[3389]="RDP"
[5432]="PostgreSQL"
[5900]="VNC"
[6379]="Redis"
[8080]="HTTP-Proxy"
[8443]="HTTPS-Alt"
[27017]="MongoDB"
)
for port in "${!PORTS[@]}"; do
service="${PORTS[$port]}"
echo ""
echo "-----------------------------------------"
echo "Port $port ($service)"
echo "-----------------------------------------"
# Check if port is open
if nc -z -w 2 "$TARGET" "$port" 2>/dev/null; then
echo "[+] Port $port is OPEN"
case $port in
80|8080|8443|3000|8000)
echo -e "GET / HTTP/1.1\r\nHost: $TARGET\r\nConnection: close\r\n\r\n" | nc -w 3 "$TARGET" "$port" 2>/dev/null | head -20
;;
443)
echo | openssl s_client -connect "$TARGET:$port" -servername "$TARGET" 2>/dev/null | head -5
;;
21)
nc -w 3 "$TARGET" "$port" 2>/dev/null | head -5
;;
22)
nc -w 3 "$TARGET" "$port" 2>/dev/null | head -5
;;
25)
nc -w 3 "$TARGET" "$port" 2>/dev/null | head -5
;;
3306)
nc -w 3 "$TARGET" "$port" 2>/dev/null | head -5
;;
*)
nc -w 3 "$TARGET" "$port" 2>/dev/null | head -5
;;
esac
else
echo "[-] Port $port is closed or filtered"
fi
done
echo ""
echo "========================================="
echo "Banner grabbing complete!"
echo "========================================="
Vulnerability Research Workflow
The Research Process
flowchart TD
A[Identify Service + Version] --> B[Search Exploit-DB]
A --> C[Search CVE Details]
A --> D[Google Dork Search]
A --> E[Search GitHub]
B --> F[Evaluate Results]
C --> F
D --> F
E --> F
F --> G{Exploit Available?}
G -->|Yes| H[Assess Exploit Quality]
G -->|No| I[Search for Misconfigurations]
H --> J{Reliable?}
J -->|Yes| K[Test in Lab]
J -->|No| L[Try Alternative]
K --> M{Works?}
M -->|Yes| N[Document & Proceed]
M -->|No| O[Debug / Patch Exploit]
L --> B
O --> K
I --> P[Test Default Credentials]
P --> Q[Test Service Misconfigs]
Search Strategies
1. Exploit-DB (exploit-db.com)
The primary resource for known exploits. Part of Offensive Security.
# Using searchsploit (local copy of Exploit-DB)
searchsploit <service> <version>
searchsploit apache 2.4.49
searchsploit openssh 7.2
searchsploit vsftpd 2.3.4
searchsploit samba 3.5.0
# Search by platform
searchsploit linux remote
searchsploit windows local
# Search by type
searchsploit apache rce
searchsploit apache sqli
# Get exploit path
searchsploit -m <exploit_path>
# View exploit
searchsploit -x <exploit_path>
# Update exploit database
searchsploit --update
Exploit-DB Result Fields:
| Field | Description |
|---|---|
| Exploit Title | Brief description of the vulnerability |
| Platform | Target platform (linux, windows, etc.) |
| Publish Date | When the exploit was published |
| Verified | Whether the exploit has been verified |
| Exploit Path | Path to the exploit file in the database |
2. CVE Details (cvedetails.com)
Comprehensive CVE database with vendor/product filtering.
Search Strategy:
- Navigate to cvedetails.com
- Select vendor from dropdown
- Select product
- Filter by version
- Sort by severity (CVSS score)
3. Google Dorking
# Service-specific searches
"Apache/2.4.49" exploit
"OpenSSH 7.2p2" vulnerability
"vsftpd 2.3.4" backdoor
# CVE-specific searches
CVE-2021-41773 exploit
CVE-2016-0777 bypass
# Platform + service searches
site:exploit-db.com apache 2.4.49
site:github.com apache 2.4.49 exploit
# PoC searches
"Apache 2.4.49" "proof of concept"
"Apache 2.4.49" "poc"
4. GitHub
# Search for exploits
apache 2.4.49 exploit
openssh 7.2 CVE-2016-0777
# Search for PoCs
apache path traversal poc
vsftpd backdoor exploit
# Filter by language
apache exploit language:python
samba exploit language:c
Evaluating Exploit Reliability
Not all exploits are created equal. Use this checklist to evaluate:
Exploit Quality Checklist
| Criteria | Good Sign | Red Flag |
|---|---|---|
| Verification | Marked as “Verified” on Exploit-DB | No verification status |
| Author Reputation | Known security researcher | Unknown/anonymous author |
| Code Quality | Clean, commented code | Messy, no comments |
| Dependencies | Minimal dependencies | Many obscure dependencies |
| Age | Recent (within 2 years) | Very old (5+ years) |
| Comments | Positive community feedback | Reports of failures |
| Complexity | Simple, straightforward | Overly complex, obfuscated |
| Testing | Tested on target version | Tested on different version |
| Stability | Reliable, consistent results | Crashes, unstable |
Exploit Reliability Rating
graph TD
A[Found Exploit] --> B{Verified?}
B -->|Yes| C{Code Quality Good?}
B -->|No| D{Author Reputable?}
C -->|Yes| E[High Confidence]
C -->|No| F{Comments Positive?}
D -->|Yes| G{Recent?}
D -->|No| H[Low Confidence]
F -->|Yes| I[Medium Confidence]
F -->|No| H
G -->|Yes| I
G -->|No| J[Low-Medium Confidence]
E --> K[Test in Lab First]
I --> K
J --> K
H --> L[Try Alternative Exploit]
Service Fingerprinting Beyond Nmap
WhatWeb
Identifies web technologies, CMS, frameworks, and plugins.
# Basic scan
whatweb http://<target>
# Aggressive scan with all plugins
whatweb --aggressive http://<target>
# Colorized output
whatweb --color http://<target>
# Log output
whatweb --log-file=whatweb.log http://<target>
# Scan multiple URLs
whatweb http://<target> http://<target2>
# With proxy
whatweb --proxy http://127.0.0.1:8080 http://<target>
Wappalyzer
Browser extension and CLI tool for web technology detection.
# Install wappalyzer CLI
npm install -g wappalyzer
# Scan a URL
wappalyzer http://<target>
Nikto
Web server vulnerability scanner.
# Basic scan
nikto -h http://<target>
# Scan specific port
nikto -h http://<target>:8080
# With SSL
nikto -h https://<target>
# Output to file
nikto -h http://<target> -o nikto_report.txt -Format txt
# Skip certain tests
nikto -h http://<target> -evasion 1
# Adjust timeout
nikto -h http://<target> -timeout 30
HTTP Enum
# Using gobuster for virtual host discovery
gobuster vhost -u http://<target> -w /usr/share/seclists/Discovery/DNS/subdomains-top10000.txt
# Using ffuf for virtual host discovery
ffuf -u http://<target> -H "Host: FUZZ.<target>" -w /usr/share/seclists/Discovery/DNS/subdomains-top10000.txt -mc 200
Common Service Versions in OSCP Labs
Frequently Encountered Services
| Service | Common Versions in Labs | Known Vulnerabilities |
|---|---|---|
| Apache | 2.2.x, 2.4.7-2.4.50 | Path traversal, RCE, info disclosure |
| OpenSSH | 7.2p2, 7.4p1, 7.6p1 | Auth bypass, credential theft |
| vsftpd | 2.3.4, 3.0.3 | Backdoor (2.3.4), auth bypass |
| Samba | 3.0.20, 3.5.0, 3.6.6 | RCE, auth bypass |
| MySQL | 5.5.x, 5.6.x, 5.7.x | Auth bypass, privilege escalation |
| PHP | 5.4.x, 5.6.x, 7.0.x, 7.2.x | RCE, deserialization, info disclosure |
| WordPress | 4.x, 5.x | Plugin vulns, RCE, SQLi |
| Jenkins | 2.x various | RCE, auth bypass |
| Tomcat | 6.x, 7.x, 8.x | Manager RCE, AJP vulns |
| Node.js | 8.x, 10.x, 12.x | Prototype pollution, RCE |
Version-Specific Exploit Quick Reference
| Service + Version | CVE | Exploit Type | Reliability |
|---|---|---|---|
| vsftpd 2.3.4 | CVE-2011-2523 | Backdoor | Very High |
| Samba 3.5.0 | CVE-2007-2447 | RCE | Very High |
| Apache 2.4.49 | CVE-2021-41773 | Path Traversal | High |
| OpenSSH 7.2-7.4 | CVE-2016-0777 | Auth Bypass | High |
| MySQL 5.5-5.7 | CVE-2012-2122 | Heap Overflow | Medium |
| PHP 5.4.x | CVE-2015-4024 | RCE | High |
| Tomcat 6-8 | CVE-2017-12615 | RCE | High |
| Jenkins <2.44 | CVE-2015-8103 | RCE | High |
Mapping Versions to Known CVEs
Systematic Approach
- Extract Version String: From Nmap or manual banner grabbing
- Normalize Version: Remove distribution-specific suffixes
- Search CVE Database: Use multiple sources
- Filter by Severity: Focus on CVSS 7.0+
- Check Exploit Availability: Exploit-DB, GitHub
- Verify Applicability: Ensure exploit matches exact version
Version Normalization Examples
| Raw Version String | Normalized | Search Term |
|---|---|---|
Apache/2.4.49 (Ubuntu) |
Apache 2.4.49 |
apache 2.4.49 |
OpenSSH_7.2p2 Ubuntu-4ubuntu2.10 |
OpenSSH 7.2p2 |
openssh 7.2 |
MySQL 5.7.21-0ubuntu0.16.04.1 |
MySQL 5.7.21 |
mysql 5.7.21 |
nginx/1.18.0 (Ubuntu) |
nginx 1.18.0 |
nginx 1.18.0 |
CVE Search Commands
# Searchsploit with version
searchsploit apache 2.4.49
searchsploit "apache 2.4.49"
# Search by CVE
searchsploit CVE-2021-41773
# Search by keyword
searchsploit apache path traversal
# List all apache exploits
searchsploit apache
# Count results
searchsploit apache 2.4.49 | wc -l
Building a Version-to-Exploit Reference
Personal Reference Template
Create a personal reference document for quick lookup during exams:
# Version-to-Exploit Reference
## Web Servers
### Apache
| Version | CVE | Exploit Path | Type | Notes |
|---------|-----|-------------|------|-------|
| 2.4.49-2.4.50 | CVE-2021-41773 | 50383.py | Path Traversal | Requires mod_cgi |
| 2.4.0-2.4.4 | CVE-2014-0226 | 34822.py | RCE | mod_cgi required |
| 2.2.x | CVE-2017-9798 | 44435.py | RCE | mod_proxy required |
### Nginx
| Version | CVE | Exploit Path | Type | Notes |
|---------|-----|-------------|------|-------|
| 0.8.41 | CVE-2013-4547 | 30457.py | RCE | Rare |
## FTP Servers
### vsftpd
| Version | CVE | Exploit Path | Type | Notes |
|---------|-----|-------------|------|-------|
| 2.3.4 | CVE-2011-2523 | 17943.py | Backdoor | Port 6200 |
## File Sharing
### Samba
| Version | CVE | Exploit Path | Type | Notes |
|---------|-----|-------------|------|-------|
| 3.5.0-3.5.11 | CVE-2007-2447 | 46404.py | RCE | Very reliable |
| 3.0.20-3.0.25 | CVE-2007-2447 | 46404.py | RCE | Very reliable |
Automated Reference Builder
#!/bin/bash
# build_reference.sh - Build version-to-exploit reference
SERVICE=$1
VERSION=$2
if [ -z "$SERVICE" ] || [ -z "$VERSION" ]; then
echo "Usage: $0 <service> <version>"
echo "Example: $0 apache 2.4.49"
exit 1
fi
echo "Searching for exploits: $SERVICE $VERSION"
echo "========================================="
# Search exploit-db
RESULTS=$(searchsploit "$SERVICE" "$VERSION" 2>/dev/null)
if [ -n "$RESULTS" ]; then
echo "$RESULTS"
echo ""
echo "========================================="
echo "Saving results..."
echo "$RESULTS" > "${SERVICE}_${VERSION}_exploits.txt"
echo "Saved to: ${SERVICE}_${VERSION}_exploits.txt"
else
echo "No exploits found for $SERVICE $VERSION"
fi
OSCP Exam Tips
Service Detection Tips
-
Always use
-sV: Never skip version detection in your scans. The version is often the key to exploitation. -
Use
--version-intensity 5+on stubborn ports: If default-sVdoesn’t identify a service, increase intensity. -
Manual banner grabbing is your friend: When Nmap fails, manual techniques often succeed.
-
Document everything: Record every version string you find. You’ll need it for exploitation.
-
Check non-standard ports: Services often run on non-standard ports. Don’t assume port 80 is the only HTTP server.
-
Use
searchsploitearly: As soon as you have a version, search for exploits. This guides your attack strategy. -
Verify exploit compatibility: Not all exploits work on all versions. Check the exploit requirements carefully.
-
Keep searchsploit updated: Run
searchsploit --updatebefore starting your exam. -
Use multiple search sources: Exploit-DB, CVE Details, Google, and GitHub each may have different results.
-
Focus on reliable exploits: Prioritize exploits marked as “Verified” with positive community feedback.
Common Pitfalls
- Assuming Nmap is always correct: Always verify with manual techniques
- Ignoring distribution-specific patches: Ubuntu patches may close vulnerabilities
- Not checking for service wrappers: Some services run behind proxies or wrappers
- Skipping UDP services: UDP services can have version-specific vulnerabilities too
- Not updating exploit database: Old searchsploit may miss recent exploits
Time Management
| Activity | Recommended Time |
|---|---|
Initial Nmap scan with -sV |
5-10 minutes |
| Manual banner grabbing | 5-15 minutes |
| Vulnerability research | 15-30 minutes |
| Exploit evaluation | 10-20 minutes |
| Total | 35-75 minutes |
Summary
Service version detection is a critical step in the penetration testing workflow. By accurately identifying service versions, you can:
- Target known vulnerabilities with specific exploits
- Prioritize attack vectors based on exploit reliability
- Save time by focusing on proven exploitation paths
- Build a systematic approach to vulnerability research
Master both automated (Nmap) and manual (banner grabbing) techniques, and develop a reliable workflow for vulnerability research. This combination will serve you well in OSCP labs and real-world engagements.