The vulnerability, identified as GHSA-g9f5-x53j-h563, allowed an attacker-controlled GitHub Enterprise Server to cause arbitrary command execution on a user's machine. This was possible because the go-gh library's URL browsing functionality did not properly validate incoming URLs before attempting to open them.
The core of the vulnerability lay in the (*Browser).browse method within pkg/browser/browser.go. This method would receive a URL string and, prior to the fix, would attempt to open it using OS-specific commands or a configured browser launcher without adequately checking if the URL was a safe HTTP(S) URL or a local file path (which could be an executable or trigger execution of an associated application).
The public API (*Browser).Browse serves as the entry point for this functionality and calls the internal (*Browser).browse method. Thus, (*Browser).Browse is the function that developers would use, making it the gateway to the vulnerable code.
The patch in commit a08820a13f257d6c5b4cb86d37db559ec6d14577 addresses this by modifying the (*Browser).browse method. It introduces a new validation function, isPossibleProtocol, which is called at the beginning of browse. This new function checks if the URL scheme is among a list of allowed schemes (e.g., http, https, vscode). It explicitly disallows file:// schemes, URLs that match existing files or directories on the filesystem, and URLs that match executables in the user's PATH. This pre-validation ensures that only intended types of URLs are processed, mitigating the risk of opening malicious local paths.
Therefore, both (*Browser).browse (where the flawed logic and the patch reside) and (*Browser).Browse (the public entry point mentioned in the advisory) are identified as the key functions related to this vulnerability. During exploitation, these functions would appear in a runtime profile as they process the malicious URL.