The vulnerability lies in the generation of a Windows gateway.cmd script for a scheduled task. The analysis of the patch commit 280c6b117b2f0e24f398e5219048cd4cc3b82396 reveals that the root cause was improper quoting and escaping of arguments and environment variables written into the script.
The primary vulnerable function is buildTaskScript in src/daemon/schtasks.ts. Before the patch, this function used a weak quoting function, quoteCmdArg, which failed to neutralize special command-line metacharacters (e.g., &, |, >). An attacker with control over the inputs to this function (such as program arguments, working directory, or environment variables) could inject arbitrary commands into the generated .cmd file. These commands would then be executed with the privileges of the scheduled task.
The exported function installScheduledTask is the entry point that triggers the vulnerability. It gathers the necessary parameters and calls buildTaskScript to create the script. Therefore, installScheduledTask would appear in a runtime profile or stack trace during an exploitation attempt. The patch remediated the vulnerability by introducing a new, more robust quoting function, quoteCmdScriptArg, which properly handles metacharacters and other special cases for Windows batch scripts. It also added explicit checks to reject newline characters in inputs, preventing another vector for command injection.