The vulnerability, GHSA-wv27-2vqp-j7g5, allows an authenticated user to import local repositories by bypassing validation in the Mirror Settings of a repository. The root cause is improper input validation in the repo.SettingsPost function, located in internal/route/repo/setting.go.
Analysis of the patch commit 11e19f28b5c82466fd1689c94344ef4313ee986c reveals that the SettingsPost function, which handles the POST request for updating repository settings, did not validate the MirrorAddress field before saving it. The vulnerable code directly passed the user-provided address to c.Repo.Mirror.SaveAddress(). This allowed an attacker to specify a local file system path, leading to a server-side request forgery (SSRF) vulnerability and allowing access to local repositories that the git user has access to.
The fix involves adding a call to the form.ParseRemoteAddr function to validate the MirrorAddress before it is passed to SaveAddress. This is the same validation function used in the secure repository migration feature, which correctly prevents the use of local paths.
Therefore, two key functions would appear in a runtime profile during exploitation:
repo.SettingsPost: The entry point of the vulnerability, which receives the malicious input.
db.(*Mirror).SaveAddress: The function that consumes the malicious input, leading to the vulnerable behavior.
The primary vulnerable function is repo.SettingsPost due to the missing validation. db.(*Mirror).SaveAddress is a runtime indicator as it's part of the exploitation path.