2026年5月20日

2026年5月20日

WordPressに入れてはいけない危険なプラグインの特徴

はじめに

WordPressの被害の多くはプラグインの脆弱性から発生します。公式リポジトリのプラグインでも脆弱性が発見されることがあり、適切な選定と管理が不可欠です。危険なプラグインの特徴を知り、安全なサイト運営を実現しましょう。

症状・原因

  • どのプラグインが危険かを判断できない
  • 脆弱性のあるプラグインを使い続けている可能性がある
  • プラグインをインストールしたらサイトが改ざんされた
  • 古いプラグインを放置していたらマルウェアが仕込まれた

解決手順

ステップ1:危険なプラグインの特徴を理解する

🚨 インストールを避けるべき特徴:

① 更新が長期間停止している
  → 最終更新: 2年以上前
  → WordPress最新版との「互換性なし」表示
  → セキュリティパッチが当たらない

② 出所が不明または信頼できない
  → WordPress公式リポジトリ外のサイトから配布
  → 有名プラグインの「無料版」を名乗る偽物
  → 開発者情報が一切ない

③ 過剰な権限要求
  → admin権限が不要なのに要求する
  → 外部サーバーへのデータ送信を行う
  → ファイルシステムへの書き込み権限を要求

④ コードに不審な部分がある
  → eval() / base64_decode() の過剰使用
  → 難読化されたコード
  → 外部URLへのリクエストが隠れている

ステップ2:WPScanでプラグインの脆弱性をスキャンする

# WPScan でプラグインの脆弱性をチェック(APIトークン必須)
wpscan --url https://example.com \
  --api-token YOUR_WPSCAN_API_TOKEN \
  --enumerate p \
  --plugins-detection aggressive

# 特定プラグインの脆弱性を確認
wpscan --url https://example.com \
  --api-token YOUR_TOKEN \
  --enumerate p \
  --plugins-version-detection aggressive

# 出力をファイルに保存
wpscan --url https://example.com --api-token TOKEN \
  --enumerate p --output wpscan-report.txt --format cli

ステップ3:WP-CLIでプラグインの安全性を確認する

# プラグインのチェックサムを公式リポジトリと照合
wp plugin verify-checksums --all

# 改ざんが検出された場合の出力例:
# Warning: File doesn't verify against checksum: wp-content/plugins/contact-form-7/includes/functions.php

# 古いプラグインを確認(最終更新日)
wp plugin list --fields=name,version,update --format=table

# アクティブなプラグインで更新が必要なものを確認
wp plugin list --status=active --update=available \
  --fields=name,version,update_version --format=table

# 無効化されているが削除していないプラグインを確認(リスク)
wp plugin list --status=inactive --format=table

# 非公式ソースからインストールされたプラグインを特定
wp plugin list --fields=name,title --format=json | \
  wp eval-file - # 独自スクリプトでチェック

ステップ4:不審なコードをスキャンする

# eval + base64の組み合わせを検索(マルウェアの典型)
grep -r "eval(base64_decode" wp-content/plugins/ --include="*.php"

# 難読化されたコードを検索
grep -rn "str_rot13\|gzinflate\|gzuncompress\|str_replace.*chr" \
  wp-content/plugins/ --include="*.php" | head -20

# 外部URLへのリクエストを含むファイルを検索
grep -rn "file_get_contents\|curl_exec\|wp_remote_get" \
  wp-content/plugins/ --include="*.php" | \
  grep -v "wordpress.org\|gravatar.com" | head -20

# プラグインファイルの最近の変更を確認
find wp-content/plugins/ -name "*.php" -newer wp-config.php \
  -not -path "*/node_modules/*" | head -20

ステップ5:Known Vulnerable Pluginsを確認する

# WPVulnDB APIで脆弱性情報を取得(要APIキー)
curl -H "Authorization: Token YOUR_TOKEN" \
  "https://www.wpvulndb.com/api/v3/plugins/contact-form-7" | \
  python -m json.tool | grep -A5 "vulnerabilities"

# Patchstack・WPScan・CVE Detailsで手動確認
# 参照URLパターン:
# https://patchstack.com/database/plugin/{slug}
# https://wpscan.com/plugins/{slug}

ステップ6:危険なプラグインを発見した場合の対処

# 即座に無効化・削除
wp plugin deactivate suspicious-plugin
wp plugin delete suspicious-plugin

# ファイルの変更履歴を確認
git log --oneline wp-content/plugins/suspicious-plugin/ 2>/dev/null || \
  find wp-content/plugins/suspicious-plugin/ -newer wp-config.php

# データベースに不審なコードがないか確認
wp db query "SELECT option_name, option_value FROM wp_options
  WHERE option_value LIKE '%eval(%'
     OR option_value LIKE '%base64_decode%'
  LIMIT 10"

# ユーザーに不審な管理者アカウントがないか確認
wp user list --role=administrator --format=table

# パスワードを強制リセット
wp user update {USER_ID} --user_pass=$(openssl rand -base64 20)

注意事項

  • プラグインの脆弱性情報は Patchstack・WPScan・CVE Details で定期確認してください
  • nulled(ライセンスを無効化した海賊版)プラグインは必ずマルウェアが仕込まれていると考えてください
  • 定期的に wp plugin verify-checksums --all を実行してファイル改ざんを検出してください

まとめ

危険なプラグインは「長期未更新」「不明な出所」「難読化コード」が主な特徴です。wpscanwp plugin verify-checksums を定期実行し、不審なプラグインは即座に無効化・削除してください。nulledプラグインは絶対に使用しないでください。

お気軽にご相談ください

お見積りへ お問い合わせへ