初めに #
W3Techsの集計によると、全世界のWebサイトの**約43%**が WordPress で構築されていると言われています。
WordPress は、構築のしやすさと高い拡張性を兼ね備えた高性能な CMS ですが、その反面、構成が複雑になりやすく脆弱性を生みやすいという側面もあります。
また、その圧倒的なシェアゆえに、サイバー攻撃者の標的となっていることも事実です。
そのため、WordPress を運用する場合は定期的な脆弱性診断の実施が推奨されています。
本記事では、AlmaLinux 10でWordPress 向け脆弱性スキャナ 「WPScan」 を導入しサイトのセキュリティ診断を行う方法を初心者向けに分かりやすく解説します。
WPScanとは? #
WPScan は、WordPressサイトに特化したオープンソースのセキュリティスキャナです。
WordPress 本体をはじめ、インストールされているテーマやプラグインに含まれる既知の脆弱性を検出することができ、
セキュリティ対策や定期的な安全性チェックを行う際に広く利用されています。
WPScanの主な特徴は以下の通りです。
- 豊富な脆弱性データベースとの照合による検出
- インストール済みテーマ・プラグインの列挙
- WordPress のバージョン検出
- 設定上の弱点の検出
- API を活用した最新情報の取得
以下は、代表的な汎用脆弱性診断ツールである Nikto との比較となります。
| 項目 | WPScan | Nikto |
|---|---|---|
| 対象 | WordPress 専用 | 汎用 Web サーバー |
| プラグイン・テーマ診断 | ◎ | × |
| WordPress 脆弱性DBとの連携 | ◎ | × |
| WordPress 設定ミス検出 | ◎ | △ |
| Webサーバー設定診断 | △ | ◎ |
以下は WPScan の公式リポジトリとなっております。
WPScan WordPress security scanner. Written for security professionals and blog maintainers to test the security of their WordPress websites. Contact us via contact@wpscan.com
rubyの導入 #
WPScan は Ruby で開発されたツールとなっております。
そのため事前に Ruby の実行環境および必要な依存パッケージをインストールしておく必要があります。
次のコマンドを実行してください。
dnf install ruby
実行すると、以下のようにインストールパッケージの確認画面が表示されます。
Total download size: 5.4 M
Installed size: 20 M
Is this ok [y/N]:
内容を確認し問題なければ y を入力してインストールを進めてください。
インストールが完了すると、次のメッセージが表示されます。
Complete!
以下のコマンドを実行することで、ruby のバージョンを確認することができます。
ruby -v
ruby 3.3.10 (2025-10-23 revision 343ea05002) [x86_64-linux]
なお、際に導入される Ruby のバージョンは、ご利用の環境によって異なる場合がございます。
依存パッケージの導入 #
次に、WPScan のインストールおよび実行に必要となる依存パッケージを導入します。
これらのパッケージは、Ruby の拡張ライブラリのビルドや HTTPS 通信のために使用されます。
次のコマンドを実行してください。
dnf install -y \
gcc make git ruby-devel \
libcurl-devel openssl-devel \
libxml2-devel libxslt-devel
インストールが完了すると、次のメッセージが表示されます。
Complete!
今回インストールした主なパッケージの一覧は以下の通りとなります。
| パッケージ名 | 説明 |
|---|---|
gcc |
C コンパイラ |
make |
ソースコードのビルド処理に使用 |
git |
WPScan 本体および依存ライブラリの取得 |
ruby-devel |
拡張ライブラリのビルドに必要なヘッダファイル |
libcurl-devel |
HTTPS 通信を行うためのライブラリ |
openssl-devel |
SSL/TLS 暗号化通信に必要なライブラリ |
libxml2-devel |
HTML / XML の解析処理 |
libxslt-devel |
XML / HTML 変換処理 |
WPScanのインストール #
次に、WPScan の本体をインストールを行います。
インストールには、RubyGems で提供されている gem install コマンドを利用します。
以下のコマンドを実行してください。
gem install wpscan
実行すると、次のように依存ライブラリの取得状況が表示されます。
Fetching typhoeus-1.4.1.gem
Fetching xmlrpc-0.3.3.gem
Fetching webrick-1.9.2.gem
Fetching ruby-progressbar-1.13.0.gem
Fetching ffi-1.17.2-x86_64-linux-gnu.gem
Fetching yajl-ruby-1.4.3.gem
Fetching sys-proctable-1.3.0.gem
インストールが完了すると、次のメッセージが表示されます。
Done installing documentation for yajl-ruby, webrick, xmlrpc, ffi, ethon, typhoeus, sys-proctable, ruby-progressbar, public_suffix, addressable, concurrent-ruby, tzinfo, prism, minitest, i18n, connection_pool, activesupport, opt_parse_validator, racc, nokogiri, get_process_mem, cms_scanner, wpscan after 74 seconds
23 gems installed
正しくインストールされていることを確認するため、以下のコマンドを実行してください。
wpscan --version
以下のように wpscan のバージョン情報が表示されれば、インストールは正常に完了しています。
wpscan --version
_______________________________________________________________
__ _______ _____
\ \ / / __ \ / ____|
\ \ /\ / /| |__) | (___ ___ __ _ _ __ ®
\ \/ \/ / | ___/ \___ \ / __|/ _` | '_ \
\ /\ / | | ____) | (__| (_| | | | |
\/ \/ |_| |_____/ \___|\__,_|_| |_|
WordPress Security Scanner by the WPScan Team
Version 3.8.28
@_WPScan_, @ethicalhack3r, @erwan_lr, @firefart
_______________________________________________________________
Current Version: 3.8.28
インストールされた wpscan の実行コマンドおよび本体ファイルは、以下のシステム領域に配置されています。
/
└─ usr/
└─ local/
├─ bin/
│ └─ wpscan ← 実行コマンド
│
└─ share/
└─ gems/
└─ gems/
└─ wpscan-3.8.28/ ← WPScan 本体・依存ライブラリ
以上で wpscan の導入は完了となります。
データベースの更新 #
次に以下のコマンドを実行し脆弱性データベースを最新の状態へ更新してください。
wpscan --update
コマンドの実行が正常に完了すると、次のようなメッセージが表示されます。
[i] Updating the Database ...
[i] Update completed.
これにより最新の情報に基づいた診断が行われるようになります。
基本的な利用方法 #
許可なく他人のサイトをスキャンすると、法的な問題になる可能性があります。
wpscan の基本的な利用方法は以下の通りとなっております。
wpscan --url <スキャン対象となるサイトURL>
このコマンドを実行すると、wpscan は対象サイトに対して以下のような情報を自動的に収集し診断を行います。
- WordPress 本体のバージョン
- 使用中のテーマ
- インストール済みプラグインの存在
XML-RPCやWP-Cronなど、攻撃対象になりやすい機能の有無- 危険な設定や公開されている情報の検出
使用しているテーマや WordPress 本体のバージョンは次のように表示されます。
[+] WordPress version 6.9 identified (Latest, released on 2025-12-02).
| Found By: Rss Generator (Passive Detection)
| - https://xxxxx.xxx/feed/, <generator>https://wordpress.org/?v=6.9</generator>
| - https://xxxxx.xxx/comments/feed/, <generator>https://wordpress.org/?v=6.9</generator>
[+] WordPress theme in use: cocoon-master
| Location: https://xxxxx.xxx/wp-content/themes/cocoon-master/
| Readme: https://xxxxx.xxx/wp-content/themes/cocoon-master/readme.md
| Style URL: https://xxxxx.xxx/wp-content/themes/cocoon-master/style.css?ver=6.9&fver=20251228060128
| Style Name: Cocoon
| Style URI: https://wp-cocoon.com/
| Description: SEO・高速化・モバイルファースト最適化済みの無料テーマ。...
| Author: わいひら
| Author URI: https://nelog.jp/
|
| Found By: Css Style In Homepage (Passive Detection)
| Confirmed By: Css Style In 404 Page (Passive Detection)
|
| Version: 2.8.9.1 (80% confidence)
| Found By: Style (Passive Detection)
| - https://xxxxx.xxx/wp-content/themes/cocoon-master/style.css?ver=6.9&fver=20251228060128, Match: 'Version: 2.8.9.1'
XML-RPC や WP-Cron の有効状態は以下のように表示されます。
[+] XML-RPC seems to be enabled: https://xxxxx.xxx/xmlrpc.php
| Found By: Direct Access (Aggressive Detection)
| Confidence: 100%
| References:
| - https://xxxxx.xxx/XML-RPC_Pingback_API
[+] The external WP-Cron seems to be enabled: https://xxxxx.xxx/wp-cron.php
| Found By: Direct Access (Aggressive Detection)
| Confidence: 60%
| References:
| - https://xxxxx.xxx/defend-wordpress-from-ddos
| - https://xxxxx.xxx
XML-RPC は、外部から WordPress にアクセスして操作できる仕組みとなっています。
これらはブルートフォース攻撃やコメントスパムの対象になりやすい機能となるため不要な場合は無効化が推奨されています。
WP-Cron は、WordPress 内で定期的な処理を実行する仕組みとなっています。
外部から呼び出せる状態になっている場合、攻撃に利用される可能性があるため注意が必要となっています。
スキャンが完了すると、以下のような結果サマリーが表示されます。
[i] No Config Backups Found.
[!] No WPScan API Token given, as a result vulnerability data has not been output.
[!] You can get a free API token with 25 daily requests by registering at https://wpscan.com/register
[+] Finished: Sun Dec 28 17:06:38 2025
[+] Requests Done: 139
[+] Cached Requests: 46
[+] Data Sent: 36.711 KB
[+] Data Received: 308.576 KB
[+] Memory used: 268.145 MB
[+] Elapsed time: 00:00:10
脆弱性の確認方法(API) #
WPScan で具体的な「脆弱性の内容」を確認するには、 公式が提供している API トークンが必要となります。
API トークンは以下のサイトに登録することで、無料で取得することが可能となっています。
なお、無料プランの場合、1日あたりに利用できる API リクエストは 25 回までとなっております。
API トークンをオプションとして指定する場合は以下の通りとなっております。
wpscan --url <対象サイトURL> --api-token <APIトークン>
今回は、意図的に脆弱性が公表されている古いバージョンのプラグイン(Contact Form 7 v3.1.2)をインストールし、結果の差を比較してみます。
通常の検知 #
APIを指定せずに実行した場合、プラグインの検出までは行われますが、脆弱性に関する情報は表示されません。
実行結果は以下の通りとなります。
[+] contact-form-7
| Location: https://xxxxx.xxx/wp-content/plugins/contact-form-7/
| Last Updated: 2025-11-30T07:47:00.000Z
| [!] The version is out of date, the latest version is 6.1.4
|
| Found By: Urls In Homepage (Passive Detection)
| Confirmed By: Urls In 404 Page (Passive Detection)
|
| Version: 3.1.2 (100% confidence)
| Found By: Readme - Stable Tag (Aggressive Detection)
| - https://xxxxx.xxx/wp-content/plugins/contact-form-7/readme.txt
| Confirmed By: Readme - ChangeLog Section (Aggressive Detection)
| - https://xxxxx.xxx/wp-content/plugins/contact-form-7/readme.txt
この結果だけでは、「単にバージョンが古い」という事実しか分かりません。
そのため、これがどれほど危険な状態なのか、あるいはどのような攻撃を受けるリスクがあるのかといった、具体的な判断を下すための情報は不足している状態となります。
APIを利用した詳細検知 #
一方で、API トークンを指定して実行した場合は以下のように表示されます。
[+] contact-form-7
| Location: https://xxxxx.xxx/wp-content/plugins/contact-form-7/
| Last Updated: 2025-11-30T07:47:00.000Z
| [!] The version is out of date, the latest version is 6.1.4
|
| Found By: Urls In Homepage (Passive Detection)
| Confirmed By: Urls In 404 Page (Passive Detection)
|
| [!] 8 vulnerabilities identified:
|
| [!] Title: Contact Form 7 <= 3.7.1 - CAPTCHA Bypass
| Fixed in: 3.7.2
| References:
| - https://wpscan.com/vulnerability/3020e3f1-162f-48f9-ace3-7ba1c7c6b164
| - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-2265
| - https://www.securityfocus.com/bid/66381/
|
| [!] Title: Contact Form 7 <= 3.5.2 - File Upload Remote Code Execution
| Fixed in: 3.5.3
| References:
| - https://wpscan.com/vulnerability/f307ec17-da98-424f-b784-7cb63351aa8e
| - https://packetstormsecurity.com/files/124154/
|
| [!] Title: Contact Form 7 <= 5.0.3 - register_post_type() Privilege Escalation
| Fixed in: 5.0.4
| References:
| - https://wpscan.com/vulnerability/af945f64-9ce2-485c-bf36-c2ff59dc10d5
| - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-20979
| - https://contactform7.com/2018/09/04/contact-form-7-504/
| - https://plugins.trac.wordpress.org/changeset/1935726/contact-form-7
| - https://plugins.trac.wordpress.org/changeset/1934594/contact-form-7
| - https://plugins.trac.wordpress.org/changeset/1934343/contact-form-7
| - https://plugins.trac.wordpress.org/changeset/1934327/contact-form-7
| - https://www.ripstech.com/php-security-calendar-2018/#day-18
|
| [!] Title: Contact Form 7 < 5.3.2 - Unrestricted File Upload
| Fixed in: 5.3.2
| References:
| - https://wpscan.com/vulnerability/7391118e-eef5-4ff8-a8ea-f6b65f442c63
| - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-35489
| - https://www.getastra.com/blog/911/plugin-exploit/contact-form-7-unrestricted-file-upload-vulnerability/
| - https://www.jinsonvarghese.com/unrestricted-file-upload-in-contact-form-7/
| - https://contactform7.com/2020/12/17/contact-form-7-532/#more-38314
|
| [!] Title: Contact Form 7 < 5.8.4 - Authenticated (Editor+) Arbitrary File Upload
| Fixed in: 5.8.4
| References:
| - https://wpscan.com/vulnerability/70e21d9a-b1e6-4083-bcd3-7c1c13fd5382
| - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-6449
| - https://www.wordfence.com/threat-intel/vulnerabilities/id/5d7fb020-6acb-445e-a46b-bdb5aaf8f2b6
|
| [!] Title: Contact Form 7 < 5.9.2 - Reflected Cross-Site Scripting
| Fixed in: 5.9.2
| References:
| - https://wpscan.com/vulnerability/1c070a2c-2ab0-43bf-b10b-6575709918bc
| - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-2242
| - https://www.wordfence.com/threat-intel/vulnerabilities/id/d5bf4972-424a-4470-a0bc-7dcc95378e0e
|
| [!] Title: Contact Form 7 < 5.9.5 - Unauthenticated Open Redirect
| Fixed in: 5.9.5
| References:
| - https://wpscan.com/vulnerability/8bdcdb5a-9026-4157-8592-345df8fb1a17
| - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-4704
|
| [!] Title: Contact Form 7 < 6.0.6 - Order Replay Vulnerability
| Fixed in: 6.0.6
| References:
| - https://wpscan.com/vulnerability/7dbafbe2-abbc-4191-a587-afa89c2f7421
| - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-3247
| - https://www.wordfence.com/threat-intel/vulnerabilities/id/38257dbf-288e-4028-af65-85f5389888ac
|
| Version: 3.1.2 (100% confidence)
| Found By: Readme - Stable Tag (Aggressive Detection)
| - https://xxxxx.xxx/wp-content/plugins/contact-form-7/readme.txt
| Confirmed By: Readme - ChangeLog Section (Aggressive Detection)
| - https://xxxxx.xxx/wp-content/plugins/contact-form-7/readme.txt
API を利用することで、バージョン情報に加えて、以下のような具体的な「脆弱性の情報」を確認する事ができます。
- 脆弱性の総数
- 具体的な攻撃内容の名称
- 修正されたバージョン
- CVE番号などの情報源
これにより、「すぐに対応が必要な脆弱性が存在するか」「どのバージョンへアップデートすべきか」までを正確に把握でき、効率的なセキュリティ対策を行うことが可能となります。
詳細に調査する方法 #
WPScan には、特定の情報を能動的に探し出すための enumerate オプションが用意されています。
この機能を利用することで、セキュリティ上重要な情報を詳細に洗い出すことが可能となっています。
利用方法は以下の通りとなっております。
wpscan --url <対象サイトURL> --api-token <APIトークン> -e <項目>
enumerate にて指定できる項目は以下の通りとなっております。
| オプション | 説明 |
|---|---|
vp |
脆弱性のあるプラグインを調べる |
ap |
すべてのプラグインを確認する |
p |
人気のプラグインだけ確認する |
vt |
脆弱性のあるテーマを調べる |
at |
すべてのテーマを確認する |
t |
人気のテーマだけ確認する |
tt |
Timthumb の脆弱性スクリプトを検出 |
cb |
設定ファイルのバックアップを探す |
dbe |
データベースエクスポートファイルを確認 |
u |
ユーザーIDを列挙する |
m |
メディアIDを列挙する |
例えば、ユーザーIDのみを単体で調査したい場合は、以下のように実行することで確認できます。
wpscan --url <対象サイトURL> --api-token <APIトークン> -e u
このコマンドを実行すると、WordPress サイトに登録されているユーザー名の特定が行われます。
以下は出力例となります。
[+] demo-admin
| Found By: Rss Generator (Passive Detection)
| Confirmed By:
| Wp Json Api (Aggressive Detection)
| - https://xxxxx.xxx/wp-json/wp/v2/users/?per_page=100&page=1
| Rss Generator (Aggressive Detection)
この結果から、demo-admin というユーザーアカウントが外部から確認可能であることが分かります。
また、複数の項目をまとめて調査したい場合は、以下のようにカンマ区切りで項目を指定することができます。
wpscan --url <対象サイトURL> --api-token <APIトークン> -e vp,vt,cb,dbe,u