The vulnerability is a combination of missing authorization and an OS command injection. The analysis began by examining the provided vulnerability description, which clearly outlined the vulnerable code paths. The POST handler in src/app/api/tunnel/tailscale-install/route.js was identified as the unauthenticated entry point. The description also pointed to installTailscaleLinux in src/lib/tunnel/tailscale.js as the function where the command injection occurs.
To confirm this and gather evidence, I analyzed the commits between the last vulnerable version (v0.4.39) and the first patched version (v0.4.44). The commit a28c5ec98b58d685b9855bf429f07d780312c8f6 contained the security fixes.
The patch analysis revealed two key changes:
- Authorization Fix: The middleware configuration in
src/proxy.js and src/dashboardGuard.js was updated to include /api/tunnel/* paths, thereby placing the vulnerable endpoint behind an authentication and authorization check.
- Command Injection Fix: The
installTailscaleLinux function was rewritten to avoid piping user input directly into a shell. The new implementation writes the downloaded installation script to a temporary file and executes it by its path, while also adding a check to reject passwords containing newlines. The attacker-controlled sudoPassword is still written to stdin for sudo, but the sh process no longer reads from it, mitigating the injection vector.
Based on this evidence, the POST route handler and the installTailscaleLinux function are the two primary functions that would appear in a runtime profile during exploitation.