Open-Source Security Intelligence

Know every vulnerability
before it knows you.

DevGuard continuously monitors your dependencies and alerts you when CVEs like this one affect your stack — with real-time threat intelligence built for developers.

Search

GHSA-mrph-w4hh-gx3g

MediumCVSS 6.5 / 10
Published Feb 6, 2026·Last modified Feb 19, 2026
Affected Components(0)

No affected components available

Description

Vulnerability Description

In the endpoint:

/username/reponame/settings/hooks/git/:name

the :name parameter:

  • Is URL-decoded by macaron routing, allowing decoded slashes (/)
  • Is then passed directly to:
git.Repository.Hook("custom_hooks", name)

which internally resolves the path as:

filepath.Join(repoPath, "custom_hooks", name)

Because no path sanitization is applied, supplying ../ sequences allows access to arbitrary paths outside the repository.

As a Result:

  • GET: Arbitrary file contents are displayed in the hook edit page textarea (Local File Inclusion).
  • POST: Existing files can be overwritten with attacker-controlled content (Arbitrary File Write).

Attack Prerequisites

  • The attacker is an authenticated user
  • The attacker has Admin or higher privileges on the target repository
  • The attacker has the AllowGitHook permission (or is a site administrator)
  • The target file is readable/writable by the Gogs process OS permissions

Attack Scenario

  1. An attacker (with AllowGitHook + repository Admin privileges) accesses the Git hook edit URL
  2. A path containing ../ is supplied in :name, fully URL-encoded using %2f
  3. The server resolves custom_hooks/../../... without validation
  4. Arbitrary file contents are displayed and existing files can be overwritten

Potential Impact

  • Sensitive information disclosure: app.ini, databases, logs, environment variables, etc.
  • Configuration or data tampering: Overwriting existing files
  • Secondary impact: Extraction of SECRET_KEY and database credentials may allow token forging or further compromise
Risk Scores
Base Score
6.5

The vulnerability can be exploited over the network without needing physical access. It is easy for an attacker to exploit this vulnerability. An attacker needs high-level or administrative privileges. No user interaction is needed for the attacker to exploit this vulnerability. The impact is confined to the system where the vulnerability exists. There is a high impact on the confidentiality of the information. There is a high impact on the integrity of the data.

Threat Intelligence
6.0

Exploitation attempts have been detected. Elevated vigilance and prompt remediation are advised.

EPSS
0.46%

The exploit probability is very low. The vulnerability is unlikely to be exploited in the next 30 days.

Exploit
Not available

We did not find any exploit available. Neither in GitHub repositories nor in the Exploit-Database.

Browse More

Scan your project

Continuously monitor your dependencies and get alerted when vulnerabilities like this one affect your stack.

Checkout DevGuard