All posts

Critical vulnerabilities

2 critical vulnerabilities in Gogs

2 vulnerabilities rated critical (CVSS 9.0 or higher) found on 25 November 2026: Remote code execution in servers and applications, Arbitrary file access in servers and applications.

  • 2 critical

Remote code execution in Gogs · Servers and applications

GHSA-hc35-pcqw-5xjq

NTFS $INDEX_ALLOCATION bypass allows authenticated RCE via Git hooks

Severity
Critical 9.9
Published
24 Nov 2026
Weakness
Path traversal (CWE-22)CWE-41Code injection (CWE-94)
Attack
Over the network · Needs a user account · No user action needed
Attacker can
Read data · Change data · Take it down

The fix in PR #8408 does not fully prevent writes into a repository's .git directory on Windows.

isRepositoryGitPath handles trailing dots and spaces, but does not account for NTFS Alternate Data Streams. On NTFS, the path:

.git::$INDEX_ALLOCATION/hooks/pre-commit

resolves to the real:

.git/hooks/pre-commit

The guard returns false for this path, allowing an authenticated user with repository write access to create a Git hook through the web editor.

Gogs then runs git commit without --no-verify, causing the planted hook to execute as the Gogs service account.

This results in authenticated remote code execution on Windows hosts.

The issue also existed before PR #8408. The new fix blocks trailing dot and space variants, but does not cover the NTFS ADS equivalent path.

The current guard in internal/database/repo_editor.go is:

For:

the first component remains:

after strings.TrimRight(component, ". ").

It therefore does not match .git, and the guard allows the path.

From gogs/gogs's security advisory. Shortened; the full text is there.
SoftwareAffected versions
GogsServers and applications
  • Every version up to 0.14.3
Everything about GHSA-hc35-pcqw-5xjq

Arbitrary file access in Gogs · Servers and applications

CVE-2026-82401

Arbitrary file write via git diff --output argument injection in DiffBinary

Severity
Critical 9.6
Published
24 Nov 2026
Fixed in
0.14.4
Weakness
Argument injection (CWE-88)
Attack
Over the network · Needs a user account · No user action needed
Attacker can
Change data · Take it down

The DiffBinary() function in gogs/git-module passes user-controlled branch names to git diff --full-index --binary without --end-of-options. An attacker who pushes a branch named --output=/path/to/target can trigger arbitrary file writes on the server by creating a pull request.

git-module/repo_diff.go:163-173 constructs the diff command as:

When head = "--output=/path/to/target", git interprets it as the --output option, writing diff content to an attacker-specified path.

  • Attacker pushes branch named --output=/tmp/pwned via: git update-ref 'refs/heads/--output=/tmp/pwned' HEAD && git push origin 'refs/heads/--output=/tmp/pwned'
  • Attacker creates PR via compare URL: /:owner/:repo/compare/main...--output=/tmp/pwned
  • ParseCompareInfo at route/repo/pull.go:462,470 parses headRef = "--output=/tmp/pwned" from URL
  • RevParse("--output=/tmp/pwned") at line 532 — succeeds (git rev-parse doesn't recognize --output as its own option, exits 0)
  • MergeBase with --end-of-options at line…
From gogs/gogs's security advisory. Shortened; the full text is there.
SoftwareAffected versions
GogsServers and applications
  • Every version before 0.14.4
Everything about CVE-2026-82401

From NVD, the CVE Program, OSV.dev with the GitHub Advisory Database, WPVulnerability, WordPress's security advisories and CISA's Known Exploited Vulnerabilities catalog, as they stood when this was written. Each vulnerability's own page has its latest rating and fix. This product uses the NVD API but is not endorsed or certified by the NVD.