The vulnerability consists of a two-stage attack. First, an unauthenticated attacker exploits a state pollution vulnerability. The /skServer/validateBackup endpoint does not require authentication and modifies a global variable, restoreFilePath, which is shared across all requests. An attacker can upload a malicious backup archive and this endpoint will set restoreFilePath to the location of this archive.
The second stage involves the /skServer/restore endpoint. This endpoint uses the restoreFilePath variable to perform a system restore. By using the path polluted in the first stage, the server restores the attacker's malicious archive, allowing them to overwrite sensitive configuration files like security.json to create a backdoor administrator account.
Finally, with administrative privileges, the attacker can exploit a separate command injection vulnerability in the runNpm function, which is triggered via the app store installation feature. The runNpm function improperly constructed an npm install command by concatenating user input from the URL, allowing the attacker to execute arbitrary commands on the server, achieving Remote Code Execution (RCE). The patch addresses these issues by removing the global state in favor of a session-based mechanism for the restore process, adding authentication to the backup/restore endpoints, and fixing the command injection flaw by passing arguments as an array to the child process.