# Git Arg Injection in  kubernetes-sigs/release-sdk 

Argument injection in release-sdk LSRemoteExec lets attacker-controlled ref/URL args like --upload-pack=touch${IFS}hack execute arbitrary commands via git.

- Payout: $100
- Severity: low
- Program: Kubernetes
- Found by: snoopysecurity
- Disclosed: 2023-05-25
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1763704
- Library page: https://bugbountylibrary.com/r/h1%3A1763704
- Tags: area:oss domain:oss impact:rce kind:bounty platform:hackerone sev:low tech:go technique:source-review vuln:command-injection

**Target:** kubernetes-sigs/release-sdk git.LSRemoteExec (git ls-remote wrapper)
**Root cause:** LSRemoteExec concatenates user-supplied arguments into a git command without a `--` separator, so values beginning with `-` are parsed as git options such as --upload-pack.
**Steps:**
1. Import github.com/kubernetes-sigs/release-sdk/git.
2. Call git.LSRemoteExec("--upload-pack=touch${IFS}hack", "master").
3. git ls-remote interprets --upload-pack as an option and runs the command, creating file `hack`.
4. Confirm file exists in local filesystem.
**How found:** Code reading of LSRemoteExec's string concatenation of user input into a git invocation, cross-referenced with Snyk's known git/mercurial argument-injection research; noted real usage in kubernetes/release branch_checker.go.
**Exploitation:** Attacker controls an argument passed to LSRemoteExec; supplying `--upload-pack=touch${IFS}hack` causes git to execute the upload-pack command, achieving arbitrary command execution on the host running the library.
**Insight:** Any Go wrapper that shells out to git with user-controlled args is vulnerable to option injection; test `--upload-pack=`, `--config=`, and `-c` style flags, and check whether a `--` separator precedes untrusted values.

## Proof of concept (copied exactly from the original report)

**Go PoC calling LSRemoteExec with upload-pack payload**

```
package main

import (
	"fmt"
	"github.com/kubernetes-sigs/release-sdk/git"
)

func main() {
	fmt.Println("hello world")

	var result,err = git.LSRemoteExec("--upload-pack=touch${IFS}hack","master")
```

