The vulnerability is a classic command injection flaw affecting multiple API endpoints in server/routes/git.js. The root cause is the use of an execAsync function, which internally uses child_process.exec. This function executes commands in a shell, making it vulnerable if user-controlled input is not properly sanitized.
In this case, parameters such as file, branch, message, and commit are taken from user requests and directly interpolated into the command string. While there was an attempt to escape double quotes for the message parameter, it was insufficient and easily bypassed using other shell metacharacters like $(command).
The vulnerable functions are the anonymous route handlers for the affected API endpoints. During exploitation, a runtime profiler would show these handlers in the stack trace, which in turn call the vulnerable execAsync function.
The fix was to replace all vulnerable execAsync calls with a spawnAsync helper. This helper uses child_process.spawn with shell: false and passes arguments as an array. This ensures that user-supplied values are treated as literal arguments to the git command and are not interpreted by the shell, thus mitigating the command injection vulnerability.