Webサイトの脆弱性診断をやってみた_WPScan

30代未経験ネットワークエンジニアのshin@セキュリティエンジニアになるため、勉強中です。

今回は、Kali Linuxの「WPScan」を使用して、WordPressの脆弱性の診断をやってみました。
※Kali Linuxのインストール手順は割愛します。

WPScanとは

WPScanとは、セキュリティの専門家やブログ管理者がサイトのセキュリティをテストするために作成したWordPress脆弱性スキャナで、無料のサービスだそうです。

WPScanのサイトにある説明は以下のように記載されています。

WPScan is a free, for non-commercial use, black box WordPress vulnerability scanner written for security professionals and blog maintainers to test the security of their sites.

簡単に言えば、WordPressのサイトに悪意のある人から攻撃されるような問題(欠陥)がないかを自動で確認するツールということです。

WPScanを使って何ができるのか?

WPScanを使用することにより以下のようなことが出来ます。

  1. 自分のサイト(WordPress)に脆弱性がないかを確認できる
  2. ログインユーザを検索し、パスワード攻撃ができる
  3. 脆弱性があった場合に対応することでセキュリティを強化することができる

環境

・ターゲット用WordPress(OWASPBWA)
・攻撃用PC(Kali Linux)

構成

今回の目的

今回の目的は、ターゲットPCのWordPressサイトに対して、WPScanを行い脆弱性の情報を確認までを行うことを目的とします。
脆弱性をどのように使用して攻撃するかは別途、書きたいと思います。

それでは、WPScanをやってみたいと思います。
※許可なしに人のサイトでやるのはやめてください。迷惑がかかるので自分のサイトまたは、自宅の環境で行ってください!

事前準備

まずは、診断するための、攻撃される用のテスト用WordPressを作成します。
テスト用のサイトは、「OWASPBWA」というものを使用します。

以下サイトよりダウンロードし、起動します。https://sourceforge.net/projects/owaspbwa/files/

起動したことを確認し、対象のIPアドレスを確認。
※今回の対象のWordPressのURLは「192.168.89.148/wordpress」となります。

それでは、実際にWPScanを実行してみましょう

手順

  1. Kali Linuxの「アプリケーション」>「03-Web Application Analysis」>「wpscan」を選択
  2. 次のコマンドを実行します。
    wpscan –url http://192.168.89.148/wordpress/
    ※その他の詳細なコマンドなどは、公式ページを参照するか、「wpscan –help」で確認ください
  3. 実行後、「DBをUpdateしますか?」と出ますが、気にせずEnterで実行
  4. 自動で診断が始まるので、結果を確認
  5. 実行後、結果を確認
    以下のような結果になりました。
    ※長すぎるので、抜粋しています。

ここから——————————

root@kali-test:~# wpscan –url http://192.168.89.148/wordpress/
_______________________________

[i] It seems like you have not updated the database for some time
[i] Last database update: 2018-07-17
[?] Do you want to update now? [Y]es [N]o [A]bort update, default: [N] >
[+] URL: http://192.168.89.148/wordpress/
[+] Started: Mon Sep 17 15:59:29 2018

[+] Interesting header: SERVER: Apache/2.2.14 (Ubuntu) mod_mono/2.4.3 PHP/5.3.2-1ubuntu4.30 with Suhosin-Patch proxy_html/3.0.1 mod_python/3.3.1 Python/2.6.5 mod_ssl/2.2.14 OpenSSL/0.9.8k Phusion_Passenger/4.0.38 mod_perl/2.0.4 Perl/v5.10.1
[+] Interesting header: STATUS: 200 OK
[+] Interesting header: X-POWERED-BY: PHP/5.3.2-1ubuntu4.30
[+] XML-RPC Interface available under: http://192.168.89.148/wordpress/xmlrpc.php [HTTP 200]
[+] Found an RSS Feed: http://192.168.89.148/wordpress/?feed=rss2 [HTTP 200]
[!] Detected 1 user from RSS feed:
+——-+
| Name |
+——-+
| admin |
+——-+
[!] Includes directory has directory listing enabled: http://192.168.89.148/wordpress/wp-includes/

[+] Enumerating WordPress version …
[!] The WordPress ‘http://192.168.89.148/wordpress/readme.html’ file exists exposing a version number

[+] WordPress version 2.0 (Released on 2007-09-24) identified from meta generator, links opml, advanced fingerprinting
[!] 15 vulnerabilities identified from the version number

[!] Title: WordPress 1.5.1 – 2.0.2 wp-register.php Multiple Parameter XSS
Reference: https://wpvulndb.com/vulnerabilities/6033
Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-5105
Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-5106
[i] Fixed in: 2.0.2

~~~~~~~~~~~~~~~~~~~~~~~~~~
省略

[+] Enumerating plugins from passive detection …
| 1 plugin found:

[+] Name: mygallery
| Location: http://192.168.89.148/wordpress/wp-content/plugins/mygallery/
| Changelog: http://192.168.89.148/wordpress/wp-content/plugins/mygallery/changelog.txt
[!] Directory listing is enabled: http://192.168.89.148/wordpress/wp-content/plugins/mygallery/

[!] We could not determine the version installed. All of the past known vulnerabilities will be output to allow you to do your own manual investigation.

[!] Title: myGallery <= 1.4b4 – Remote File Inclusion
Reference: https://wpvulndb.com/vulnerabilities/6506
Reference: https://www.exploit-db.com/exploits/3814/

[+] Finished: Mon Sep 17 15:59:33 2018
[+] Elapsed time: 00:00:04
[+] Requests made: 78
[+] Memory used: 49.688 MB

ここまで———————————————–

[!]がある場所が、何かしら脆弱性のあるということです。
一つ取り上げると、WordPress1.5.1~2.0.2を使っている人は、クロスサイトスクリプティングの脆弱性がありますよと以下の結果で言われています。

「[!] Title: WordPress 1.5.1 – 2.0.2 wp-register.php Multiple Parameter XSS」

その場合の対応バージョンは、「[i] Fixed in: 2.0.2」といった感じで、教えてくれるみたいです。
※修正バージョンと、対象バージョンが同じ「2.0.2」だったため、確認したら、どうやら、「1.5.1~2.0.1」が正しいようです。

ちなみに、WordPressにインストールされているプラグインとそのバージョンの診断をしたい場合は以下のコマンドを実行します。

wpscan –url http://192.168.89.148/wordpress/ -e ap

結果を抜粋します。
ここから————————
[+] Enumerating all plugins (may take a while and use a lot of system resources) …

Time: 00:02:04 <=================================================> (75421 / 75421) 100.00% Time: 00:02:04

[+] Name: wpSS
| Location: http://192.168.89.148/wordpress/wp-content/plugins/wpSS/
| Readme: http://192.168.89.148/wordpress/wp-content/plugins/wpSS/readme.txt
[!] Directory listing is enabled: http://192.168.89.148/wordpress/wp-content/plugins/wpSS/

[!] We could not determine the version installed. All of the past known vulnerabilities will be output to allow you to do your own manual investigation.

[!] Title: Spreadsheet <= 0.6 – SQL Injection
Reference: https://wpvulndb.com/vulnerabilities/6482
Reference: https://www.exploit-db.com/exploits/5486/

——————-ここまで

プラグインの脆弱性と該当するExploitの情報も出てきてますね。
今回の場合ですと、スプレッドシートのバージョンが「0.6」以下の場合、SQLインジェクションの攻撃を受けるよということがわかります。
「[!] Title: Spreadsheet <= 0.6 – SQL Injection 」

以上でWPScanを使った、診断は終了です。
ちなみに私のサイトもチェックしてみたのですが、今のところは大きな脆弱性は見当たりませんでした。
※プラグインの脆弱性も確認した場合2時間かかりました。。

まとめ

今回のまとめ

  • WPScanを使うことで、自分のサイトに脆弱性があるかを確認することができる
  • 脆弱性が検出された場合は、対応するバージョンにアップする

簡易的な診断なため、これだけやれば大丈夫!ということではないですが、ご自分のサイトがどのような状態であるかを確認するには簡単なツールですので、一度確認してみてはいかがでしょうか。
もし、やり方がわからないよ、って方がいましたらご連絡いただければサポートさせていただきます!

以上です。ありがとうございました。

コメント

タイトルとURLをコピーしました