data-reply-content → jQuery.html())| CVE | CVE-2026-129491 |
| 组件 | Qbian61/forum-java — CommentTransfer.toComment(存储)、comment-list.html(data-reply-content)、posts-script.html($('#repliedContent').html(dataset.replyContent)) |
| 受影响版本 | 20f7e68 – 63152c49(固定的 master 头部;上游未修复) |
| 修复于 | 发布时上游无修复;修复侧为经过哈希校验的合成修复(已如此记录) |
| CWE | CWE-79(跨站脚本,存储型) |
| 影响 | 会话窃取 + 管理员接管:当受害者在攻击者的评论上点击 Reply 时,载荷即被执行;sid 会话 cookie 未携带 HttpOnly 标志,因此 onerror 处理器中的 document.cookie 可获取一个有效的管理员会话 |
| 向量 | 网络;攻击者仅需一个普通账户;评论无需审核即可发布 |
| 触发条件 | 内容包含 `` 的评论;受害者点击 Reply |
评论内容被原样存储,并在未经净化的情况下渲染进回复对话框:
// CommentTransfer.toComment — content stored as-is
return Comment.builder().content(request.getContent()) ...
<!-- comment-list.html — Thymeleaf escapes the attribute, but the browser
decodes entities for dataset.* -->
<small th:data-reply-content="${comment.content}" class="reply-comment" ...>
// posts-script.html — the click handler
$('.reply-comment').on('click', function (e) {
$('#repliedContent').html(this.dataset.replyContent); // ← executes markup
});
这个实验环境在固定提交 63152c49 上针对 MySQL 8 并使用上游种子数据构建了真实的 forum-java,走通了完整链路,并且——由于利用需要受害者的点击——还额外证明了使该点击足以生效的两个部分:jQuery.html() 接收到的确切字符串会被解析为可执行的 img onerror 事件,并且载荷将要读取的 sid cookie 经验证并非 HttpOnly。
三个事实共同构成:
CommentTransfer.toComment 原封不动地保存请求内容;data-* 属性时 DOM 会还原实体,因此 dataset.replyContent 保存的是攻击者的原始 HTML;jQuery.html(),后者会解析并执行它。登录后设置的会话 cookie(sid)具有 Path=/ 且没有 HttpOnly,因此同源脚本可以读取它;管理 REST 端点直接接受该 cookie——该公告演示了使用窃取的会话打开管理后端。
| 服务 | 镜像 | 角色 |
|---|---|---|
forum-vuln | cve-2026-129491:vuln | forum-java @ 63152c49(上游 Maven 构建),针对已植入种子数据的 MySQL 8 |
forum-fixed | cve-2026-129491:fixed | 相同构建 + lab/patch-fixed.py(经哈希校验):内容在存储时进行 HTML 转义 |
forum-db-vuln / forum-db-fixed | mysql:8.0 | 上游 schema.sql + data.sql(已应用 SET NAMES utf8mb4);按公告将管理员密码设置为 Admin@12345 |
poc | cve-2026-129491-poc:local | 仅使用标准库的 Python 驱动 |
./run-lab.sh build # mvn package at the pinned commit (both trees)
./run-lab.sh up # cve129491lab network: two app+db stacks
./run-lab.sh sweep # check / exploit / probe / mitigation on both sides
./run-lab.sh down
poc/poc.py(仅使用标准库;复现公告中的攻击链):
data-reply-content → 像浏览器一样解码 → 用 html.parser 模拟 jQuery.html() 解析并查找可执行事件。退出码 1 表示存在漏洞,0 表示安全,3 表示无 worker,2 表示无法访问。.html() 收到的确切字符串、模拟解析事件,以及会话窃取的前提条件(管理员登录的 Set-Cookie — 存在 sid,HttpOnly: false)。.text() / 对 sid 设置 HttpOnly)。| 运行 | forum-vuln (63152c49) | forum-fixed(合成) |
|---|---|---|
check | 解析事件:img onerror -> …document.cookie | 无可执行标签 |
exploit 接收字符串 | `` | <img …>(惰性) |
exploit 前提条件 | 存在 sid,HttpOnly 为 false | (相同标志;接收点惰性) |
probe img / svg / 纯文本 | 可执行 / 可执行 / 惰性 | 全部惰性 |
捕获的运行记录:evidence/check-*-run.txt、evidence/exploit-*-run.txt、evidence/probe-*-run.txt、evidence/mitigation-*-run.txt、evidence/versions.txt、evidence/0day-sweep.txt。
cve129491lab 网络上。载荷变体矩阵即为表面扫描(evidence/0day-sweep.txt):在修复后的构建上,没有任何可执行内容到达接收点;在已发布的构建上,两个活跃变体都被解析为事件。除回复对话框外,未发现第二种投递形式。
README.md this write-up
run-lab.sh environment driver (build / up / sweep / down)
Makefile convenience targets
poc/poc.py the PoC (check / exploit / probe / mitigation)
poc/Dockerfile runner image (python:3.12-alpine)
lab/lab.Dockerfile multi-stage build (forum-java @63152c49, both trees)
lab/patch-fixed.py the hash-checked synthetic remediation
lab/mysql-init/ upstream schema + data seed (gitignored)
evidence/ captured runs of every mode on both sides
TRACKING.md excluded (working record)