A malicious widget can bypass the security filter that Telegram added to its Android app last week and run code outside it, according to NebuSec, a security company.
Widgets are small interactive blocks that bots send inside chat messages, and their JavaScript runs on the user's phone. The researchers ran their demonstration on a Telegram test server, because only approved bots can send widgets on the live service now.
Bots could start sending widgets last week. Two days later, an account called V12 posted a video on X claiming that any Telegram message could now be used to execute remote code.
Telegram then put QuickJS, the small engine that runs widget JavaScript, into its own process on Android. It also added a seccomp filter, which can block or record the system calls that the process makes. Both changes appear in the source code it published for Telegram for Android 13.2.2 (7303).
NebuSec said in a technical analysis published earlier this week that its researchers got code running outside that filter in two separate ways. One uses a widget bug the filter does not cover, and the other chains a widget bug the filter does cover with a kernel bug.
In their video, a bot's Telegram widget on Android 13.2.2 (7303) bypasses the filter and opens the phone's calculator app, the researchers say.
Their write-up and their demonstration post on X do not say what the code could reach beyond that, such as the app's messages or the rest of the phone. They also do not say whether the user had to start the bot or tap the widget first.
The researchers are holding back the details for now. Their write-up names no CVE identifier and does not say whether the bugs were reported to the app's developers.
The widget documentation says widgets run in a sandbox, with rules such as no network access. Those rules live in the engine's own code, the researchers say. A single use-after-free or out-of-bounds write bug in QuickJS lets a script read and write the process's memory, and then the rules no longer protect anything.
The new filter names a few dozen system calls, such as ptrace, bpf, and mount, and lets every other call through. The filter's source code leaves ioctl unfiltered. The filter sits on top of Android's own limits on the engine process.
One process also runs every widget, so a hijacked widget from one bot shares memory with the widgets of every other bot, the researchers say.
In the published source code for Telegram for Android 13.2.2 (7303), that filter is set to an audit mode, The Hacker News found. In audit mode, it still blocks attempts to start new programs or processes, but it only records the other listed calls and lets them run.
A comment above the setting says how long that will last: "Audit until the logs from the devices say the engine never makes them." The published code does not show whether the version people install uses the same setting.
"Yes, currently, general bots aren't allowed to use widgets even in private chats," a contributor to the telegram-bot-api project wrote late last week in a bug report thread on GitHub. As of this week, no later message in the thread says which bots are still allowed or that the limit has been lifted.
The researchers' write-up lists no fixed version, and the published Android source code is no newer than 13.2.2 (7303) as of this week.
"No one could be hacked just by receiving a message," Pavel Durov, Telegram's chief executive, wrote late last week in a channel post. His post addressed reports of code execution through widgets in the Android and Windows apps, and came before the researchers' demonstration. He added that a user first had to start a third-party service, and that even that was fully patched on the server side.
The company had earlier said that the problem in V12's first demonstration was fixed and that the fix had reached all users.
Separately, the security vendor Kaspersky said late last week that it had detected suspected exploitation of a flaw in Telegram widgets when people visited some Telegram channels.
In that activity, a PowerShell script ran without the user noticing and downloaded and launched WebRAT, also known as Salat Stealer. The malware allows attackers to control the infected system and steal data from crypto wallets and Telegram accounts.
The vendor's malware warning does not identify the flaw or the Telegram version, does not report the number of victims, and does not link the activity to either demonstration. It advises not running widgets until a fix is released.





