WPScan
Overview
Sezione intitolata “Overview”WPScan is a free, open-source WordPress security scanner that identifies vulnerable plugins, themes, weak passwords, and WordPress core vulnerabilities. It integrates with WPVulnDB, a comprehensive vulnerability database, to provide actionable security insights for WordPress administrators and security researchers.
Installation
Sezione intitolata “Installation”Via RubyGems
Sezione intitolata “Via RubyGems”gem install wpscan
Verify installation:
wpscan --version
Via Docker
Sezione intitolata “Via Docker”docker pull wpscanteam/wpscan:latest
# Run WPScan in Docker
docker run -it --rm wpscanteam/wpscan:latest --url http://target.com
Via Package Manager (Linux)
Sezione intitolata “Via Package Manager (Linux)”# Ubuntu/Debian
sudo apt-get install wpscan
# Kali Linux (pre-installed)
wpscan --version
Manual Installation from Source
Sezione intitolata “Manual Installation from Source”git clone https://github.com/wpscanteam/wpscan.git
cd wpscan
bundle install
./wpscan.rb --version
API Token Setup
Sezione intitolata “API Token Setup”Obtaining a Free API Token
Sezione intitolata “Obtaining a Free API Token”- Register at wpscan.com
- Verify your email
- Copy your API token from the dashboard
- Limit: 25 requests/day (free tier)
Configuring API Token
Sezione intitolata “Configuring API Token”Store token in ~/.wpscan/scan.json:
mkdir -p ~/.wpscan
cat > ~/.wpscan/scan.json << 'EOF'
{
"general_settings": {
"api_token": "YOUR_API_TOKEN_HERE"
}
}
EOF
Or pass token via command line:
wpscan --url http://target.com --api-token YOUR_API_TOKEN
Basic Scanning
Sezione intitolata “Basic Scanning”Simple Target Scan
Sezione intitolata “Simple Target Scan”# Basic scan (no API token)
wpscan --url http://target.com
# Scan with API token
wpscan --url http://target.com --api-token YOUR_TOKEN
Specify WordPress Path
Sezione intitolata “Specify WordPress Path”# Target is at /wordpress/wp-admin
wpscan --url http://target.com/wordpress --api-token YOUR_TOKEN
Follow Redirects
Sezione intitolata “Follow Redirects”wpscan --url http://target.com --follow-redirects --api-token YOUR_TOKEN
Enumeration Options
Sezione intitolata “Enumeration Options”Enumerate WordPress Version
Sezione intitolata “Enumerate WordPress Version”wpscan --url http://target.com --enumerate vp
Enumerate Plugins
Sezione intitolata “Enumerate Plugins”# All plugins
wpscan --url http://target.com --enumerate p
# Vulnerable plugins only
wpscan --url http://target.com --enumerate vp
# Popular plugins (default: 100)
wpscan --url http://target.com --enumerate p --plugins-detection aggressive
Enumerate Themes
Sezione intitolata “Enumerate Themes”# All themes
wpscan --url http://target.com --enumerate t
# Vulnerable themes only
wpscan --url http://target.com --enumerate vt
Enumerate Users
Sezione intitolata “Enumerate Users”# Enumerate usernames
wpscan --url http://target.com --enumerate u
# Enumerate specific user range
wpscan --url http://target.com --enumerate u --detection-mode passive
Enumerate All Components
Sezione intitolata “Enumerate All Components”# Shorthand: v = vulnerable, p = plugins, t = themes, u = users, tt = timthumbs, cb = config backups
wpscan --url http://target.com --enumerate vp,vt,u
Detection Modes
Sezione intitolata “Detection Modes”| Mode | Speed | Accuracy | Use Case |
|---|---|---|---|
passive | Fast | Low | Quick reconnaissance |
aggressive | Slow | High | In-depth testing (authorized only) |
mixed | Medium | Medium | Balanced approach |
# Passive enumeration (stealthy)
wpscan --url http://target.com --enumerate p --detection-mode passive
# Aggressive enumeration (thorough, detectable)
wpscan --url http://target.com --enumerate p --detection-mode aggressive
Version Detection
Sezione intitolata “Version Detection”Core WordPress Version
Sezione intitolata “Core WordPress Version”wpscan --url http://target.com --enumerate vp
Plugin Versions
Sezione intitolata “Plugin Versions”wpscan --url http://target.com --enumerate p
Theme Versions
Sezione intitolata “Theme Versions”wpscan --url http://target.com --enumerate t
Check Against CVE Database
Sezione intitolata “Check Against CVE Database”# Requires API token for vulnerability matching
wpscan --url http://target.com --enumerate vp --api-token YOUR_TOKEN
Password Attacks
Sezione intitolata “Password Attacks”Brute Force Attack
Sezione intitolata “Brute Force Attack”# Using rockyou.txt wordlist
wpscan --url http://target.com --usernames admin --passwords /usr/share/wordlists/rockyou.txt
# Brute force specific user
wpscan --url http://target.com --usernames admin --wordlist /path/to/wordlist.txt
Multiple Users
Sezione intitolata “Multiple Users”# Try multiple usernames from file
wpscan --url http://target.com --usernames-list users.txt --passwords passwords.txt
Custom Wordlists
Sezione intitolata “Custom Wordlists”# Generate custom wordlist
wpscan --url http://target.com --usernames admin,editor,test --passwords passwords.txt
# Single password, multiple users
wpscan --url http://target.com --usernames admin --passwords password123
Throttling and Rate Limiting
Sezione intitolata “Throttling and Rate Limiting”# Throttle requests (milliseconds between requests)
wpscan --url http://target.com --usernames admin --passwords passwords.txt --throttle 100
# Max threads (default: 5)
wpscan --url http://target.com --usernames admin --passwords passwords.txt --max-threads 10
Vulnerability Detection
Sezione intitolata “Vulnerability Detection”Vulnerable Plugins
Sezione intitolata “Vulnerable Plugins”# Enumerate and check for vulnerabilities
wpscan --url http://target.com --enumerate vp --api-token YOUR_TOKEN
Vulnerable Themes
Sezione intitolata “Vulnerable Themes”wpscan --url http://target.com --enumerate vt --api-token YOUR_TOKEN
Vulnerable Core
Sezione intitolata “Vulnerable Core”# WordPress core vulnerabilities
wpscan --url http://target.com --enumerate vp --api-token YOUR_TOKEN
Common Vulnerabilities Found
Sezione intitolata “Common Vulnerabilities Found”| Type | Severity | Example |
|---|---|---|
| SQL Injection | High | Easily exploitable injection flaws in plugins |
| Arbitrary File Upload | High | Unprotected upload endpoints |
| Privilege Escalation | High | Unauthenticated admin account creation |
| Cross-Site Scripting (XSS) | Medium | Stored/reflected XSS in plugin output |
| Local File Inclusion (LFI) | Medium | Directory traversal via plugin paths |
| Authentication Bypass | High | Weak authentication mechanisms |
| Insecure Deserialization | High | PHP object injection |
Output Formats
Sezione intitolata “Output Formats”JSON Output
Sezione intitolata “JSON Output”wpscan --url http://target.com --api-token YOUR_TOKEN --format json -o report.json
CLI Output (Default)
Sezione intitolata “CLI Output (Default)”wpscan --url http://target.com --api-token YOUR_TOKEN
HTML Report
Sezione intitolata “HTML Report”wpscan --url http://target.com --api-token YOUR_TOKEN --format html -o report.html
Export and Parse Results
Sezione intitolata “Export and Parse Results”# Parse JSON report
cat report.json | jq '.vulnerabilities'
# Count vulnerabilities
cat report.json | jq '.vulnerabilities | length'
# Extract plugin vulnerabilities
cat report.json | jq '.plugins | keys'
Stealthy Scanning
Sezione intitolata “Stealthy Scanning”Random User Agent
Sezione intitolata “Random User Agent”wpscan --url http://target.com --random-user-agent
Passive Detection Only
Sezione intitolata “Passive Detection Only”wpscan --url http://target.com --enumerate u --detection-mode passive
Slow Throttling
Sezione intitolata “Slow Throttling”# 500ms delay between requests
wpscan --url http://target.com --enumerate p --throttle 500
Avoid Detection
Sezione intitolata “Avoid Detection”# Combine techniques for stealth
wpscan --url http://target.com \
--enumerate p,u \
--detection-mode passive \
--random-user-agent \
--throttle 300 \
--api-token YOUR_TOKEN
Common Findings and Exploitation
Sezione intitolata “Common Findings and Exploitation”Admin User Enumeration
Sezione intitolata “Admin User Enumeration”Finding: Usernames admin, administrator, root discovered
Exploitation: Brute force password, check for weak credentials
wpscan --url http://target.com --usernames admin --passwords common.txt
Outdated WordPress Core
Sezione intitolata “Outdated WordPress Core”Finding: WordPress 5.x.x detected (vulnerable version available)
Exploitation: Apply security patch or update via WordPress admin panel
Vulnerable Plugin (Example: Elementor < 3.0)
Sezione intitolata “Vulnerable Plugin (Example: Elementor < 3.0)”Finding: Elementor 2.9.14 detected (SQL injection in CVE-2021-12345)
Exploitation: Update plugin or disable until patch available
# Confirm via WPVulnDB API
wpscan --url http://target.com --enumerate vp --api-token YOUR_TOKEN
XML-RPC Enabled
Sezione intitolata “XML-RPC Enabled”Finding: /xmlrpc.php accessible
Exploitation: Disable XML-RPC if not needed
# Detect XML-RPC
curl -I http://target.com/xmlrpc.php
Directory Listing Enabled
Sezione intitolata “Directory Listing Enabled”Finding: /wp-content/ directory browsable
Exploitation: Add .htaccess to restrict directory listing
# Create .htaccess in WordPress root
cat > /var/www/html/.htaccess << 'EOF'
<FilesMatch "^\.">
Deny from all
</FilesMatch>
EOF
WPScan API
Sezione intitolata “WPScan API”API Endpoints
Sezione intitolata “API Endpoints”Get vulnerability information for specific plugins:
curl "https://vulners.com/search?type=wordpress-plugin&q=plugin-name"
Query WPVulnDB via WPScan
Sezione intitolata “Query WPVulnDB via WPScan”# Check specific plugin version for vulnerabilities
wpscan --url http://target.com --enumerate vp --api-token YOUR_TOKEN
CI/CD Integration
Sezione intitolata “CI/CD Integration”GitHub Actions
Sezione intitolata “GitHub Actions”name: WPScan
on: [push]
jobs:
wpscan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run WPScan
uses: wpscanteam/action-wpscan@master
with:
url: 'http://target.com'
token: ${{ secrets.WPSCAN_TOKEN }}
Jenkins Pipeline
Sezione intitolata “Jenkins Pipeline”pipeline {
agent any
stages {
stage('WPScan') {
steps {
sh '''
wpscan --url http://target.com \
--api-token ${WPSCAN_TOKEN} \
--format json -o wpscan-report.json
'''
}
}
}
}
Docker Compose for Testing
Sezione intitolata “Docker Compose for Testing”version: '3'
services:
wordpress:
image: wordpress:latest
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: wp
WORDPRESS_DB_PASSWORD: password
ports:
- "8080:80"
wpscan:
image: wpscanteam/wpscan:latest
depends_on:
- wordpress
command: --url http://wordpress
Advanced Options
Sezione intitolata “Advanced Options”Proxy Configuration
Sezione intitolata “Proxy Configuration”# Use HTTP proxy
wpscan --url http://target.com --proxy http://127.0.0.1:8080
# Use SOCKS5 proxy
wpscan --url http://target.com --proxy socks5://127.0.0.1:1080
Custom Headers
Sezione intitolata “Custom Headers”# Add custom header (e.g., for bypass)
wpscan --url http://target.com --headers "X-Custom-Header: value"
SSL/TLS Configuration
Sezione intitolata “SSL/TLS Configuration”# Disable SSL verification (not recommended)
wpscan --url https://target.com --disable-ssl-verification
# Use specific certificate
wpscan --url https://target.com --certificate /path/to/cert.pem
Aggressive Scanning with All Options
Sezione intitolata “Aggressive Scanning with All Options”wpscan --url http://target.com \
--enumerate vp,vt,u,cb,dbe,m,wp \
--detection-mode aggressive \
--api-token YOUR_TOKEN \
--random-user-agent \
--max-threads 10 \
--format json -o full-report.json
Best Practices
Sezione intitolata “Best Practices”| Practice | Benefit |
|---|---|
| Use API token | Unlock vulnerability database matching |
| Scan authorized targets only | Legal and ethical compliance |
| Test in staging environment | Avoid production impact |
| Regular scanning | Catch new vulnerabilities early |
| Update plugin/theme list | Ensure current vulnerability data |
| Combine with manual review | Find logic flaws WPScan misses |
| Monitor WordPress updates | Patch promptly when available |
Common Issues and Troubleshooting
Sezione intitolata “Common Issues and Troubleshooting”Target Not Reachable
Sezione intitolata “Target Not Reachable”# Test connectivity first
curl -I http://target.com
# Specify timeout
wpscan --url http://target.com --request-timeout 15
API Token Limit Reached
Sezione intitolata “API Token Limit Reached”# Without token (limited data)
wpscan --url http://target.com --enumerate p
# Purchase premium token for higher limits
# Visit: https://wpscan.com
False Positives in Results
Sezione intitolata “False Positives in Results”# Manually verify findings
curl http://target.com/wp-content/plugins/plugin-name/
# Check WPVulnDB database for confirmation
Slow Scanning
Sezione intitolata “Slow Scanning”# Increase threads for faster enumeration
wpscan --url http://target.com --max-threads 25 --enumerate p
Resources
Sezione intitolata “Resources”- Official Documentation: https://github.com/wpscanteam/wpscan
- WPVulnDB Database: https://www.wpvulndb.com
- WPScan Website: https://wpscan.com
- Vulnerability Reporting: https://wpscan.com/report
- Community: https://www.wordpress.org/support/