Telegram widgets on Android can allow code execution off the sandbox

Author: Published 6 min de lectura 27 reading

The images in this article were generated with artificial intelligence. How we publish

A few days ago a technical alarm was set on around Telegram's Android widgets: small interactive blocks that bots can insert into messages and whose JavaScript logic runs on the user's phone. NebuSec researchers published an analysis showing that, although Telegram moved the QuickJS running engine to a separate process and added a seccomp filter in Android version 13.2.2 (7303), there are vectors to run code out of control of that filter. At the same time, security providers like Kaspersky have detected malicious widgets-related activity that would have ended up running a malware charger on Windows systems.

The confirmed facts are these: Telegram added the capacity for bots to send widgets and, following the emergence of public concept tests, relocated QuickJS - the engine that interprets those scripts - to an independent process and placed a seccomp filter in that process. The code of that version (13.2.2 (7303)) published includes the filter in "audit" mode - according to the source itself - which means that many system calls are recorded but not actively blocked, except for the creation of new processes. NebuSec showed on a test server that they managed to run code that opens the calculator on Android 13.2.2 (7303), and in its analysis they describe two different routes: one that takes advantage of a failure in the widget itself that the filter does not interfere and another that links a failure in the widget with a kernel bug to escape from the sandbox. Kaspersky reported on campaigns in which to visit certain channels ended the silent execution of a PowerShell script that he downloaded and released WebRAT / Salat Stealer.

Telegram widgets on Android can allow code execution off the sandbox
Image generated with IA.

What technically allows the problem. The rules of restrictions of widgets (e.g. network access ban) are encoded within QuickJS: if the engine itself is violated - for example with an use-after-free or out-of-bounds write - an attacker can read and write memory of the process. That erases the guarantees provided by the sandbox logic. The seccomp applied by Telegram restricts a limited set of calls to the system, but the published list filters only a few dozen calls and, according to the visible code, leaves others unfiltered (e.g. ioctl). In addition, Telegram runs all widgets in the same motor process; if a widget is compromised, that shared memory can give access to the widgets of other bots.

Who it affects. Technically, any Telegram user for Android receiving widgets could be affected if vulnerability is exploited in the specific version that runs on your device and if the execution of the explosion does not require additional interaction. In practice there are nuances: Telegram stated that "no one could be hacked just by receiving a message" and that it was necessary to start a third-o service (statement by CEO Pavel Durov), and NebuSec has not yet published all the details of whether its concept test requires the user to have started the bot or touched the widget. Kaspersky, in his notice, did not link his detection directly to NebuSec's work or identify the exact failure or vulnerable version, but did advise not to use widgets until there is official correction.

Actual and potential consequences. If a complete explosion is available and run on an affected device, the risk varies from running unprivileged apps (as in the demonstration that opened the calculator) to climbing privileges through chained kernel failures and achieving persistence or exfiltration of data. The exact nature of the access (if you can read local messages, Telegram keys, credentials, or other app data) has not been publicly confirmed by NebuSec. The greatest danger comes from the combination: exploitation of QuickJS to "break" the engine + kernel failure to leave the protected process. In addition, because the engine runs in a common process for all widgets, a single incident could affect multiple bots and users on the same device.

What you know is still uncertain. It is not clear whether the public version that millions install uses exactly the audio-mode filter that appears in the published repository; Telegram can have internal building with different configurations. There is no public and verifiable confirmation that the failures exploited by NebuSec have been assigned to CVE or that researchers have coordinated the outreach with Telegram developers. Nor has it been published whether the demonstrated operation requires user interaction (click the widget, accept an action, start a bot) or what extent the explosion would reach beyond the demonstration of "open the calculator."

Telegram widgets on Android can allow code execution off the sandbox
Image generated with IA.

Specific measures to be taken now. 1) Disable or avoid using widgets until Telegram publishes a confirmed correction: do not start third-party services or press interactive elements of unknown bots. 2) Keep the Telegram app up to date: when Telegram publishes a version marked as repaired, install it as soon as possible from Google Play or the official store you use. 3) Check permissions and limits on Android: avoid giving wide permissions to Telegram and disable self-boot options or access you do not need; consider restricting access to storage if your Android version allows. 4) If you are a high-risk user (fund management, sensitive accounts), avoid using the same machine for critical operations until you confirm the correction and, if appropriate, use Telegram Web in a browser in a controlled environment or a secondary device. 5) For managers and companies: blocks the execution of widgets in managed facilities when the app policy allows it and monitors traffic and log for abnormal activity. 6) Keep the Android operating system up to date: the exploits that chain kernel bugs become much more difficult if the kernel and security patches are up to date.

If you want to deepen the technical components mentioned above, the QuickJS engine and documentation on seccomp filters are useful sources: QuickJS (Fabrice Bellard project) and kernel documentation on seccomp filters in Linux https: / / www.kernel / doc / html / latest / userspace-api / seccomp _ filter.html. For the public position of the Telegram CEO, its official channel remains the reference: https: / / t.me / durov.

In short: there is technical evidence that widgets can lead to code running off the engine on Android, and the situation combines problems in the QuickJS engine and in the design of mitigation. Although there is still no complete public map of the real extent of vulnerability - and no evidence of unambiguously linked mass exploitation to that particular vulnerability -, prudence requires limiting interaction with widgets and implementing security updates and controls until Telegram and security providers confirm and document a complete solution.

Coverage

Related

More news on the same subject.