Aller au contenu

WPScan

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.

gem install wpscan

Verify installation:

wpscan --version
docker pull wpscanteam/wpscan:latest

# Run WPScan in Docker
docker run -it --rm wpscanteam/wpscan:latest --url http://target.com
# Ubuntu/Debian
sudo apt-get install wpscan

# Kali Linux (pre-installed)
wpscan --version
git clone https://github.com/wpscanteam/wpscan.git
cd wpscan
bundle install
./wpscan.rb --version
  1. Register at wpscan.com
  2. Verify your email
  3. Copy your API token from the dashboard
  4. Limit: 25 requests/day (free tier)

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 scan (no API token)
wpscan --url http://target.com

# Scan with API token
wpscan --url http://target.com --api-token YOUR_TOKEN
# Target is at /wordpress/wp-admin
wpscan --url http://target.com/wordpress --api-token YOUR_TOKEN
wpscan --url http://target.com --follow-redirects --api-token YOUR_TOKEN
wpscan --url http://target.com --enumerate vp
# 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
# All themes
wpscan --url http://target.com --enumerate t

# Vulnerable themes only
wpscan --url http://target.com --enumerate vt
# Enumerate usernames
wpscan --url http://target.com --enumerate u

# Enumerate specific user range
wpscan --url http://target.com --enumerate u --detection-mode passive
# Shorthand: v = vulnerable, p = plugins, t = themes, u = users, tt = timthumbs, cb = config backups
wpscan --url http://target.com --enumerate vp,vt,u
ModeSpeedAccuracyUse Case
passiveFastLowQuick reconnaissance
aggressiveSlowHighIn-depth testing (authorized only)
mixedMediumMediumBalanced 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
wpscan --url http://target.com --enumerate vp
wpscan --url http://target.com --enumerate p
wpscan --url http://target.com --enumerate t
# Requires API token for vulnerability matching
wpscan --url http://target.com --enumerate vp --api-token YOUR_TOKEN
# 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
# Try multiple usernames from file
wpscan --url http://target.com --usernames-list users.txt --passwords passwords.txt
# 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
# 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
# Enumerate and check for vulnerabilities
wpscan --url http://target.com --enumerate vp --api-token YOUR_TOKEN
wpscan --url http://target.com --enumerate vt --api-token YOUR_TOKEN
# WordPress core vulnerabilities
wpscan --url http://target.com --enumerate vp --api-token YOUR_TOKEN
TypeSeverityExample
SQL InjectionHighEasily exploitable injection flaws in plugins
Arbitrary File UploadHighUnprotected upload endpoints
Privilege EscalationHighUnauthenticated admin account creation
Cross-Site Scripting (XSS)MediumStored/reflected XSS in plugin output
Local File Inclusion (LFI)MediumDirectory traversal via plugin paths
Authentication BypassHighWeak authentication mechanisms
Insecure DeserializationHighPHP object injection
wpscan --url http://target.com --api-token YOUR_TOKEN --format json -o report.json
wpscan --url http://target.com --api-token YOUR_TOKEN
wpscan --url http://target.com --api-token YOUR_TOKEN --format html -o report.html
# 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'
wpscan --url http://target.com --random-user-agent
wpscan --url http://target.com --enumerate u --detection-mode passive
# 500ms delay between requests
wpscan --url http://target.com --enumerate p --throttle 500
# Combine techniques for stealth
wpscan --url http://target.com \
  --enumerate p,u \
  --detection-mode passive \
  --random-user-agent \
  --throttle 300 \
  --api-token YOUR_TOKEN

Finding: Usernames admin, administrator, root discovered

Exploitation: Brute force password, check for weak credentials

wpscan --url http://target.com --usernames admin --passwords common.txt

Finding: WordPress 5.x.x detected (vulnerable version available)

Exploitation: Apply security patch or update via WordPress admin panel

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

Finding: /xmlrpc.php accessible

Exploitation: Disable XML-RPC if not needed

# Detect XML-RPC
curl -I http://target.com/xmlrpc.php

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

Get vulnerability information for specific plugins:

curl "https://vulners.com/search?type=wordpress-plugin&q=plugin-name"
# Check specific plugin version for vulnerabilities
wpscan --url http://target.com --enumerate vp --api-token YOUR_TOKEN
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 }}
pipeline {
  agent any
  stages {
    stage('WPScan') {
      steps {
        sh '''
          wpscan --url http://target.com \
            --api-token ${WPSCAN_TOKEN} \
            --format json -o wpscan-report.json
        '''
      }
    }
  }
}
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
# 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
# Add custom header (e.g., for bypass)
wpscan --url http://target.com --headers "X-Custom-Header: value"
# 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
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
PracticeBenefit
Use API tokenUnlock vulnerability database matching
Scan authorized targets onlyLegal and ethical compliance
Test in staging environmentAvoid production impact
Regular scanningCatch new vulnerabilities early
Update plugin/theme listEnsure current vulnerability data
Combine with manual reviewFind logic flaws WPScan misses
Monitor WordPress updatesPatch promptly when available
# Test connectivity first
curl -I http://target.com

# Specify timeout
wpscan --url http://target.com --request-timeout 15
# Without token (limited data)
wpscan --url http://target.com --enumerate p

# Purchase premium token for higher limits
# Visit: https://wpscan.com
# Manually verify findings
curl http://target.com/wp-content/plugins/plugin-name/

# Check WPVulnDB database for confirmation
# Increase threads for faster enumeration
wpscan --url http://target.com --max-threads 25 --enumerate p