Exploit databaseDownload repository ZIP
GH-a76f3c148d9c9bed26c834054f5b42d7
adrees-basheer/wp2shell-vulnerability-scanner
Sources for CVE-2026-63030
50 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files2
adrees-basheer/wp2shell-vulnerability-scannerRevision c05b6916a11f
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
wp2shell-scanner.sh
Shell · 4,681 bytes#!/bin/bash
#
# wp_scan_wp2shell.sh
#
# Scans a directory tree for WordPress installations and reports whether
# each one is running a core version vulnerable to wp2shell
# (CVE-2026-63030 + CVE-2026-60137).
#
# Vulnerable ranges:
# 6.8.0 - 6.8.5 -> SQL injection only (CVE-2026-60137). This branch does
# NOT contain the REST API batch route confusion bug
# (CVE-2026-63030), so it is NOT exploitable via the
# full unauthenticated RCE chain -- but the SQLi itself
# is still a real vulnerability and should be patched.
# Fixed in 6.8.6.
# 6.9.0 - 6.9.4 -> Full RCE chain (both CVEs). Fixed in 6.9.5.
# 7.0.0 - 7.0.1 -> Full RCE chain (both CVEs). Fixed in 7.0.2.
#
# Status labels used in output:
# VULNERABLE (RCE) - full unauthenticated RCE chain, patch immediately
# VULNERABLE (SQLi) - SQL injection only, patch but lower urgency than RCE
# SAFE - patched / not in an affected range
# UNKNOWN - version could not be determined
#
# Usage:
# ./wp_scan_wp2shell.sh /path/to/scan
# ./wp_scan_wp2shell.sh /path/to/scan --csv report.csv
#
# Notes:
# - Only reads wp-includes/version.php, does not modify anything.
# - Safe to run as a non-destructive, read-only audit tool.
# - Run with enough privileges to read into each site's directory
# (e.g. as the web user, or root via sudo, depending on your setup).
set -uo pipefail
SCAN_DIR="${1:-}"
CSV_OUT=""
# Optional: --csv <file>
if [[ "${2:-}" == "--csv" && -n "${3:-}" ]]; then
CSV_OUT="$3"
fi
if [[ -z "$SCAN_DIR" || ! -d "$SCAN_DIR" ]]; then
echo "Usage: $0 <directory-to-scan> [--csv output.csv]"
exit 1
fi
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
NC='\033[0m'
echo -e "${BOLD}Scanning for WordPress installs under:${NC} $SCAN_DIR"
echo "----------------------------------------------------------------------"
# CSV header
if [[ -n "$CSV_OUT" ]]; then
echo "path,version,status" > "$CSV_OUT"
fi
FOUND=0
VULN_RCE=0
VULN_SQLI=0
SAFE=0
UNKNOWN=0
# version_compare: prints -1, 0, 1 like a normal version comparator
version_lt() {
# returns 0 (true) if $1 < $2
[ "$1" = "$2" ] && return 1
lower=$(printf '%s\n%s\n' "$1" "$2" | sort -V | head -n1)
[ "$lower" = "$1" ]
}
version_in_range() {
local ver="$1" lo="$2" hi="$3"
# ver >= lo AND ver <= hi
if version_lt "$ver" "$lo"; then
return 1
fi
if version_lt "$hi" "$ver"; then
return 1
fi
return 0
}
# Find all wp-includes/version.php files under the target directory
while IFS= read -r -d '' version_file; do
site_dir=$(dirname "$(dirname "$version_file")")
FOUND=$((FOUND+1))
# Extract $wp_version = 'X.Y.Z';
wp_version=$(grep -oP "(?<=\\\$wp_version = ')[^']+" "$version_file" 2>/dev/null | head -n1)
if [[ -z "$wp_version" ]]; then
echo -e "${YELLOW}[?]${NC} $site_dir -> could not determine version"
UNKNOWN=$((UNKNOWN+1))
[[ -n "$CSV_OUT" ]] && echo "\"$site_dir\",unknown,UNKNOWN" >> "$CSV_OUT"
continue
fi
status="SAFE"
if version_in_range "$wp_version" "6.9.0" "6.9.4" || version_in_range "$wp_version" "7.0.0" "7.0.1"; then
status="VULNERABLE (RCE)"
elif version_in_range "$wp_version" "6.8.0" "6.8.5"; then
status="VULNERABLE (SQLi)"
fi
if [[ "$status" == "VULNERABLE (RCE)" ]]; then
echo -e "${RED}[!] VULNERABLE - FULL RCE${NC} $site_dir -> WP $wp_version (patch to 6.9.5 or 7.0.2 immediately)"
VULN_RCE=$((VULN_RCE+1))
elif [[ "$status" == "VULNERABLE (SQLi)" ]]; then
echo -e "${YELLOW}[!] VULNERABLE - SQLi only${NC} $site_dir -> WP $wp_version (patch to 6.8.6; no full RCE chain on this branch)"
VULN_SQLI=$((VULN_SQLI+1))
else
echo -e "${GREEN}[OK]${NC} $site_dir -> WP $wp_version"
SAFE=$((SAFE+1))
fi
[[ -n "$CSV_OUT" ]] && echo "\"$site_dir\",$wp_version,$status" >> "$CSV_OUT"
done < <(find "$SCAN_DIR" -type f -path "*/wp-includes/version.php" -print0 2>/dev/null)
echo "----------------------------------------------------------------------"
echo -e "${BOLD}Scan complete.${NC}"
echo "Sites found: $FOUND"
echo -e " ${RED}Vulnerable (RCE):${NC} $VULN_RCE"
echo -e " ${YELLOW}Vulnerable (SQLi):${NC} $VULN_SQLI"
echo -e " ${GREEN}Safe:${NC} $SAFE"
echo -e " ${YELLOW}Unknown:${NC} $UNKNOWN"
if [[ -n "$CSV_OUT" ]]; then
echo "CSV report written to: $CSV_OUT"
fi
if [[ "$VULN_RCE" -gt 0 ]]; then
exit 2
elif [[ "$VULN_SQLI" -gt 0 ]]; then
exit 3
fi
exit 0