
Telegram Desktop Pre-7.0.1 Export Code Allowed Bot-Injected JavaScript in HTML Files
Telegram Desktop's HTML export failed to sanitize bot inline keyboard text, allowing persistent JavaScript injection that activates on file open. The issue was reported June 3, fixed in commit 8457d13a, and released in 7.0.1, yet legacy exports remain vulnerable. No active exploitation reported; risk is confined to browser-opened files from pre-July versions.
The vulnerability stemmed from Telegram Desktop's HTML export routine writing bot button text directly into the DOM without escaping. Researchers Denis and Aleksander Rostilov demonstrated that a script tag placed in button text, padded with zero-width characters, survived forwarding and sat dormant in chat history until export. The script executed with no user interaction beyond opening the file, exfiltrating message contents, metadata, and local paths while the export remained unaltered on disk.
Telegram's own GitHub commit 8457d13a, merged June 30 and shipped in 7.0.1, added the missing escaping. No CVE was assigned and NVD shows no entry as of September 14. The flaw required three conditions: an unpatched export, a forwarded bot message inside the exported range, and JavaScript-enabled browser viewing. Old exported files retain the payload indefinitely.
This pattern matches prior messenger export weaknesses where sanitization was applied only to visible UI elements rather than serialized output. Full-account exports default to owner messages only in groups, limiting blast radius, yet one-to-one and bot chats expose everything. No independent confirmation of in-the-wild exploitation exists beyond the researchers' controlled tests.
Forwarded bot messages carrying the payload can persist for years. Future audits should target JSON export paths and mobile export functions, which the researchers did not examine.
Telegram: At least one additional injection vector in export code will be disclosed by an external researcher before December 2025.
Sources (3)
- [1]ExPatch Security Research Writeup(https://expatch.security/telegram-desktop-export-injection)
- [2]Telegram Desktop GitHub Commit 8457d13a(https://github.com/telegramdesktop/tdesktop/commit/8457d13a)
- [3]The Hacker News Coverage(https://thehackernews.com/2024/09/telegram-desktop-flaw-lets-hidden.html)