Cyber Security News

Critical Gogs Flaw Enables Remote Code Execution Through Path Traversal

A critical vulnerability in Gogs, the self-hosted Git service, could allow authenticated attackers to execute commands on the server by abusing path traversal during creation.

Tracked as CVE-2026-52813, the flaw was reported by Aikido security researcher Jorian Woltjer and fixed in Gogs version 0.14.3.

The issue stems from an API endpoint that accepted unsanitized organization usernames before passing them to a filesystem path-construction routine.

Gogs used filepath.Join to append an organization name to its configured repository root. While standard account-registration controls restricted usernames to safe alphanumeric characters, dashes, underscores, and periods, the organization-creation API did not enforce the same validation.

Critical Gogs Flaw Enables Remote Code Execution

An authenticated attacker could supply an organization name containing ../ traversal sequences, directing Gogs to create a repository outside its intended storage path.

For example, a crafted organization name could target a writable temporary location such as /tmp. Gogs would then initialize a bare Git repository at the attacker-selected filesystem location.

Gogs Path Traversal Flaw (Source: Aikido)

Initially, this behavior appeared to offer only a constrained file-write primitive. Bare repositories contain Git metadata rather than a conventional working tree, limiting opportunities to overwrite arbitrary application files directly.

However, Woltjer demonstrated that Gogs’ web-based editing mechanism could be exploited to convert the primitive into remote code execution. Gogs creates temporary worktrees when users edit repository files through its web interface.

An attacker could first create a legitimate repository that supports web editing, then use a traversal-named organization to place a malicious bare repository within the temporary worktree.

From a local clone of the legitimate repository, the attacker could commit a Git hook to a path such as traversal.git/hooks/update. Although Gogs’ web editor blocks paths containing .git/, a standard Git push could bypass that restriction.

The validation logic looked for a path segment named exactly .git, allowing a directory such as traversal.git to evade the check. A subsequent API-driven commit to the nested repository would trigger the malicious update hook, executing attacker-controlled commands as the account used by the Git service.

The disclosure also highlights CVE-2026-52810, a separate authorization weakness affecting Git HTTP requests. Gogs partly classified requests as read-only pulls based on a service query parameter, while routing operations based on the request path.

Supplying service=git-upload-pack to a git-receive-pack request could cause a push to be treated as a pull, potentially enabling read-only users to write to private repositories. Woltjer reported that the authorization issue affected private repositories and deployments that require authentication to view.

Administrators should upgrade to Gogs 0.14.3 or later to address CVE-2026-52813, inspect instances for suspicious organization names, unexpected repository paths, and rogue Git hooks, and closely monitor upstream remediation efforts for the receive-pack authorization bypass.

The flaws demonstrate how weak identifier validation and blurred authorization boundaries can turn Git hosting features into server-side attack paths, especially in environments where repositories feed automated CI/CD workflows.

Prevent incidents due to slow investigations. Power your Tier 1 with threat intelligence from 15K SOCs: Integrate TI Lookup in your SOC

Eswar

Eswar is a Cyber security content editor with a passion for creating captivating and informative content. With years of experience under his belt in Cyber Security, he is covering Cyber Security News, technology and other news.

Recent Posts

Hackers Use ConnectWise SkyKick Credentials to Access Microsoft 365, Halting Cloud Backups

Attackers abused compromised ConnectWise Cloud Backup credentials to access Microsoft 365 customer environments, prompting ConnectWise…

1 day ago

Anthropic’s Claude AI Uncovers Origins of NSA-Provided Cryptographic Keys After 25 Years

Anthropic says an internal Claude research model reconstructed how the National Security Agency generated seeds…

2 days ago

Critical WordPress Flaws Allow Attackers to Execute Remote Code Without Authentication

Two WordPress Core vulnerabilities can be chained to execute remote code without authentication, according to…

2 days ago

OpenBSD Kernel Flaw Dating Back 37 Years Enables Local Privilege Escalation to Root

A newly disclosed OpenBSD kernel exploitation chain combines a shared memory accounting flaw with a…

2 days ago

GhostAction Hackers Hide Credential-Stealing Malware in Fake Font Files Across 94 GitHub Repositories

GhostAction attackers have expanded their GitHub credential theft campaign with a second stage that disguises…

2 days ago

SideCopy Hackers Target Indian Organizations With ReverseRAT Malware to Steal Data

Indian authorities have warned that SideCopy hackers are targeting Indian organizations, including academic institutions, with…

2 days ago