AI Security AI安全 4h ago Updated 2h ago 更新于 2小时前 43

Telegram Desktop Flaw Lets Hidden JavaScript Exfiltrate Messages From HTML Exports Telegram Desktop漏洞允许隐藏JavaScript从HTML导出文件中窃取消息

Telegram Desktop's HTML export feature contained a stored cross-site scripting (XSS) vulnerability where bot inline keyboard button text was written directly into exported HTML without proper escaping, allowing script injection A malicious bot could embed JavaScript in button labels that remained invisible in-chat but executed automatically when users opened exported HTML files in browsers, exfiltrating all messages to attacker-controlled servers The vulnerability existed for approximately two y Telegram Desktop存在XSS漏洞,机器人可通过内联键盘按钮文本植入隐藏JavaScript代码 漏洞源于HTML导出功能未对按钮文本进行转义处理,导出文件在浏览器中打开时自动执行恶意脚本 影响版本为4.15.1至6.9.3(2024年3月至2026年7月),已在6.9.4 beta和7.0.1稳定版中修复 攻击者可窃取导出文件中的全部消息内容,或篡改页面内容实施钓鱼攻击 该漏洞无CVE编号,Telegram未发布官方安全公告,研究人员已拒绝$500赏金并建议捐赠慈善机构

62
Hot 热度
65
Quality 质量
55
Impact 影响力

Analysis 深度分析

TL;DR

  • Telegram Desktop's HTML export feature contained a stored cross-site scripting (XSS) vulnerability where bot inline keyboard button text was written directly into exported HTML without proper escaping, allowing script injection
  • A malicious bot could embed JavaScript in button labels that remained invisible in-chat but executed automatically when users opened exported HTML files in browsers, exfiltrating all messages to attacker-controlled servers
  • The vulnerability existed for approximately two years and four months (since March 2024) across Telegram Desktop versions 4.15.1 through 6.9.3 before being patched in July 2026
  • Old HTML exports created with vulnerable versions remain compromised even after updating the application, as the fix only prevents future injections but cannot remediate already-exported files

Why It Matters

This vulnerability demonstrates how a seemingly innocuous export feature in a widely-used messaging platform can become an attack vector for mass data exfiltration, affecting millions of Telegram Desktop users who regularly export chat histories for archival or legal purposes. The two-year exposure window and the fact that old exports remain vulnerable even after patching highlights the persistent risks of stored XSS in user-generated content pipelines, serving as a cautionary case study for any platform offering data export functionality.

Technical Details

  • Vulnerability Type: Stored Cross-Site Scripting (XSS) via unescaped inline keyboard button text in HTML exports, rated 8.2/10 on CVSS 3.1 scale
  • Attack Vector: Bots could embed <script> tags in inline keyboard button labels, padded with invisible characters to appear empty in the Telegram Desktop client; the script executed automatically upon opening the exported HTML file in any browser with JavaScript enabled
  • Data Exfiltration Scope: The malicious script could read all messages (including sender names, timestamps, chat metadata, and local file paths) from exported HTML files containing up to 1,000 messages per file, then transmit them to attacker-controlled servers; it could also rewrite page content to display fake Telegram verification forms for phishing
  • Exploitation Conditions: Three conditions required: (1) HTML export created with vulnerable Telegram Desktop version before the fix, (2) the injected message existed within the exported chat, and (3) the file was opened in a browser with JavaScript enabled; notably, the bot did not need to be a member of the target chat since link-button messages survive forwarding
  • Patch Details: Fix commit 8457d13a by developer John Preston added proper HTML escaping to the export code; deployed in version 6.9.4 beta (July 3, 2026) and 7.0.1 stable (July 14, 2026); no CVE assigned and no security advisory published by Telegram

Industry Insight

  • Export Feature Security Audits: Any platform offering data export functionality should treat exported files as untrusted surfaces requiring the same security scrutiny as user-facing interfaces; HTML exports with embedded interactive content are particularly risky and should implement strict Content Security Policies or sanitize all user-controlled fields
  • Patch Lifecycle Management: The two-year gap between vulnerability introduction and patching, combined with Telegram's failure to publish a security advisory or CVE, underscores the importance of independent security research and responsible disclosure frameworks; organizations should proactively audit their export pipelines rather than relying solely on vendor security communications
  • Legacy Data Remediation: The finding that old exports remain permanently compromised even after application updates creates a persistent attack surface; security teams should implement data retention policies that require re-exporting historical data after security patches, or treat all legacy exports as potentially malicious and restrict their opening to sandboxed environments with JavaScript disabled

TL;DR

  • Telegram Desktop存在XSS漏洞,机器人可通过内联键盘按钮文本植入隐藏JavaScript代码
  • 漏洞源于HTML导出功能未对按钮文本进行转义处理,导出文件在浏览器中打开时自动执行恶意脚本
  • 影响版本为4.15.1至6.9.3(2024年3月至2026年7月),已在6.9.4 beta和7.0.1稳定版中修复
  • 攻击者可窃取导出文件中的全部消息内容,或篡改页面内容实施钓鱼攻击
  • 该漏洞无CVE编号,Telegram未发布官方安全公告,研究人员已拒绝$500赏金并建议捐赠慈善机构

为什么值得看

该漏洞揭示了即时通讯软件在数据导出功能中的安全盲区,对依赖HTML导出进行数据备份的企业用户构成直接威胁。研究团队展示了完整的攻击链——从隐蔽植入到转发传播再到导出窃取,为同类应用的安全审计提供了重要参考。

技术解析

  • 漏洞原理:Telegram Desktop的HTML导出功能在生成内联键盘按钮文本时未进行HTML转义,而消息文本、发送者名称等其他字段均已正确转义,导致按钮文本成为注入点
  • 攻击向量:机器人可在按钮文本中嵌入脚本标签并用不可见字符填充,使按钮在Telegram Desktop界面中显示为空;消息仅含网页链接按钮时转发后保留按钮,可被转发至任意群组潜伏
  • 数据泄露范围:导出文件按1000条消息分片,单个文件最多泄露其内容;脚本可读取消息内容、发送者名称和时间戳、聊天名称/类型/成员数及本地文件路径
  • 篡改能力:脚本可重写整个导出页面,演示中替换为伪造的Telegram"验证"表单;也可篡改日期、发送者或消息文本,但不影响Telegram服务器端数据或磁盘上的原始导出文件
  • 触发条件:需同时满足三个条件——HTML导出使用修复前版本、携带脚本的消息在导出范围内、浏览器启用JavaScript

行业启示

  • 导出功能安全审计:数据导出功能常被忽视,应纳入安全开发生命周期,对HTML/JSON等格式输出进行严格的输入验证和输出编码,避免将用户生成内容直接写入可执行格式
  • 漏洞披露透明度:Telegram未发布安全公告且无CVE编号,反映出厂商在漏洞响应透明度方面的不足;建议建立标准化的安全公告机制,明确披露影响范围和修复版本
  • 用户防护策略:企业用户应建立定期更新客户端、重新导出历史数据的策略,对来自不可信来源的导出文件进行隔离审查,并在浏览器中禁用JavaScript或仅从可信来源打开导出文件

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Security 安全 Research 科学研究