You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
严重问题 (v1.11.18):file service 任意文件读写导致容器 root,RCE、持久化与 JWT 外泄 #323
Report: Arbitrary File Read/Write in file service Leads to Container RCE, Persistence, and JWT Exfiltration
Summary
From 2026-11-16 to 11-18, the attacker exploited the moleculer file service actions exposed by Tailchat (/api/file/fPutObject, /api/file/fGetObject, /upload) to achieve arbitrary file read/write within the container, then obtained server-side RCE by overwriting an EJS template, established a self-healing persistent backdoor, and tampered with the frontend iam plugin to steal user JWTs and exfiltrate them to a C2.
Affected components: the tailchat container (server/dist/views/mail.ejs, moleculer.config.js, plugins/com.msgbyte.iam/index.js)
The fPutObject / fGetObject actions of the file service accept filePath and objectName directly from request parameters, lacking path whitelist validation. Any logged-in user can obtain:
Arbitrary file in the container → MinIO object (read)
MinIO object → arbitrary path in the container (write)
This constitutes a bidirectional arbitrary file read/write channel, and is the entry point of the entire attack chain.
Attack Chain
Reconnaissance: 110.52.50.181 performed initial reconnaissance: read the site, registered [email protected], and used curl to probe /api/file/listBuckets, fPutObject, fGetObject (all 401).
Entry: After registering an account and logging in, the attacker called fPutObject (returned 200) to establish a round-trip channel with MinIO, producing a marker file jzmark54.txt.
Credential exfiltration: Through this channel, the attacker read the container's environment variables, wrote them to jzenv.txt, and leaked MONGO/REDIS/MINIO passwords, SECRET, LiveKit key, and Resend SMTP key.
Privilege escalation to RCE: Uploaded a malicious EJS to overwrite server/dist/views/mail.ejs (containing <% try{ ... child_process.execSync(c) ... } %>), so that any action triggering email rendering would execute commands; AGENT_OK / CONFIG_OK output proved successful execution.
Persistence (self-healing):
Injected require("/app/tailchat/.jzag/agent.js") into the first line of moleculer.config.js;
agent.js polls for commands every 15s, writes back output, and verifies the md5 of .jzbak and mail.ejs, re-overwriting them if they do not match;
On startup, dumps the full process.env to .jzboot.txt.
After a restart, the agent was still loaded and .jzboot.txt was regenerated at 12:22:27, confirming that a restart cannot remove the backdoor.
Lateral attempt: From root inside the container, accessed tailchat-admin:3000/admin/api/login on the same subnet, which returned 401, unsuccessful.
Direct database write to add accounts: The attacker used MongoClient to connect directly to the database, wrote into users, and used updateOne to force uids into groups.members (e.g., [email protected]).
Frontend JWT theft: Overwrote plugins/com.msgbyte.iam/index.js to read the JWT from localStorage, base64-encode it, and exfiltrate it to the C2 via sendBeacon/fetch. Tokens of all users who visited the chat page may have been leaked.
Leaked Credentials (Treat as Public; All Must Be Rotated)
SECRET (JWT signing key → arbitrary user tokens can be forged)
LIVEKIT_API_KEY / LIVEKIT_API_SECRET
Resend SMTP key
ADMIN_USER / ADMIN_PASS
Data-Plane Impact
Attacker-uploaded objects remain in MinIO (files/<uid>/<md5>, approximately two 200-record injection payloads)
/jzout_mm.txt leaked the permanent invite codes of two groups
The attacker used insp.js (iterating over converses / messages) and groups.js (site-wide group list, message counts, total user count) to traverse the database structure; it cannot be ruled out that the messages and user tables have been exported
changed the title [-]严重问题:file service 任意文件读写导致容器 root,RCE、持久化与 JWT 外泄[/-][+]严重问题 (v1.11.18):file service 任意文件读写导致容器 root,RCE、持久化与 JWT 外泄[/+]on Nov 18, 2026
Thanks for the detailed report and follow-up review!
Two quick clarifications on the follow-up items (we also added regression tests for them):
In Moleculer, visibility: 'public' is internal cross-service RPC only (not external HTTP/Socket). Only published actions are exposed; both moleculer-web and Socket.IO reject user.generateUserToken, user.signUserToken, user.banUser/unbanUser, file.delete, and config.* with 404 ServiceNotFoundError.
/upload enforces JWT auth via authorization: true (ApiService.authorize, same as /api), rejecting unauthenticated requests with 401.
We also audited and fixed the remaining exposed internal actions in #327, which is expected to be released in v1.11.23:
Blocked all file.* actions on /api and Socket.IO (uploads and static files remain on /upload and /static), restricted file.get, file.stat, gateway.listAliases, openapi.app.authToken, and group.getGroupLobbyConverseId to visibility: 'public', and stripped tokens from file.save logs.
Added end-to-end gateway & Socket.IO access-control regression tests covering all of the actions above and /upload auth.
Activity
Determina54 commentedon Nov 18, 2026
报告:file service 任意文件读写导致容器 RCE、持久化与 JWT 外泄
摘要
2026-11-16 至 11-18,攻击者通过 Tailchat 暴露的 moleculer
fileservice 动作(/api/file/fPutObject、/api/file/fGetObject、/upload)实现容器内任意文件读写,进而通过覆盖 EJS 模板获得服务端 RCE,建立可自愈的持久化后门,并篡改前端iam插件窃取用户 JWT 外传至 C2。tailchat容器(server/dist/views/mail.ejs、moleculer.config.js、plugins/com.msgbyte.iam/index.js)110.52.50.181(首探)、116.162.227.7(主)、116.162.226.111https://cfights.shop/accepting(Cloudflare 前置)根因
fileservice 的fPutObject/fGetObject动作直接以请求参数接收filePath与objectName,缺少路径白名单校验。 任何已登录用户即可获得:这构成了双向任意文件读写通道,是整条攻击链的入口。
攻击链
1.踩点:110.52.50.181 首次踩点:读站点、注册
[email protected],用 curl 探测/api/file/listBuckets、fPutObject、fGetObject(均 401)2. 入口:攻击者注册账号并登录后,调用
fPutObject(返回 200)建立与 MinIO 的往返通道,产出标记文件jzmark54.txt。3. 凭据导出:通过该通道读取容器环境变量,落地
jzenv.txt,泄露 MONGO/REDIS/MINIO 口令、SECRET、LiveKit key、Resend SMTP key。4. 提权到 RCE:上传恶意 EJS 覆盖
server/dist/views/mail.ejs(含<% try{ ... child_process.execSync(c) ... } %>),任何触发邮件渲染的动作即执行命令;AGENT_OK/CONFIG_OK输出证明执行成功。5. 持久化(可自愈):
moleculer.config.js首行注入require("/app/tailchat/.jzag/agent.js");agent.js每 15s 轮询执行命令、回写输出,并校验.jzbak与mail.ejs的 md5,不一致则重新覆盖;process.env至.jzboot.txt。.jzboot.txt于 12:22:27 重新生成,确认重启无法清除后门。tailchat-admin:3000/admin/api/login,返回 401,未成功。MongoClient直连数据库写入users,并用updateOne将 uid 强塞进groups.members([email protected]等)。plugins/com.msgbyte.iam/index.js,读取localStorage中的 JWT,base64 后经sendBeacon/fetch外传至 C2。所有访问过聊天页的用户令牌均可能已泄露。已泄露凭据(视同公开,须全部轮换)
MONGO_USER/MONGO_PASS、REDIS_PASS、MINIO_USER/MINIO_PASSSECRET(JWT 签名密钥 → 可伪造任意用户令牌)LIVEKIT_API_KEY/LIVEKIT_API_SECRETADMIN_USER/ADMIN_PASS数据面影响
files/<uid>/<md5>,约两个 200 条注入载荷)/jzout_mm.txt泄露两个群的永久邀请码insp.js(遍历converses/messages)与groups.js(全站群列表、消息计数、用户总数)遍历过库结构,不能排除消息与用户表已被导出EN VERSION
Report: Arbitrary File Read/Write in file service Leads to Container RCE, Persistence, and JWT Exfiltration
Summary
From 2026-11-16 to 11-18, the attacker exploited the moleculer
fileservice actions exposed by Tailchat (/api/file/fPutObject,/api/file/fGetObject,/upload) to achieve arbitrary file read/write within the container, then obtained server-side RCE by overwriting an EJS template, established a self-healing persistent backdoor, and tampered with the frontendiamplugin to steal user JWTs and exfiltrate them to a C2.tailchatcontainer (server/dist/views/mail.ejs,moleculer.config.js,plugins/com.msgbyte.iam/index.js)110.52.50.181(initial reconnaissance),116.162.227.7(primary),116.162.226.111https://cfights.shop/accepting(behind Cloudflare)Root Cause
The
fPutObject/fGetObjectactions of thefileservice acceptfilePathandobjectNamedirectly from request parameters, lacking path whitelist validation. Any logged-in user can obtain:This constitutes a bidirectional arbitrary file read/write channel, and is the entry point of the entire attack chain.
Attack Chain
[email protected], and used curl to probe/api/file/listBuckets,fPutObject,fGetObject(all 401).fPutObject(returned 200) to establish a round-trip channel with MinIO, producing a marker filejzmark54.txt.jzenv.txt, and leaked MONGO/REDIS/MINIO passwords,SECRET, LiveKit key, and Resend SMTP key.server/dist/views/mail.ejs(containing<% try{ ... child_process.execSync(c) ... } %>), so that any action triggering email rendering would execute commands;AGENT_OK/CONFIG_OKoutput proved successful execution.require("/app/tailchat/.jzag/agent.js")into the first line ofmoleculer.config.js;agent.jspolls for commands every 15s, writes back output, and verifies the md5 of.jzbakandmail.ejs, re-overwriting them if they do not match;process.envto.jzboot.txt..jzboot.txtwas regenerated at 12:22:27, confirming that a restart cannot remove the backdoor.tailchat-admin:3000/admin/api/loginon the same subnet, which returned 401, unsuccessful.MongoClientto connect directly to the database, wrote intousers, and usedupdateOneto force uids intogroups.members(e.g.,[email protected]).plugins/com.msgbyte.iam/index.jsto read the JWT fromlocalStorage, base64-encode it, and exfiltrate it to the C2 viasendBeacon/fetch. Tokens of all users who visited the chat page may have been leaked.Leaked Credentials (Treat as Public; All Must Be Rotated)
MONGO_USER/MONGO_PASS,REDIS_PASS,MINIO_USER/MINIO_PASSSECRET(JWT signing key → arbitrary user tokens can be forged)LIVEKIT_API_KEY/LIVEKIT_API_SECRETADMIN_USER/ADMIN_PASSData-Plane Impact
files/<uid>/<md5>, approximately two 200-record injection payloads)/jzout_mm.txtleaked the permanent invite codes of two groupsinsp.js(iterating overconverses/messages) andgroups.js(site-wide group list, message counts, total user count) to traverse the database structure; it cannot be ruled out that the messages and user tables have been exported[-]严重问题:存在漏洞使红队能拿到docker容器权限与tailchat admin权限[/-][+]严重问题:file service 任意文件读写导致容器 root,RCE、持久化与 JWT 外泄[/+][-]严重问题:file service 任意文件读写导致容器 root,RCE、持久化与 JWT 外泄[/-][+]严重问题 (v1.11.18):file service 任意文件读写导致容器 root,RCE、持久化与 JWT 外泄[/+]Determina54 commentedon Nov 18, 2026
1.11.20:RCE 主链与存储型 XSS 已修复,
mappingPolicy: 'all'及一批越权 action 仍未修复一、已修复 ✅
① RCE 主链(v1.11.19 引入修复)
提交
5dc80285将 minio mixin 的全部 raw action 强制私有化:实测确认:
private会被网关拦截(aliasHandler中findNextActionEndpoint直接返回ServiceNotFoundError),且不影响/static依赖的file.get(该动作为file.service自身的包装动作,不受影响)。② 存储型 XSS(v1.11.20 新增修复)
提交
ea9cf577:上传的 HTML/SVG 改为Content-Disposition: attachment+nosniff,不再以本站身份内联渲染。v1.11.20 的 20 个改动文件中,服务端仅改动
gateway.service.ts一处,即为此修复。二、未修复 ❌
v1.11.20 的
/api路由配置与 v1.11.18 完全一致:mappingPolicy: 'all'意味着别名匹配失败后,POST /api/file/xxx会被当作file.xxx直接调用。三个版本逐项比对:autoAliases: truemappingPolicy: 'all'/uploadauthentication: false仍可被任意注册用户直接调用的动作(均为
visibility: 'public'):user.generateUserTokenuser.service.ts:267userId/nickname/email直接签发有效 JWT,不查库user.signUserTokenuser.service.ts:102userId换取该用户 JWTuser.banUser/unbanUseruser.service.ts:165file.deletefile.service.ts:69config.set/addToSet/setClientConfigconfig.service.ts:48,55,21三、影响评估
本次事件的 RCE 主链虽已封堵,但网关层的
mappingPolicy: 'all'+authorization仅校验 JWT 有效性、不校验 action 级权限的设计缺陷仍然存在。上述 public action 允许任意注册用户:generateUserToken/signUserToken)这与前次事件中攻击者"直接写库加账号、强塞群成员"的越权路径属同一类问题:认证不等于授权。
四、建议
mappingPolicy改为'restrict',/api路由仅放行显式白名单 action;autoAliases仅对已审核的包装动作开启。authorization: true需配合每个 action 的权限声明(角色/归属校验),而非仅校验 JWT 有效性。generateUserToken/signUserToken应为private,仅限服务内部登录流程调用;banUser/unbanUser/config.*增加管理员角色校验;file.delete增加对象归属校验。/upload开启认证,与fPutObject私有化保持一致。ServiceNotFoundError或403。fix(server): #323 block external access to file and internal actions (#…
moonrailgun commentedon Nov 25, 2026
Thanks for the detailed report and follow-up review!
Two quick clarifications on the follow-up items (we also added regression tests for them):
visibility: 'public'is internal cross-service RPC only (not external HTTP/Socket). Onlypublishedactions are exposed; bothmoleculer-weband Socket.IO rejectuser.generateUserToken,user.signUserToken,user.banUser/unbanUser,file.delete, andconfig.*with404 ServiceNotFoundError./uploadenforces JWT auth viaauthorization: true(ApiService.authorize, same as/api), rejecting unauthenticated requests with401.We also audited and fixed the remaining exposed internal actions in #327, which is expected to be released in v1.11.23:
file.*actions on/apiand Socket.IO (uploads and static files remain on/uploadand/static), restrictedfile.get,file.stat,gateway.listAliases,openapi.app.authToken, andgroup.getGroupLobbyConverseIdtovisibility: 'public', and stripped tokens fromfile.savelogs./uploadauth.