【Kali linux】WPScan + APIでWordPressを脆弱性診断した結果

Kali linux + WPScan + APIでデフォルト状態のWordPressを脆弱性診断した結果をまとめました。

スポンサーリンク

はじめに

注意事項

本記事で紹介する脆弱性診断を許可を得ずに他人や団体、インフラなどへ行った場合、犯罪となる可能性が有ります。
あくまでも、本記事の内容は学習用であるため、脆弱性診断は自身のシステムに対して、自己責任で実施してください。

今回は、私が所有しているWordPress製サイトの脆弱性診断をWPSCANで行います。

スポンサーリンク

WPScanの実行結果

以下のコマンドを実行します。

$ wpscan --url 診断対象のアドレス --api-token XXXXXX

ユーザ一覧を表示したい場合、以下のようにオプションを設定し、Enumerate usersモード(ユーザー一覧表示モード)で実行します。

$ wpscan --url 診断対象のアドレス  --enumerate u --api-token XXXXXX

APIトークン(XXXXXX)はWPSCANに無料会員登録して入手する必要があります。
方法は以下ページで解説しています。

【WPScan】WordPress Vulnerability Database APIの取得方法
WPScanにおけるWordPress Vulnerability Database APIの取得方法をまとめました。
スポンサーリンク

HTTPヘッダからWebサーバが特定

[+] Headers
 | Interesting Entries:
 |  - server: nginx
 |  - x-mod-pagespeed: Powered By XPageSpeed
 | Found By: Headers (Passive Detection)
 | Confidence: 100%

Webサーバの種類が特定されました。
特にWebサーバのバージョンがばれると、そのバージョンに存在する脆弱性から攻撃を受ける危険があります。
バージョンを見せないようにすることができます。詳細は以下ページで紹介しています。

【WordPress】Webサーバーのバージョンを見えないようにする方法
WordPressがあるWebサーバーのバージョンを見えないようにする方法をまとめました。

robots.txtが存在

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

xmlrpc.phpが有効

[+] XML-RPC seems to be enabled: 診断対象のアドレス/xmlrpc.php
 | Found By: Direct Access (Aggressive Detection)
 | Confidence: 100%
 | References:
 |  - http://codex.wordpress.org/XML-RPC_Pingback_API
 |  - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_ghost_scanner/
 |  - https://www.rapid7.com/db/modules/auxiliary/dos/http/wordpress_xmlrpc_dos/
 |  - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_xmlrpc_login/
 |  - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_pingback_access/

xmlrpc.phpファイルが有効になっています。
xmlrpc.phpファイルは、WordPressのシステムと遠隔に通信する機能をもち、「スマホアプリからのリモート投稿」「ピンバック」「トラックバック」に使用されます。
しかしながら、DoS攻撃に悪用されてしまう可能性があるため、リモート投稿等することがなければ、無効にします。

やり方は以下のページで解説しています。

【WordPress】xmlrpc.phpを無効化する方法
WordPressのセキュリティ対策として、xmlrpc.phpを無効化する方法をまとめました。

readme.htmlがアクセス可能

[+] WordPress readme found: 診断対象のアドレス/readme.html
 | Found By: Direct Access (Aggressive Detection)
 | Confidence: 100%

デフォルト状態のWordPressには、インストールしたディレクトリにreadme.htmlファイルがあり、それにアクセス可能になっています。
readme.htmlには、ログイン画面のURLなどが記載されているため、削除するのが望ましいです。

Uploadディレクトリがアクセス可能

[+] Upload directory has listing enabled: 診断対象のアドレス/wp-content/uploads/
 | Found By: Direct Access (Aggressive Detection)
 | Confidence: 100%

上記メッセージは、Uploadディレクトリにアクセス可能になってることを示します。

wp-cron.phpファイルが有効になっている

[+] The external WP-Cron seems to be enabled: 診断対象のアドレス/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

上記メッセージは、wp-cron.phpファイルが有効になっていることを示します。
wp-cron.phpは、WordPressで「予約投稿」「バックアップ処理」「自動更新」「XML-Sitemap」などに使用されます。
通常はサイトへのアクセスがあるたびに実行されるため、アクセスが多いサイトの場合は無駄に負荷が増えてパフォーマンスが低下する可能性があります。
また、DDoS攻撃に悪用される危険性があるため、wp-cron.phpを無効化し、Webサーバー側のcronでwp-cron.phpを一定時間毎にだけ実行するようにするのがおすすめです。

【WordPress】wp-cron.phpを無効化し、cronで定期実行する方法
WordPressのwp-cron.phpを無効化し、cronで定期実行する方法をまとめました。

WordPressのバージョンが判明

[+] WordPress version 6.4.2 identified (Latest, released on 2023-12-06).
 | Found By: Emoji Settings (Passive Detection)
 |  - 診断対象のアドレス/, Match: 'wp-includes\/js\/wp-emoji-release.min.js?ver=6.4.2'
 | Confirmed By: Meta Generator (Passive Detection)
 |  - 診断対象のアドレス/, Match: 'WordPress 6.4.2'

→ WordPressのバージョンが6.4.2(診断時は最新版)

テーマが判明

[+] WordPress theme in use: cocoon-master
 | Location: https://XXX.XXX/wp-content/themes/cocoon-master/
 | Readme: https://XXX.XXX/wp-content/themes/cocoon-master/readme.md
 | Style URL: https://XXX.XXX/wp-content/themes/cocoon-master/style.css?ver=6.4.2&fver=20231123123730
 | 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.6.9 (80% confidence)
 | Found By: Style (Passive Detection)
 |  - https://XXX.XXX/wp-content/themes/cocoon-master/style.css?ver=6.4.2&fver=20231123123730, Match: 'Version: 2.6.9'

使用しているテーマとバージョンが特定されました。

プラグインが判明

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

[i] Plugin(s) Identified:

[+] google-site-kit
 | Location: https://XXX.XXX/wp-content/plugins/google-site-kit/
 | Latest Version: 1.118.0 (up to date)
 | Last Updated: 2024-01-16T20:06:00.000Z
 |
 | Found By: Meta Tag (Passive Detection)
 |
 | Version: 1.118.0 (100% confidence)
 | Found By: Meta Tag (Passive Detection)
 |  - https://XXX.XXX/, Match: 'Site Kit by Google 1.118.0'
 | Confirmed By:
 |  Readme - Stable Tag (Aggressive Detection)
 |   - https://XXX.XXX/wp-content/plugins/google-site-kit/readme.txt
 |  Readme - ChangeLog Section (Aggressive Detection)
 |   - https://XXX.XXX/wp-content/plugins/google-site-kit/readme.txt

[+] wp-quicklatex
 | Location: https://XXX.XXX/wp-content/plugins/wp-quicklatex/
 | Latest Version: 3.8.6 (up to date)
 | Last Updated: 2023-09-10T00:06:00.000Z
 |
 | Found By: Urls In Homepage (Passive Detection)
 | Confirmed By: Urls In 404 Page (Passive Detection)
 |
 | Version: 3.8.6 (80% confidence)
 | Found By: Readme - Stable Tag (Aggressive Detection)
 |  - https://XXX.XXX/wp-content/plugins/wp-quicklatex/readme.txt

使用しているプラグインの一部が判明しました。

ログインユーザー名が特定

[+] Enumerating Users (via Passive and Aggressive Methods)
 Brute Forcing Author IDs - Time: 00:00:04 <==> (10 / 10) 100.00% Time: 00:00:04

[i] User(s) Identified:

[+] USERNAME
 | Found By: Author Posts - Author Pattern (Passive Detection)
 | Confirmed By:
 |  Rss Generator (Passive Detection)
 |  Oembed API - Author URL (Aggressive Detection)
 |   - https://XXX.XXX/wp-json/oembed/1.0/embed?url=https://XXX.XXX/&format=json
 |  Rss Generator (Aggressive Detection)
【WPScan】ユーザー名をスキャンされないようにする方法
WPScanでユーザー名をスキャンされないようにする方法についてまとめました。

Configのバックアップ

[+] Enumerating Config Backups (via Passive and Aggressive Methods)
 Checking Config Backups - Time: 00:00:00 <=> (137 / 137) 100.00% Time: 00:00:00

[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

Configのバックアップは無いという結果でした。

関連記事

【Kali Linux】WPScanでWordPressの脆弱性診断を行う方法
Kali LinuxのWPScanでWordPressの脆弱性診断を行う方法を初心者向けに解説します。
【Kali linux】脆弱性診断する方法を初心者向けに解説
Ubuntuの使い方を初心者向けに解説します。
【WordPress入門】初心者向けの使い方を解説
WordPressでWebサイトを作成する方法を入門者向けに解説します。
Linux
スポンサーリンク

コメント