Discord 1.0.9196 calls require('utf-8-validate') from inside its Electron bundle, transitively through ws. Node.js's CommonJS resolver walks rootward from the loader's directory, emits one candidate node_modules\ path at each parent, and terminates at the drive root. The list ends with C:\node_modules\utf-8-validate.js. Trend Micro's PoC for CVE-2026-0776 (ZDI-CAN-27057) is a three-line JavaScript file placed at that path by a standard user who needed no privileges to put it there. On Unix the rootward search terminates at a node the user does not own. On Windows it terminates at a node the user does.
CVE-2026-0776: Discord 1.0.9196's `require()` Walks Rootward To `C:\node_modules\`. Every Standard User Can Write There.
vendor
pattern
cve
proof of concept
The resolver was written for a root the operating system owned
Node.js's CommonJS module resolution is documented as Algorithm 4 in the Modules: CommonJS modules reference. For require('utf-8-validate') called from <dir>/file.js, the resolver computes the lookup-path list as the node_modules directory at <dir>, then <dir>/.., then <dir>/../.., and so on rootward. At each level it tests, in order:
<level>/node_modules/utf-8-validate.js<level>/node_modules/utf-8-validate/package.json, then themainfield<level>/node_modules/utf-8-validate/index.js
The first match wins. The walk does not stop at the application's install directory. It does not stop at the user profile. It does not stop at any boundary the application opted into. It stops at the root of the filesystem, because that is where there is no parent to walk into.
The algorithm was authored against Unix, where the rootward walk terminates at /. On Unix, /node_modules/ does not exist by default and creating it requires root. The terminal node of the walk is administratively owned. The implicit allowlist on the lookup-path list is "every node from <dir> up to a node only root can write to." Node.js did not install that allowlist as code. The platform installed it as the filesystem's ACL on /.
Windows inherits the resolver. Node.js on Windows walks rootward from the loader's directory to the drive root, generating C:\<...>\node_modules\ at every level along the way and C:\node_modules\ at the end. The terminal node of the walk is C:\. The drive root is not administratively owned.
C:\ admits standard users at the directory grain
The default discretionary ACL on C:\ on Windows 10 and Windows 11 grants the Authenticated Users SID the FILE_ADD_SUBDIRECTORY right. The ACL also grants BUILTIN\Users read and traverse through the existing tree, and grants CREATOR OWNER full control inherited into anything those users create. The composition is one sentence: a standard user cannot create files at C:\, but can create directories there, and inherits full control over the directories they create.
> icacls C:\
C:\ NT AUTHORITY\SYSTEM:(OI)(CI)(F)
BUILTIN\Administrators:(OI)(CI)(F)
BUILTIN\Users:(OI)(CI)(RX)
NT AUTHORITY\Authenticated Users:(M) <-- AppendData / AddSubdirectory
NT AUTHORITY\Authenticated Users:(OI)(CI)(IO)(M)
CREATOR OWNER:(OI)(CI)(IO)(F)mkdir C:\node_modules succeeds for any standard user. The user becomes the owner of C:\node_modules. Any file the user writes inside is theirs to read, replace, and delete. No prompt. No elevation. No installer.
That is the gap. Node's resolver assumed the rootward walk terminated at administratively-owned territory. On Windows it terminates at territory the standard user claims by mkdir.
The chain
The PoC published by 0x18F on 2026-06-10 is one Python harness and one JavaScript payload. The payload is three lines:
// node_modules/utf-8-validate.js
const { exec } = require('child_process');
exec('start cmd.exe /k echo CVE-2026-0776');
module.exports = { validate: () => true };Line 1 imports child_process from Node's standard library, available because the payload is being loaded by Discord's bundled Node runtime. Line 2 spawns cmd.exe with the /k switch so the window stays open and the demonstration is visible. Line 3 returns an object whose validate method always returns true, which is the shape utf-8-validate exports. Discord's downstream caller of require('utf-8-validate') (the ws WebSocket library, which Discord uses for its gateway connection) receives a module that satisfies the contract, calls validate() on inbound frames, gets true every time, and continues. The exploit lives entirely above the WebSocket stack's expectations.
The Python harness is the planting and launch:
DESTINATION_FOLDER = Path(r"C:\node_modules")
source_folder = current_dir / "node_modules"
...
shutil.copytree(source_folder, DESTINATION_FOLDER)
...
subprocess.Popen([
str(discord_update),
"--processStart",
"Discord.exe"
])
time.sleep(10)
shutil.rmtree(DESTINATION_FOLDER)The harness copies the local node_modules\utf-8-validate.js into C:\node_modules\, launches Discord through %LOCALAPPDATA%\Discord\Update.exe --processStart Discord.exe (the Squirrel-based launcher Discord ships, the same launcher the desktop shortcut invokes), sleeps ten seconds for the Electron process to initialize and resolve its dependencies, then removes C:\node_modules\ before exiting. The cleanup is the anti-forensic detail. The payload sits on disk only for the window in which Discord's main process imports ws and ws calls require('utf-8-validate'). After that import, Node has cached the module reference in memory; the file on disk no longer needs to exist.
When Discord.exe starts, the Electron main process loads resources\app.asar and imports the dependencies the asar declares. ws is one of them. ws declares utf-8-validate as an optional native dependency that improves performance when installed and is silently absent otherwise. Discord 1.0.9196's bundle ships ws without bundling the native build of utf-8-validate. The try { require('utf-8-validate') } catch { ... fall back to JS ... } inside ws issues the require. Node's resolver, given that name, walks rootward in the real filesystem, generates C:\node_modules\utf-8-validate.js, finds it, and loads it. The payload's top-level exec('start cmd.exe...') runs inside the Discord process. The validate: () => true export satisfies the ws contract. The WebSocket stack continues. The shell stays open.
The attacker now has code execution inside a process that runs as the Discord user, with the Discord user's session token in memory, with Discord's IPC channel open to every other Discord window the user has, and inside a Microsoft-signed Electron binary. Application-control policies (AppLocker, WDAC, ASR rules) that allowlist Discord.exe by signature do not catch the planted code, because the planted code is loaded by the signed binary's own Node runtime under its own image trust.
Every Electron application on Windows ends the same walk
utf-8-validate is an optional native dependency of ws, which is the default WebSocket client for Node.js and the default WebSocket client for Electron applications that maintain real-time connections. The list of Electron applications that ship ws includes Slack, Microsoft Teams, VS Code, Notion, Postman, GitHub Desktop, Twitch, Figma, WhatsApp Desktop, and most of the rest of the category. The list of those that ship utf-8-validate natively is shorter, because the dependency is optional and many bundlers omit it. Every one of the omissions calls require('utf-8-validate') and lets Node walk rootward.
The bug is not Discord's alone. The bug is the composition of three design choices made by three different parties. Node.js walks rootward to the filesystem root because that is what its module resolution algorithm has always done. Electron inherits Node's resolver without scoping it to the application's install directory, because the resolver's behavior is part of Node's documented contract and pinning it to a per-application root would break other resolution patterns Electron applications rely on. Windows defaults the drive root to permit Authenticated Users create-subdirectory, because the drive root is the user's filesystem and the OS treats it as user-owned territory. Each choice is reasonable in isolation. Composed, they hand any standard local user a primitive: drop a file at C:\node_modules\<commonly-required-name>.js and wait for the next Electron application to start.
The race is for who plants first. Once C:\node_modules\ exists with one user as its owner, no other standard user can plant inside it without that user's cooperation. The operational pattern follows: malware that lands as a standard user (a phishing dropper, an unprivileged script, a tampered installer) creates C:\node_modules\utf-8-validate.js and exits. The next Electron application the victim launches loads the planted file. The malicious code now runs inside a signed application's process, persistent for the lifetime of that process, with whatever credentials the host application holds.
The CWE on the CVE record reads CWE-427, Uncontrolled Search Path Element. The search path is Node.js's. The element is the drive root.
What a patch addresses, and what it does not
Discord can close the Discord-shaped CVE by pre-creating C:\node_modules\ at install time with an ACL that denies write to non-administrators. The Squirrel installer Discord ships runs as the user installing Discord, not as an administrator; the per-user installation flow Discord chose specifically so that users could install Discord without elevation cannot defensively claim a path that requires elevation to claim. The patch shape that closes Discord's exposure either requires changing Discord's installer to be elevated (a model Discord has declined for over a decade) or requires shipping a custom Node loader inside the Electron runtime that scopes module search to the application's install root.
Only the second closes the primitive. The first closes Discord and leaves the same primitive open for every Electron application that ships next to Discord on the same machine. The second changes what require() does in a process Node thinks it owns the search behavior of.
Node.js itself has no incentive to change the resolver. The Unix-shaped assumption is correct on Unix, where the primitive does not exist. Changing the rootward walk to terminate at the user-home boundary would break system-wide module installations on Unix and would not affect Discord's exposure unless Electron pinned to a patched Node, which Electron does not. The resolver's behavior is documented and load-bearing for the rest of the Node ecosystem; changing it for Windows alone would fork the contract on the platform that needs the fork most.
The primitive belongs to the composition. CVE-2026-0776 names Discord because Trend Micro's submission tested Discord. The same primitive runs in every Electron application on Windows that calls require('<name>') from a context where <name> is not resolved inside the application bundle. This catalog files the shape as search-walks-to-user-writable, the recurring class where a hierarchical name resolver walks past a trust boundary the deployment platform draws in a different place than the algorithm's authoring platform did. Discord is the first exhibit. It will not be the last.
PoC: 0x18F/CVE-2026-0776
The resolver walked rootward looking for a node_modules nobody had created yet. A standard user created one.