The vulnerability, 'GitProxy Hidden Commits Injection', allows an attacker to inject commits into a repository that are not referenced by any branch, making them hidden from the normal git history. This is possible because the git-proxy was not verifying that the commits contained within the pushed packfile matched the commits that were supposed to be pushed according to the git ref-update information.
The analysis of the patches reveals that the vulnerability is addressed by introducing a new validation step, checkHiddenCommits, into the push processing chain. The functions that were active in the processing chain before this new validation step, and were responsible for handling the user's push data, are the ones considered vulnerable.
Two main functions have been identified:
-
parsePush.exec: This function is the entry point for parsing the push request. Its original implementation was too simplistic and did not correctly parse and prepare the data for the necessary validation. It was a key enabler of the vulnerability because it didn't set up the necessary checks.
-
writePack.exec: This function takes the user-provided packfile and writes it to the repository using git receive-pack. This is the function that directly processes the malicious data containing the hidden commits. Before the patch, it did so without any verification.
During an exploit, both of these functions would be called. parsePush.exec would first parse the malicious request, and then writePack.exec would write the malicious packfile to disk. The vulnerability is the absence of a check between these two steps. Therefore, both are critical runtime indicators for this vulnerability.