ALITEQ.

your newest Gitea contributor might already have a shell on your server

A patch, a diff, and a Git hook was all it took — no admin access required, and Gitea's own advisory shipped with working exploit code attached.

Priya NairUpdated 2h ago6 min readWeb story
A developer's screen showing a git diff and terminal window side by side

Gitea shipped version 1.27.1 on July 27, fixing a 9.8-severity remote code execution bug that let anyone with plain repository write access — the exact permission level Gitea hands to any account it lets self-register — turn a crafted patch into a live git hook and run shell commands as the Gitea service account. No admin rights needed. And the advisory that disclosed it arrived with working proof-of-concept code already attached.

How a diff turns into a shell

Here's the mechanism, stripped of jargon. Gitea's diffpatch endpoint applies uploaded patches to a temporary clone of a repository so it can preview a merge. Submit the same crafted patch twice and you force an add/add collision — two versions of the same new file colliding during a three-way merge. Git's fallback for that collision checks out both candidate files into the working tree, and because the temporary clone is bare, its working-tree root doubles as Git's own hook directory. Land a file at hooks/post-index-change there, and it becomes an executable hook that fires the next time the index updates — running with whatever privileges the Gitea service account has, not the attacker's.

1. Attacker with ordinary repo write access calls POST /api/v1/repos/{owner}/{repo}/diffpatch
2. The same malicious patch is submitted twice, forcing an add/add merge collision
3. Git's three-way fallback checks out hooks/post-index-change into the bare clone's root ($GIT_DIR)
4. The hook fires on the next index update, executing as the Gitea service account

Who's actually exposed

This hits self-hosted Gitea instances specifically — the kind small teams and open-source projects spin up because they don't want their code on someone else's cloud. The part that makes it worse than a typical privilege-escalation bug: Gitea enables public self-registration by default. An attacker doesn't need to compromise an existing account or wait for an insider threat. They can visit an unmodified installation, register a normal account, create a repository, and exploit the bug with credentials they issued to themselves thirty seconds earlier.

CVE-2026-60004 at a glance

CVE

Value
CVE-2026-60004

CVSS

Value
9.8 (Critical)

Affected

Value
Gitea 1.17 through 1.27.0

Fixed in

Value
1.27.1, released July 27, 2026

Attacker needs

Value
Ordinary repository write access — no admin, no insider access
A small server rack in an office, the kind teams use to self-host developer tools
The flaw lives in how Gitea's API processes patch diffs — not in the underlying git client itself. · Unsplash

This keeps happening to self-hosted dev tools

Gitea isn't an outlier this year, it's a pattern. An upload-processing endpoint was also the root cause behind Rails Active Storage's file-type spoofing bug, and unpatched internal tooling is exactly why ServiceNow's pre-auth RCE was still being actively exploited months after the fix shipped. Add the Fastjson library that went unpatched for years before this one finally landed and vBulletin's own pre-auth RCE going public a month after its quiet fix, and the throughline is obvious: the tools developers install for themselves get patched far slower than the SaaS products IT departments track centrally.

Upgrade to Gitea 1.27.1 immediately — the fix is a version bump, not a config migration.

2

Check access logs for repeated diffpatch calls against the same repository — that repetition is the signature Gitea's own advisory flags as exploitation behavior.

3

Disable public self-registration if your instance doesn't need it — it collapses the 'needs repo write access' requirement to zero effort for an outsider.

4

Audit exactly what host-level access the Gitea service account has — the hook executes as that account, so its blast radius is your actual exposure.

Quick answers

Do I need to be a Gitea admin to get hit by this?
No — the opposite. The bug only requires ordinary repository write access, the same permission Gitea grants to any newly self-registered account by default.
Is there a workaround if I can't patch immediately?
Disabling public self-registration and tightening who gets write access shrinks the attack surface, but it's a mitigation, not a fix — 1.27.1 is the actual patch.
Has this been exploited in the wild?
As of Gitea's July 28 advisory, no confirmed in-the-wild exploitation had been reported. Public proof-of-concept code means that window is closing fast.

Verdict

My take

A 9.8 that only needs the access level Gitea grants to a stranger who signed up thirty seconds ago is about as bad as self-hosted RCE gets. If your instance has been running since before July 27 with open registration enabled, treat this like an active incident, not a maintenance ticket.

Gitea's own advisory feed is worth watching directly if you run any self-hosted instance — this is the kind of bug that gets rediscovered by opportunists for months after the headlines move on. And zoom out: Microsoft's own record-setting 569-CVE Patch Tuesday this year is the broader evidence that patch volume across the entire industry is climbing faster than most teams' triage capacity — which is exactly why a 9.8 needing zero privileges shouldn't sit in a normal patch-cycle queue.

Software & Systems Editor

Priya Nair

Priya has daily-driven more Linux distros than she can name and treats her setup like a workshop. She covers the operating systems, apps and settings worth your time — and cheerfully calls out the 'optimizations' that just quietly break your machine.

Work out the hardware

The Aliteq brief

The tech worth knowing — hardware, AI, gaming, deals. No spam, unsubscribe anytime.

Keep reading