Telegram Android widget sandbox escapes bypass new seccomp filters
NebuSec researchers demonstrate two methods to escape Telegram's Android widget sandbox, bypassing recent QuickJS process isolation and seccomp filters in version 13.2.2.
Security researchers at NebuSec have identified two distinct methods to bypass the newly implemented security filters in Telegram’s Android application. The findings, published this week, show how malicious widgets can execute code outside their intended sandbox environment despite recent hardening efforts by Telegram.
The vulnerabilities affect Telegram for Android version 13.2.2 (7303), which introduced specific protections after earlier claims of remote code execution surfaced on social media. While Telegram executives stated that users are safe from passive attacks, the technical analysis reveals significant gaps in the current defense architecture that allow active exploitation through bot interactions.
What happened
Telegram recently added support for interactive widgets sent by bots within chat messages. These widgets run JavaScript on the user's device using the QuickJS engine. After an account named V12 claimed on X that any message could trigger remote code execution, Telegram responded by isolating the QuickJS engine into its own process and adding a seccomp filter to restrict system calls. These changes were included in the source code for version 13.2.2 (7303).
NebuSec researchers demonstrated that these measures are insufficient. In a video demonstration, they showed a bot widget bypassing the filter to open the calculator app on an Android device. The researchers achieved this through two separate attack vectors. One method exploits a bug in the widget handling that the seccomp filter does not cover. The second method chains a covered widget bug with a kernel-level vulnerability to escape the sandbox entirely.
The researchers have withheld specific technical details regarding the full scope of potential access, such as whether the exploit can read private messages or access other parts of the phone. They also did not specify if user interaction, such as tapping the widget, is required for the exploit to succeed. No CVE identifiers have been assigned, and it remains unclear if the bugs were reported to Telegram before public disclosure.
How it works
The core issue lies in how the sandbox rules are enforced. According to NebuSec, the security rules for widgets, such as blocking network access, exist only within the QuickJS engine's code. If an attacker triggers a memory corruption bug, such as a use-after-free or out-of-bounds write, they can read and write the process's memory. This effectively nullifies the engine-level rules, allowing arbitrary code execution within the QuickJS process.
To mitigate this, Telegram added a seccomp filter to the QuickJS process. This filter blocks or records specific system calls like ptrace, bpf, and mount. However, the filter allows many other calls to pass through, including ioctl, which remains unfiltered. Additionally, the published source code shows the filter is set to "audit mode." In this mode, the filter blocks the creation of new programs or processes but only logs other restricted calls instead of blocking them. A comment in the code states this mode will remain until logs confirm the engine never makes those calls.
Another critical weakness is the shared process model. The researchers noted that a single process runs every widget. This means a compromised widget from one bot shares memory space with widgets from all other bots. If an attacker hijacks one widget, they potentially gain access to the context of others, amplifying the impact of a single vulnerability.
Key details
- The vulnerabilities affect Telegram for Android version 13.2.2 (7303) and involve the QuickJS engine used for bot widgets.
- NebuSec demonstrated two bypass methods: one exploiting an uncovered widget bug and another chaining a widget bug with a kernel bug.
- The seccomp filter in the published source code is set to audit mode, logging rather than blocking many system calls except for new process creation.
- The ioctl system call is left unfiltered by the new security measures, providing a potential path for exploitation.
- All widgets run in a single shared process, meaning a compromise in one bot's widget can affect others running in the same session.
- Kaspersky detected active exploitation of a widget flaw involving WebRAT malware, though it is not confirmed if this is linked to the NebuSec findings.
Why it matters
For developers building on Telegram or integrating similar widget technologies, this incident highlights the fragility of sandboxing when relying solely on engine-level constraints. Memory safety bugs in the underlying JavaScript engine can render high-level security policies ineffective. The use of audit mode in production code, as seen in the published source, suggests a transitional security posture that may leave users exposed if the logging data is not actively monitored and acted upon.
The shared process architecture presents a significant risk for multi-tenant environments. When multiple untrusted scripts run in the same memory space, a vulnerability in one component compromises the integrity of the entire group. This design choice simplifies resource management but creates a large blast radius for any successful exploit. Engineers must consider process isolation per script or strict capability separation to mitigate such lateral movement risks.
Furthermore, the gap between public claims of safety and technical reality underscores the importance of independent verification. While Telegram's CEO assured users that no one could be hacked by merely receiving a message, the existence of active malware campaigns leveraging widget flaws suggests that the threat landscape is evolving rapidly. Security teams should treat such assurances as preliminary until detailed patch notes and third-party audits confirm the fixes.
What you can do
- Disable or restrict widget functionality in Telegram settings if available, especially for chats with unknown or untrusted bots.
- Monitor official Telegram channels and GitHub repositories for updates beyond version 13.2.2 (7303) that address these specific sandbox escapes.
- Review any custom bots or integrations you manage to ensure they do not rely on features that might be disabled or restricted due to these vulnerabilities.
- Educate users in your organization about the risks of interacting with unsolicited widgets or links from unknown contacts on messaging platforms.
- If you develop mobile applications with embedded script engines, evaluate your sandboxing strategy to ensure it does not rely solely on engine-level rules without robust OS-level isolation.
- Keep an eye on security advisories from vendors like Kaspersky and NebuSec for indicators of compromise related to WebRAT or similar malware targeting messaging apps.



