Home/ Blog/ Security news/ Article
Blog · Security news

Gitea flaw CVE-2026-60004 lets any user run code on your server, now exploited. Patch 1.27.1.

CISA added Gitea's CVE-2026-60004 to its exploited list on Aug 25. A public exploit lets any user run code via the diffpatch API. Patch to 1.27.1 and hunt.

Glass server unit with a folded paper feeding a slot that triggers an internal arm

The dangerous stretch for anyone self-hosting Gitea was not the day the patch shipped. It was the twenty-eight days after. Gitea released version 1.27.1 on July 28, and a working proof-of-concept exploit went public the same day, published in the advisory and credited to the researcher NightRang3r. CISA only added the bug, CVE-2026-60004, to its Known Exploited Vulnerabilities catalog on August 25, with a federal deadline of August 28. That month-long gap, patch available and exploit public well before exploitation was confirmed, is the part that should worry you more than the flaw itself.

If you run Gitea and have not touched it since July, the question has quietly shifted from are we patched to were we already hit. Here is what the flaw does, who is actually exposed, and the one on-host signal that tells you whether someone walked through the window before you closed it.

What the flaw does

Gitea is a lightweight, self-hosted Git service that many teams run in place of GitHub for private code. The bug lives in its patch-apply feature, the diffpatch API endpoint. A crafted patch, through a collision in how Git applies changes inside a bare repository, writes an executable file into the repository's hooks directory. Git then runs that file as a hook the next time it updates the index, and the commands execute as the operating-system account Gitea runs under. Gitea rates it 9.8 out of 10 and classifies it as code injection (CWE-94). The official advisory credits the researcher known as NightRang3r and gives the affected range plainly: every release from 1.17 up to but not including 1.27.1.

The published proof of concept does one thing worth flagging for defenders. It does not phone home. Rather than an outbound callback, it stashes command output inside Git objects and pulls it back over ordinary authenticated Git-over-HTTP traffic, as CyCognito noted in its writeup. That design choice changes how you detect it, which I will come back to.

Why "needs write access" understates it

Read the CVSS vector and one field looks reassuring: privileges required, none. Read the advisory and you see why. The exploit needs plain write access to some repository. On paper that sounds like it only touches teams who hand out repo permissions. In practice, Gitea enables open registration by default. On a default install, anyone passing by can sign up, spin up a repository of their own, and immediately hold the write access this exploit depends on. The "privileges: none" rating is literal on any Gitea that still accepts signups.

So the exposed population is not "orgs that grant write access." It is every internet-reachable Gitea with registration left on, which is the out-of-the-box state. That is a much larger group than the CVSS text implies, and it is a good part of why this reached the exploited list quickly.

The window, in dates

CVE-2026-60004: the 28-day windowJul 28: Fix ships. Jul 28: PoC public. Aug 25: KEV listing. Aug 28: Fed deadline.CVE-2026-60004: the 28-day windowJul 28Fix shipsJul 28PoC publicAug 25KEV listingAug 28Fed deadline
Sources: Gitea GHSA-rcr6-4jqh-j84m advisory; CISA Known Exploited Vulnerabilities catalog.

The fix and a working exploit both went public on July 28. CISA confirmed real-world exploitation and added the flaw on August 25, twenty-eight days later, then set the federal patch deadline three days out on August 28. That three-day figure is worth a second look. CISA's usual KEV deadline runs closer to three weeks. A window this compressed suggests the agency is seeing exploitation serious or widespread enough to treat as urgent rather than a routine catalog add.

Patching closes the door. It does not tell you who already came in.

Upgrading to 1.27.1 stops future exploitation. It says nothing about whether someone used the exploit during the month it sat public. For that you look at artifacts on the host, and this flaw leaves two good ones.

First, the whole trick is planting an executable Git hook where none belongs. A file such as post-index-change turning up under the hooks directory of a bare repository, especially one with recent write activity, is the smoking gun. File-integrity monitoring on your repository storage, watching for new or newly-executable files in hooks paths, catches it whether or not you have patched.

Second, watch process lineage. Gitea's service account has no reason to spawn sh, bash, or an interpreter as a child of the Gitea process during a routine index update. That parent-child pattern is the execution itself, and it is hard for an attacker to avoid. Because the public exploit exfiltrates over authenticated Git-over-HTTP rather than a callback, do not lean on egress monitoring here: watching outbound connections from the Gitea host will miss it. The durable signal is on the host, not on the wire.

What to do this week

  • Patch to Gitea 1.27.1 or later. This is the only real fix. Everything below buys time, not safety.

  • If you cannot patch today, mount the temporary directory Gitea uses as noexec. The exploit needs a writable and executable temp filesystem to stage its hook, so a noexec mount is the most durable stopgap.

  • Turn off open registration on any internet-facing instance. This shrinks who can reach the flaw, but be honest about the limit: it does nothing about accounts already created, and it is not a fix. The advisory says as much.

  • Block the diffpatch route at your reverse proxy or web application firewall until the upgrade is done.

  • Hunt backward. Check hooks directories for unexpected executables and review process history for the Gitea account spawning a shell since late July.

The pattern worth remembering

Self-hosted developer tools keep producing this exact shape of bug: a feature that turns repository content into code execution, reachable by anyone who can sign up. We saw it when Gitea's Docker image trusted a reverse-proxy login header, in self-hosted Gogs leaking repositories through its mirror settings, in a no-login session hijack in self-hosted GitLab, and in Adminer's authenticated path to code execution. Running your own Git server is a fair call, but it puts the patch clock on your team, and CVE-2026-60004 shows how short that clock can run. Treat the diffpatch bug as today's work, then decide whether a stranger should be able to register on your code server at all.

Topics

Frequently asked questions

What is CVE-2026-60004?

CVE-2026-60004 is a critical code-injection flaw in Gitea, the self-hosted Git service. A crafted patch sent to the diffpatch API plants an executable Git hook that runs shell commands as the Gitea service account. Gitea rates it 9.8 out of 10.

Which Gitea versions are affected and what is the fix?

Every Gitea release from 1.17 up to but not including 1.27.1 is affected. The fix is Gitea 1.27.1 or later. Upgrading is the only real remediation; workarounds like disabling registration reduce exposure but do not close the flaw.

Can the Gitea flaw be exploited without an account?

The exploit needs write access to a repository, but Gitea enables open registration by default. On an unmodified, internet-facing install a stranger can register an account and create a repository to obtain that access, which makes the flaw effectively unauthenticated.

Is CVE-2026-60004 being actively exploited?

Yes. CISA added CVE-2026-60004 to its Known Exploited Vulnerabilities catalog on August 25, 2026, which confirms active exploitation in the wild, and set a federal patch deadline of August 28. A working proof-of-concept exploit has been public since July 28.

How do I detect if my Gitea server was already compromised?

Look on the host, not the network. Check for unexpected executable files such as post-index-change in repository hooks directories, and review process history for the Gitea service account spawning sh or bash. The public exploit exfiltrates over authenticated Git-over-HTTP, so egress monitoring will miss it.

What can I do if I cannot patch Gitea immediately?

Mount the temporary directory Gitea uses as noexec, since the exploit needs a writable and executable temp filesystem. Also disable open registration on internet-facing instances and block the diffpatch route at your reverse proxy or web application firewall until you upgrade to 1.27.1.

See what Suriq finds on your own servers.

Agentless checks for uptime and your cloud, a lightweight agent for detection on each server, and one console that ranks and explains what it finds.