VulnWatch by ve1ve2
critical 9.9 EPSS 0.65%

GHSA-xp7j-h7jc-4w8p: Semaphore U: OS Command Injection

Source:
OSV.dev
Published:
Fetched:
Updated:
Affects:
github.com/semaphoreui/semaphore

https://osv.dev/vulnerability/GHSA-xp7j-h7jc-4w8p ↗

osvgofix-available

Semaphore U: OS Command Injection # Summary An OS command injection in repository git_url handling lets any user holding the Manager or Owner role on any project (the normal project-collaborator roles) achieve remote code execution on the Semaphore server host. Using git's --upload-pack= option, an attacker runs arbitrary commands. The command executes inside the main Semaphore server process (via the schedule commit-hash poller), so it runs even when jobs are configured for remote runners — bypassing runner isolation and exposing the master encryption key and every project's secrets. Reproducible on a default install (git_client: cmd_git); no non-default configuration is required. # Details The repository git_url is attacker-controlled (HTTP body) and reaches exec.Command("git", ...) unvalidated. Two missing controls cause this: 1. git_url is never validated against option injection. Repository.Validate() (db/Repository.go, ~lines 138–156) validates the branch via ValidateGitBranch (db/git_branch.go, which rejects a leading -), but performs no equivalent check on GitURL (only "non-empty"). ValidateRepository (db/Store.go, ~802–806) only checks the SSH key. CreateRepository (db/sql/repository.go, ~76–95) stores it verbatim. Because --upload-pack=... has no scheme:// and no leading /, GetType() (db/Repository.go, ~113–136) classifies it as RepositorySSH and GetGitURL(false) (~72–111) returns it raw/unchanged. 2. The git command is built with no -- separator. CmdGitClient.GetLastRemoteCommitHash (db_lib/CmdGitClient.go, ~169–185) calls: c.output(r, GitRepositoryTmpPath, "ls-remote", r.Repository.GetGitURL(false), // attacker-controlled r.Repository.GitBranch) // "master" output (~79–93) → makeCmd (~21–60): exec.Command("git") (line ~27), cmd.Args = append(cmd.Args, args...) (line ~55). The resulting argv has no --: ["git", "ls-remote", "--upload-pack= ;true", "master"] git parses --upload-pack=... as an option; master becomes the (local-transport) repository operand; git then executes the upload-pack value through a shell (sh -c " 'master'"), running . This is intended git behavior — the fault is Semaphore passing untrusted data as argv. (The command runs even though git subsequently prints fatal: Could not read from remote repository and exits 128, and even though master is not a real path.) ### Trigger — it fires in the server process. A project schedule with a repository_id causes the scheduler to run git ls-remote to check for new commits. AddSchedule (api/projects/schedules.go, ~130–160; validateSchedulePayload ~86–118 validates only the cron format — it does not require the repo to be tied to the template). The schedule pool is started in the server process: runService in cli/cmd/root.go (CreateSchedulePool ~line 115, go schedulePool.Run() ~line 193), independent of remote-runner config. On each tick, ScheduleRunner.Run (services/schedules/SchedulePool.go, ~96–193, line ~117) calls tryUpdateScheduleCommitHash (~61–94) — Affected: Go:github.com/semaphoreui/semaphore Fixed in: 0.0.0-20260704181911-7e8a9434bd81 References: https://github.com/semaphoreui/semaphore/security/advisories/GHSA-xp7j-h7jc-4w8p https://nvd.nist.gov/vuln/detail/CVE-2026-73294 https://github.com/semaphoreui/semaphore/commit/7e8a9434bd81b82cf42220151c74801ea97542d6 https://github.com/semaphoreui/semaphore/commit/a7a7a33a64aea382a0726b3722856f298663eacf https://github.com/semaphoreui/semaphore https://github.com/semaphoreui/semaphore/tree/v2.18.17 https://github.com/semaphoreui/semaphore/tree/v2.19.5-beta2

Linked vulnerabilities (2)

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

Semaphore U: OS Command Injection

CWE: CWE-78, CWE-88Aliases: CVE-2026-73294
CVE-2026-73294 critical 9.9 EPSS 0.65% (p52) NVDCVE.orgGHSA
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

Semaphore U: OS Command Injection

CWE: CWE-78, CWE-88Aliases: GHSA-xp7j-h7jc-4w8p