background-image

WordPressの脆弱性を簡単チェック!WPScanの使い方を徹底解説

WordPressの脆弱性を簡単チェック!WPScanの使い方を徹底解説

WPScanとは何か?基本情報と仕組み

WordPressサイトのセキュリティを守るために、まず知っておきたいのが「WPScan(ダブリューピースキャン)」です。
WPScanは、WordPressに特化した脆弱性スキャナーで、サイト内に潜むリスクを検出できる便利なツールです。

WPScanの特徴3つ
  • WordPress専用のスキャナーであること
  • オープンソースで無料利用が可能
  • 最新の脆弱性情報と連携

たとえば、特定のプラグインに既知の脆弱性がある場合、WPScanはそれを瞬時に検出して警告してくれます。
自分のサイトのどこに問題があるのか」がすぐに分かるため、初心者でも具体的な対策に取り組みやすくなります。

なぜWPScanを使うべきか?WordPressの脆弱性事情

WordPressは、世界中のWebサイトの約40%以上で利用されている、非常に人気のあるCMS(コンテンツ管理システム)です。
その一方で、利用者が多い=攻撃対象にされやすいというリスクも抱えています。

特に狙われやすいのが、古いプラグインやテーマ、アップデートされていない本体です。
たとえば、人気プラグインに致命的な脆弱性が見つかり、数万以上のサイトが不正アクセスの被害を受けたというケースも実際に報告されています。

「ちゃんと自動更新を設定しているから大丈夫」と思っていませんか?
実は、以下のような見落としが、セキュリティの穴となってしまうことも少なくありません。

WPScanの特徴3つ
  • 自動更新の対象外になっているプラグインがある
  • 使っていない古いテーマが放置されたまま
  • サイトのバージョン情報が公開されていて、ハッカーに狙われるリスクがある

WPScanを使えば、こうした見えにくいセキュリティリスクを「見える化」できます。
脆弱なプラグインが検出された場合、その詳細や発見された日付、危険度などが具体的に表示され、対応すべきかどうかがすぐに判断できます。

セキュリティ対策の第一歩は、「今の自分のサイトがどれだけ安全か」を知ること。
WPScanは、その判断を助けてくれる、強力なチェックツールなのです。

DockerでWPScanを導入する手順

WPScanはローカルに直接インストールしなくても、Dockerを使えば環境を汚さずに簡単に実行できます。
ここでは、Dockerを活用してWPScanを導入・実行する手順を解説します。

1.Dockerの事前準備

まず、DockerがPCにインストールされている必要があります。
以下のリンクから、OSに応じたDocker Desktopをインストールしてください。

docker-desktop公式サイトのスクリーンショット

ここでは詳細なdocker-desktopの詳細は省きますが下記のサイト等を参考にすればインストールできると思います。

WindowsでのDocker Desktopのインストール方法

macでのDocker Desktopのインストール方法

インストール後、以下のコマンドでDockerが動作しているか確認します。

docker --version

2.WPScanのDockerイメージを取得

WPScanの公式Dockerイメージは、wpscanteam/wpscan という名前で公開されています。以下のコマンドで取得できます。

docker pull wpscanteam/wpscan

正常にイメージが取得されていればDocker Desktopのimagesタブに表示されていると思います。

APIキーの取得と環境変数での設定

WPScanのAPIキーは、脆弱性情報を取得するために必要です。
以下から無料のAPIキーを取得できます。

WPScanは内部に脆弱性データベースを持っており、そのデータベースにアクセスするために「APIトークン(APIキー)」を使います。

APIキーでできること
  • WordPressのバージョンに応じた脆弱性の特定
  • 使用中のプラグインやテーマに潜む既知の脆弱性の取得
  • 脆弱性の深刻度(CVSSスコア)や説明文の表示

無料版のAPIキーでは1日のリクエスト数が25までと制限されています。
個人のサイト診断や学習用途であれば、無料プランで十分です。
ただし、複数サイトを毎日スキャンする場合などは、上限に注意が必要です。

① WPScanの公式サイトで無料登録

WPScanの公式サイトでアカウントを作成します。

アカウントを作成し終えるとprofile画面に移動できるようになります。

下記のようにAPIキーが表示されるので、どこかにコピーしておくと良いでしょう。

ここまでできればとりあえずWPScanを使うための準備は完了です。
次は実際にサイトをスキャンする方法について解説していきます。

DockerでWPScanを実行してみよう

まず基本的なコマンドは以下の通りです。

docker run --rm wpscanteam/wpscan --url https://example.com --api-token あなたのAPIキー

このコマンドにより、対象のWordPressサイトに対して脆弱性スキャンが実行されます。
Dockerが終了すると、スキャン結果がターミナル上に表示されます。

一例ですが、下記のようにスキャン結果が表示されます。

         __          _______   _____
         \ \        / /  __ \ / ____|
          \ \  /\  / /| |__) | (___   ____ _ _ __ ®
           \ \/  \/ / |  ___/ \___ \ / __|/ _` | '_ \
            \  /\  /  | |     ____) | (__| (_| | | | |
             \/  \/   |_|    |_____/ \___|\__,_|_| |_|

         WordPress Security Scanner by the WPScan Team
                         Version 3.8.28
       Sponsored by Automattic - https://automattic.com/
       @_WPScan_, @ethicalhack3r, @erwan_lr, @firefart
_______________________________________________________________

[i] It seems like you have not updated the database for some time.

[+] URL: https://[xxxxx.xxxxxx.xxx]/ [xxx.xx.xxx.xx]
[+] Started: Sat Apr 26 01:39:07 2025

Interesting Finding(s):

[+] Headers
 | Interesting Entry: server: nginx
 | Found By: Headers (Passive Detection)
 | Confidence: 100%

[+] robots.txt found: https://[xxxxx.xxxxxx.xxx]/robots.txt
 | Interesting Entries:
 |  - /wp-admin/
 |  - /wp-admin/admin-ajax.php
 | Found By: Robots Txt (Aggressive Detection)
 | Confidence: 100%

[+] WordPress readme found: https://[xxxxx.xxxxxx.xxx]/readme.html
 | Found By: Direct Access (Aggressive Detection)
 | Confidence: 100%

[+] The external WP-Cron seems to be enabled: https://[xxxxx.xxxxxx.xxx]/wp-cron.php
 | Found By: Direct Access (Aggressive Detection)
 | Confidence: 60%
 | References:
 |  - https://www.iplocation.net/defend-wordpress-from-ddos
 |  - https://github.com/wpscanteam/wpscan/issues/1299

[+] WordPress version 6.7.1 identified (Outdated, released on 2024-11-21).
 | Found By: Query Parameter In Install Page (Aggressive Detection)
 |  - https://[xxxxx.xxxxxx.xxx]/wp-includes/css/dashicons.min.css?ver=6.7.1
 |  - https://[xxxxx.xxxxxx.xxx]/wp-includes/css/buttons.min.css?ver=6.7.1
 |  - https://[xxxxx.xxxxxx.xxx]/wp-admin/css/forms.min.css?ver=6.7.1
 |  - https://[xxxxx.xxxxxx.xxx]/wp-admin/css/l10n.min.css?ver=6.7.1
 |  - https://[xxxxx.xxxxxx.xxx]/wp-admin/css/install.min.css?ver=6.7.1

[+] WordPress theme in use: myportfolio
 | Location: https://[xxxxx.xxxxxx.xxx]/wp-content/themes/myportfolio/
 | Style URL: https://[xxxxx.xxxxxx.xxx]/wp-content/themes/myportfolio/style.css
 | Description: フリーランス活動用のポートフォリオサイト...
 | Author: [xxxx xxxxxxx]
 |
 | Found By: Urls In Homepage (Passive Detection)
 | Confirmed By: Urls In 404 Page (Passive Detection)
 |
 | Version: 1.0.0 (80% confidence)
 | Found By: Style (Passive Detection)
 |  - https://[xxxxx.xxxxxx.xxx]/wp-content/themes/myportfolio/style.css, Match: 'Version: 1.0.0'

[+] Enumerating All Plugins (via Passive Methods)
[+] Checking Plugin Versions (via Passive and Aggressive Methods)

[i] Plugin(s) Identified:

[+] ewww-image-optimizer
 | Location: https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/ewww-image-optimizer/
 | Latest Version: 8.1.3 (up to date)
 | Last Updated: 2025-03-26T16:34:00.000Z
 |
 | Found By: Urls In Homepage (Passive Detection)
 | Confirmed By: Urls In 404 Page (Passive Detection)
 |
 | Version: 8.1.3 (100% confidence)
 | Found By: Readme - Stable Tag (Aggressive Detection)
 |  - https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/ewww-image-optimizer/readme.txt
 | Confirmed By: Readme - ChangeLog Section (Aggressive Detection)
 |  - https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/ewww-image-optimizer/readme.txt

[+] highlighting-code-block
 | Location: https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/highlighting-code-block/
 | Latest Version: 2.0.1 (up to date)
 | Last Updated: 2023-11-12T15:03:00.000Z
 |
 | Found By: Urls In Homepage (Passive Detection)
 | Confirmed By: Urls In 404 Page (Passive Detection)
 |
 | Version: 2.0.1 (100% confidence)
 | Found By: Readme - Stable Tag (Aggressive Detection)
 |  - https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/highlighting-code-block/readme.txt
 | Confirmed By: Readme - ChangeLog Section (Aggressive Detection)
 |  - https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/highlighting-code-block/readme.txt

[+] seo-simple-pack
 | Location: https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/seo-simple-pack/
 | Latest Version: 3.6.2 (up to date)
 | Last Updated: 2024-12-11T15:24:00.000Z
 |
 | Found By: Comment (Passive Detection)
 |
 | Version: 3.6.2 (100% confidence)
 | Found By: Comment (Passive Detection)
 |  - https://[xxxxx.xxxxxx.xxx]/, Match: 'SEO SIMPLE PACK 3.6.2'
 | Confirmed By:
 |  Readme - Stable Tag (Aggressive Detection)
 |   - https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/seo-simple-pack/readme.txt
 |  Readme - ChangeLog Section (Aggressive Detection)
 |   - https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/seo-simple-pack/readme.txt

[+] wordpress-popular-posts
 | Location: https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/wordpress-popular-posts/
 | Latest Version: 7.3.1 (up to date)
 | Last Updated: 2025-04-10T14:55:00.000Z
 |
 | Found By: Urls In Homepage (Passive Detection)
 | Confirmed By: Urls In 404 Page (Passive Detection)
 |
 | Version: 7.3.1 (80% confidence)
 | Found By: Readme - Stable Tag (Aggressive Detection)
 |  - https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/wordpress-popular-posts/readme.txt

[+] Enumerating Config Backups (via Passive and Aggressive Methods)

 Checking Config Backups -: |==================================================|

[i] No Config Backups Found.

[+] WPScan DB API OK
 | Plan: free
 | Requests Done (during the scan): 6
 | Requests Remaining: 19

[+] Finished: Sat Apr 26 01:39:25 2025
[+] Requests Done: 196
[+] Cached Requests: 7
[+] Data Sent: 45.684 KB
[+] Data Received: 535.305 KB
[+] Memory used: 262.145 MB
[+] Elapsed time: 00:00:17

ここでいくつかのスキャン結果について見ていきましょう。

[+] robots.txt found: https://[xxxxx.xxxxxx.xxx]/robots.txt
 | Interesting Entries:
 |  - /wp-admin/
 |  - /wp-admin/admin-ajax.php
 | Found By: Robots Txt (Aggressive Detection)
 | Confidence: 100%

例えば上記の結果は、検索エンジンのクローラーに対して、どのページをクロールして良いか(またはしないで欲しいか)を指示するファイル robots.txt が見つかったという結果になります。
ここでは、WordPressの管理画面 (/wp-admin/) や特定の機能 (admin-ajax.php) へのクロールを拒否する設定が見られます。

[+] The external WP-Cron seems to be enabled: https://[xxxxx.xxxxxx.xxx]/wp-cron.php
 | Found By: Direct Access (Aggressive Detection)
 | Confidence: 60%
 | References:
 |  - https://www.iplocation.net/defend-wordpress-from-ddos
 |  - https://github.com/wpscanteam/wpscan/issues/1299

上記はWordPressの予約投稿や定期的なタスクを実行する機能 WP-Cron が、外部からアクセスできる wp-cron.php を使って動作しているという意味です。(ただし情報の信頼度は60%程度)
アクセスが多いサイトではサーバー負荷の原因になったり、場合によってはDDoS攻撃の踏み台にされる可能性も指摘されています。

[+] WordPress version 6.7.1 identified (Outdated, released on 2024-11-21).
 | Found By: Query Parameter In Install Page (Aggressive Detection)
 |  - https://[xxxxx.xxxxxx.xxx]/wp-includes/css/dashicons.min.css?ver=6.7.1
 |  - https://[xxxxx.xxxxxx.xxx]/wp-includes/css/buttons.min.css?ver=6.7.1
 |  - https://[xxxxx.xxxxxx.xxx]/wp-admin/css/forms.min.css?ver=6.7.1
 |  - https://[xxxxx.xxxxxx.xxx]/wp-admin/css/l10n.min.css?ver=6.7.1
 |  - https://[xxxxx.xxxxxx.xxx]/wp-admin/css/install.min.css?ver=6.7.1

このあたりの結果はセキュリティ的にも非常に重要になります。
これはサイトで使われているWordPress本体のバージョンが 6.7.1 であることが特定されたということです。
このバージョンは2024年11月21日にリリースされたもので、スキャン時点(2025年4月)では古い(Outdated)と判定されています
古いバージョンはセキュリティ上の脆弱性が存在する可能性が高いので、速やかな更新が推奨されます。
バージョン情報は、CSSファイルのURLに含まれる ?ver=6.7.1 のようなパラメータから特定されました。

[+] wordpress-popular-posts
 | Location: https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/wordpress-popular-posts/
 | Latest Version: 7.3.1 (up to date)
 | Last Updated: 2025-04-10T14:55:00.000Z
 | Found By: Urls In Homepage (Passive Detection)
 | Confirmed By: Urls In 404 Page (Passive Detection)
 | Version: 7.3.1 (80% confidence)
 | Found By: Readme - Stable Tag (Aggressive Detection)
 |  - https://[xxxxx.xxxxxx.xxx]/wp-content/plugins/wordpress-popular-posts/readme.txt

プラグインのスキャン結果もセキュリティとして非常に重要なので一緒に見ていきましょう。
上記の結果はプラグイン wordpress-popular-posts (人気記事表示プラグイン) が使用されていということです。
バージョンは 7.3.1 で、最新版であることが確認されています。最終更新日は2025年4月10日です。
バージョン情報はプラグインのreadmeファイルから特定されました(確信度80%)。とのことです。

このような形でスキャン結果はすべて英語で表示されて難しく感じるかと思いますが、ChatGPTなどのAIを使って質問したり、
Google検索を利用して調べるなどすればそこまで手間はかからず内容を把握できるかと思います。

WPScanの主なオプション一覧

さらに追加でこれらのオプションを組み合わせることで、目的に合わせた柔軟なスキャンが可能になります。
脆弱性の早期発見と対策の第一歩として、WPScanはとても頼れるツールといえるでしょう。

オプション説明使用例
–urlスキャン対象のURLを指定–url https://example.com
–api-tokenWPScanのAPIキーを指定–api-token あなたのAPIキー
–enumerate uユーザー名の列挙を行う–enumerate u
–enumerate pプラグインの列挙–enumerate p
–enumerate tテーマの列挙–enumerate t
–enumerate vp脆弱なプラグインの列挙–enumerate vp
–enumerate vt脆弱なテーマの列挙–enumerate vt
–format json出力形式をJSONに指定–format json
–outputスキャン結果の出力ファイルを指定–output /wpscan/result.json
–forceターゲットがWordPressかを強制無視してスキャン実行–force
–random-user-agentユーザーエージェントをランダムにする–random-user-agent

例えば、脆弱性のあるプラグインがあるかどうかの検証をしたい場合は下記のようにコマンドを打ちます。

docker run --rm wpscanteam/wpscan --url https://example.com ―e vp --api-token あなたのAPIキー

すると結果は下記のようになりました。

         __          _______   _____
         \ \        / /  __ \ / ____|
          \ \  /\  / /| |__) | (___   ____ _ _ __ ®
           \ \/  \/ / |  ___/ \___ \ / __|/ _` | '_ \
            \  /\  /  | |     ____) | (__| (_| | | | |
             \/  \/   |_|    |_____/ \___|\__,_|_| |_|

         WordPress Security Scanner by the WPScan Team
                         Version 3.8.28
       Sponsored by Automattic - https://automattic.com/
       @_WPScan_, @ethicalhack3r, @erwan_lr, @firefart
_______________________________________________________________

[i] It seems like you have not updated the database for some time.

[+] URL: https://[xxxxx.xxxxxx.xxx]/ [xxx.xx.xxx.xx]
[+] Started: Sat Apr 26 02:19:30 2025

Interesting Finding(s):

[+] Headers
 | Interesting Entry: server: nginx
 | Found By: Headers (Passive Detection)
 | Confidence: 100%

[+] robots.txt found: https://[xxxxx.xxxxxx.xxx]/robots.txt
 | Interesting Entries:
 |  - /wp-admin/
 |  - /wp-admin/admin-ajax.php
 | Found By: Robots Txt (Aggressive Detection)
 | Confidence: 100%

[+] WordPress readme found: https://[xxxxx.xxxxxx.xxx]/readme.html
 | Found By: Direct Access (Aggressive Detection)
 | Confidence: 100%

[+] The external WP-Cron seems to be enabled: https://[xxxxx.xxxxxx.xxx]/wp-cron.php
 | Found By: Direct Access (Aggressive Detection)
 | Confidence: 60%
 | References:
 |  - https://www.iplocation.net/defend-wordpress-from-ddos
 |  - https://github.com/wpscanteam/wpscan/issues/1299

[+] WordPress version 6.7.1 identified (Outdated, released on 2024-11-21).
 | Found By: Query Parameter In Install Page (Aggressive Detection)
 |  - https://[xxxxx.xxxxxx.xxx]/wp-includes/css/dashicons.min.css?ver=6.7.1
 |  - https://[xxxxx.xxxxxx.xxx]/wp-includes/css/buttons.min.css?ver=6.7.1
 |  - https://[xxxxx.xxxxxx.xxx]/wp-admin/css/forms.min.css?ver=6.7.1
 |  - https://[xxxxx.xxxxxx.xxx]/wp-admin/css/l10n.min.css?ver=6.7.1
 |  - https://[xxxxx.xxxxxx.xxx]/wp-admin/css/install.min.css?ver=6.7.1

[+] WordPress theme in use: myportfolio
 | Location: https://[xxxxx.xxxxxx.xxx]/wp-content/themes/myportfolio/
 | Style URL: https://[xxxxx.xxxxxx.xxx]/wp-content/themes/myportfolio/style.css
 | Description: フリーランス活動用のポートフォリオサイト...
 | Author: [xxxx xxxxxxx]
 |
 | Found By: Urls In Homepage (Passive Detection)
 | Confirmed By: Urls In 404 Page (Passive Detection)
 |
 | Version: 1.0.0 (80% confidence)
 | Found By: Style (Passive Detection)
 |  - https://[xxxxx.xxxxxx.xxx]/wp-content/themes/myportfolio/style.css, Match: 'Version: 1.0.0'

[+] Enumerating Vulnerable Plugins (via Passive Methods)
# 脆弱性のあるプラグインを列挙しようとしています(受動的な方法で)。

[+] Checking Plugin Versions (via Passive and Aggressive Methods)
# プラグインのバージョンを確認しようとしています(受動的および積極的な方法で)。

[i] No plugins Found.
# スキャンの結果、プラグインが見つからなかったか、特定できませんでした。

[+] WPScan DB API OK
 | Plan: free
 | Requests Done (during the scan): 6
 | Requests Remaining: 13

[+] Finished: Sat Apr 26 02:19:41 2025
[+] Requests Done: 59
[+] Cached Requests: 7
[+] Data Sent: 14.67 KB
[+] Data Received: 488.23 KB
[+] Memory used: 248.422 MB
[+] Elapsed time: 00:00:11
[i] No plugins Found.

これは脆弱性のあるプラグインは発見されなかったということです。

見つかった脆弱性にどう対応する?WPScanの応用的な使い方

WPScanを使って脆弱性を検出した後、その対応方法を理解しておくことが重要です。
検出された脆弱性に対する対応方法と、WPScanのさらに応用的な使い方について解説します。

脆弱性が見つかった場合の対処方法

1. プラグイン・テーマの更新

脆弱性が見つかった場合は、まずそのプラグインやテーマを最新バージョンに更新しましょう。
多くの場合、セキュリティ問題は新しいバージョンで修正されており、アップデートが最も効果的な対処法です。

2. プラグインやテーマの削除

もし、更新ができない、もしくは更新されないプラグインやテーマを使用している場合は、そのプラグインやテーマの使用を中止し、代替案に切り替えましょう。

3. 設定の見直し

WPScanは、セキュリティリスクを引き起こす設定や、公開されている管理者情報についても警告を出します。
これらについては、設定を見直すことで改善できます。
例えば、wp-config.php ファイルのパスワード設定を強化したり、不要なユーザーアカウントを削除したりすることが重要です。

WPScanは、WordPressサイトのセキュリティ管理に欠かせないツールです。定期的なスキャンを通じて脆弱性を早期に発見し、迅速な対策を講じることで、サイトを安全に保つことができます。

WPScanでWordPressのセキュリティを強化しよう!

WordPressは、世界中で最も使用されているCMSである一方で、セキュリティリスクも多く存在します。
WPScanは、WordPressのセキュリティを強化するために非常に有用なツールであり、脆弱性の早期発見と対策を行うために活用できます。

本記事では、WPScanの基本的な使い方から、検出された脆弱性への対処法、さらに応用的な使用法まで、実際に利用できる方法を段階的に解説しました。

脆弱性を発見した場合の対処法

WPScanで脆弱性を発見した場合、最も重要なのは「アップデート」です。
プラグインやテーマを最新バージョンに更新することで、多くのセキュリティ問題が解決します。
また、更新不可能な場合は、代替のプラグインやテーマに切り替えることが推奨されます。
設定ミスや公開された管理者情報についても見直し、サイトのセキュリティをさらに強化しましょう。

セキュリティを強化するために

WPScanを定期的に使用し、サイトの脆弱性を早期に発見して対策を講じることで、攻撃からサイトを守り、ユーザーの信頼を維持することができます。
セキュリティは一度設定して終わりではなく、常に見直し、更新し続ける必要があります
WPScanを活用し、安全なWordPressサイト運営を心がけましょう。

©UCHIWA Creative Studio.all rights reserved.