Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐹 Go
Not in CISA KEV

CVE-2026-25232 gogs

Fix: gogs/gogs@7b7e38c

CVE-2026-25232 is a CWE-863 vulnerability in gogs.io/gogs. A fix is available for gogs.io/gogs — see the affected versions and patch details below.

Gogs has a Protected Branch Deletion Bypass in Web Interface

Also known asGHSA-2c6v-8r3v-gh6pGO-2026-4498
Published
Feb 19, 2026
Updated
Aug 12, 2026
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Sep 21, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

No confirmed exploitation observed yet

  • CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.

Exploitation and automatability from CISA’s SSVC triage for CVE-2026-25232.

EPSS Exploitation Probability

via FIRST.org ↗
0.4%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs38th percentile — riskier than 38% of all scored CVEsHighest risk

EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.

Real-World Exposure

1 pkg affected
🐹gogs.io/gogs

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.

Description

Summary

An access control bypass vulnerability in Gogs web interface allows any repository collaborator with Write permissions to delete protected branches (including the default branch) by sending a direct POST request, completely bypassing the branch protection mechanism. This vulnerability enables privilege escalation from Write to Admin level, allowing low-privilege users to perform dangerous operations that should be restricted to administrators only.

Although Git Hook layer correctly prevents protected branch deletion via SSH push, the web interface deletion operation does not trigger Git Hooks, resulting in complete bypass of protection mechanisms.

Details

Affected Component

  • File: internal/route/repo/branch.go
  • Function: DeleteBranchPost (lines 110-155)
  • Route Configuration: internal/cmd/web.go:589
    m.Post("/delete/*", reqSignIn, reqRepoWriter, repo.DeleteBranchPost)
    

Root Cause

The DeleteBranchPost function performs the following checks when deleting a branch:

  1. ✅ User authentication (reqSignIn)
  2. ✅ Write permission check (reqRepoWriter)
  3. ✅ Branch existence verification
  4. ✅ CommitID matching (optional parameter)
  5. Missing protected branch check
  6. Missing default branch check

While the UI layer (internal/route/repo/issue.go:646-658) correctly checks protected branch status and hides the delete button, attackers can directly construct POST requests to bypass UI restrictions.

Vulnerable Code

Vulnerable implementation (internal/route/repo/branch.go:110-155):

func DeleteBranchPost(c *context.Context) {
	branchName := c.Params("*")
	commitID := c.Query("commit")

	defer func() {
		redirectTo := c.Query("redirect_to")
		if !tool.IsSameSiteURLPath(redirectTo) {
			redirectTo = c.Repo.RepoLink
		}
		c.Redirect(redirectTo)
	}()

	if !c.Repo.GitRepo.HasBranch(branchName) {
		return
	}
	if len(commitID) > 0 {
		branchCommitID, err := c.Repo.GitRepo.BranchCommitID(branchName)
		if err != nil {
			log.Error("Failed to get commit ID of branch %q: %v", branchName, err)
			return
		}

		if branchCommitID != commitID {
			c.Flash.Error(c.Tr("repo.pulls.delete_branch_has_new_commits"))
			return
		}
	}

	// 🔴 Vulnerability: Missing protected branch check here
	// Should add check like:
	// protectBranch, err := database.GetProtectBranchOfRepoByName(c.Repo.Repository.ID, branchName)
	// if protectBranch != nil && protectBranch.Protected { ... }

	if err := c.Repo.GitRepo.DeleteBranch(branchName, git.DeleteBranchOptions{
		Force: true,
	}); err != nil {
		log.Error("Failed to delete branch %q: %v", branchName, err)
		return
	}

	if err := database.PrepareWebhooks(c.Repo.Repository, database.HookEventTypeDelete, &api.DeletePayload{
		Ref:        branchName,
		RefType:    "branch",
		PusherType: api.PUSHER_TYPE_USER,
		Repo:       c.Repo.Repository.APIFormatLegacy(nil),
		Sender:     c.User.APIFormat(),
	}); err != nil {
		log.Error("Failed to prepare webhooks for %q: %v", database.HookEventTypeDelete, err)
		return
	}
}

Correct implementation in Git Hook (internal/cmd/hook.go:122-125):

// check and deletion
if newCommitID == git.EmptyID {
    fail(fmt.Sprintf("Branch '%s' is protected from deletion", branchName), "")
}

Correct UI layer check (internal/route/repo/issue.go:646-658):

protectBranch, err := database.GetProtectBranchOfRepoByName(pull.BaseRepoID, pull.HeadBranch)
if err != nil {
	if !database.IsErrBranchNotExist(err) {
		c.Error(err, "get protect branch of repository by name")
		return
	}
} else {
	branchProtected = protectBranch.Protected
}

c.Data["IsPullBranchDeletable"] = pull.BaseRepoID == pull.HeadRepoID &&
	c.Repo.IsWriter() && c.Repo.GitRepo.HasBranch(pull.HeadBranch) &&
	!branchProtected  // UI layer has check, but backend doesn't

PoC

Prerequisites

  1. Have Write permissions to the target repository (collaborator or team member)
  2. Target repository has protected branches configured (e.g., main, master, develop)
  3. Access to Gogs web interface

Send Malicious POST Request

# Directly send DELETE request bypassing UI protection
curl -X POST \
  -b cookies.txt \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "_csrf=YOUR_CSRF_TOKEN" \
  "https://gogs.example.com/username/repo/branches/delete/main"
<img width="1218" height="518" alt="image" src="https://github.com/user-attachments/assets/745da7c3-6139-408c-9747-ccbe9ea8548f" />

Impact

  • Bypass branch protection mechanism: The core function of protected branches is to prevent deletion, and this vulnerability completely undermines this mechanism
  • Delete default branch: Can cause repository to become inaccessible (git clone/pull failures)
  • Bypass code review: After deleting protected branch, can push new branch bypassing Pull Request requirements
  • Privilege escalation: Writer permission users can perform operations that should only be allowed for Admins

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐹Gogogs.io/gogsall versions0.14.1go get gogs.io/gogs@v0.14.1

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for gogs.io/gogs, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update gogs.io/gogs to 0.14.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-25232 is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2026-25232 can be triaged on real exposure rather than presence alone.

Tailored to CVE-2026-25232. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

## Summary An access control bypass vulnerability in Gogs web interface allows any repository collaborator with Write permissions to delete protected branches (including the default branch) by sending a direct POST request, completely bypassing the branch protection mechanism. This vulnerability enables privilege escalation from Write to Admin level, allowing low-privilege users to perform dangerous operations that should be restricted to administrators only. Although Git Hook layer correctly prevents protected branch deletion via SSH push, the web interface deletion operation does not trigg
O3 Security · Impact-Aware SCA

Is CVE-2026-25232 in your dependencies?

O3 Security finds CVE-2026-25232 across Go dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

CVE-2026-25232: gogs PrivEsc | O3 Security