Like many source code browsing tools, WebSVN allows users to search through the revision history to find relevant code changes.
These search requests are made by sending a query to the backend, which is written in PHP.
In versions of WebSVN prior to 2.6.1, the user’s search query is not escaped when it is used in a shell command.
Inside include/svnlook.php the function getListSearch is responsible for creating the shell command by concatenating the search query with command arguments.
A function called runCommand inside include/command.php finally executes the command by passing it to PHP’s proc_open function.
Without properly escaping the user’s input, it is possible to achieve code execution by including special characters in the search query.
To fix this vulnerability, the code was changed to sanitize the user input with escapeshellarg before concatenating it to the other command arguments.
Another possible solution is to allow proc_open to automatically escape and quote the command by passing an array of strings as the first argument.
This approach might be considered more concise and easier to maintain.
However, it would have required making bigger changes to the existing code, and it is not compatible with older versions of PHP, which is likely the reason this solution was not chosen.