The vulnerability exists in the SignalK server's app store functionality, which allows administrators to install npm packages. The root cause is a lack of input validation on the version parameter of the /appstore/install endpoint. The analysis of the provided information, including the vulnerability description and the patch, reveals a clear path from user input to code execution.
The exploitation starts at the Express.js route handler in src/interfaces/appstore.js. This handler receives the version from the URL and passes it, without sanitization, to an installation function. The call chain eventually leads to the runNpm function in src/modules.ts.
The runNpm function is where the core of the vulnerability lies. Before the patch, this function would concatenate the user-provided version directly into an npm install command. Because npm supports installing packages from URLs, git repositories, and other sources besides the official registry, an attacker could provide a specially crafted version string pointing to a malicious package. When npm installs this package, it executes any postinstall scripts defined in its package.json, leading to remote code execution on the server.
The patch, found in commit f06140bed702de93a5dbb6b33dc2486960764d1d, addresses this by adding a validation check in the runNpm function. It uses the semver library to ensure that the version string is a valid semantic version, effectively blocking any attempts to use URLs or other non-standard version specifiers.