CVE

Gitea Diffpatch RCE (CVE-2026-60004)

Read the version Gitea serves unauthenticated and flag builds missing the 1.27.1 diffpatch fix, with no patch request ever sent.

AuthorTrickest
100%

Notes on this workflow

Gitea via i_like_gitea cookie / Powered by Gitea; version via /api/v1/version

Counts + affected.jsonl

Targets: hosts/URLs, one per line

Overview

This workflow flags self-hosted Gitea instances missing the 1.27.1 fix for CVE-2026-60004, the diffpatch bug that turns a repository write into code execution. The diffpatch API applies attacker-controlled patches inside a temporary bare clone, where the repository root is the Git directory itself, so a patch that adds a file under the hooks directory plants a live, executable Git hook. The trigger needs the same patch submitted twice, which materializes the conflicting hook file on disk, and the hook then executes with the Gitea service account's privileges. On default installs anyone who can self-register has repository write access, so reachability is broad. CISA listed it on KEV with exploitation evidence, and the exploit is a POST of crafted patches, which this workflow never sends. This page describes the existing Gitea RCE check workflow; its detection is version-based, and that is reliable here because the flaw is in the shipped implementation, not configuration. Each instance comes back with a verdict you can feed into exposure management.

Pipeline

  1. Read the target list and GET the public version API, which needs no token on default configurations, and read the version from its JSON answer.
  2. When the API requires sign-in, fall back to one homepage GET and fingerprint Gitea from its session cookie, footer line, or page title. A confirmed instance with a gated version stays version-unknown rather than clean.
  3. Classify: version 1.17.0 up to but not including 1.27.1 is affected; 1.27.1 or later is not.
  4. Never POST to the diffpatch API, never send repeated-identical-patch patterns, and never verify timing callbacks, since the public proofs of concept use a timing delta and that is exploitation.
  5. Reconcile one verdict per instance and write findings plus summary counts.

Inputs

  • Target list. Gitea instance URLs you are authorized to fingerprint. The default file ships a sample list; bind your own.

Outputs

  • results.jsonl. One row per instance: target, whether Gitea was detected, the version read, the affected flag for the 1.17.0 through 1.27.0 window, and an error field for unreachable, non-Gitea, or sign-in-gated version answers.
  • summary.json. Counts across the list: targets, product hits, affected, not affected, version unknown, exposed, and errors, plus an affected.jsonl with the flagged rows.

Integrations

  • HTTP. At most three GET requests per host, read-only, no accounts or tokens created.

Sample output

The records below are illustrative and do not come from a real run. They show an instance below the fix, a patched one, and an old unsupported build.

targetproduct_detectedversionaffectederror
https://git-a.example.comtrue1.26.3truenull
https://git-b.example.orgtrue1.27.1falsenull
https://git-c.example.nettruenullnullversion_unknown_auth
{"cve": "CVE-2026-60004", "vendor": "Gitea", "total_targets": 3, "product_hits": 3, "affected": 1, "not_affected": 1, "version_unknown": 1, "exposed": 1, "errors": 0}

FAQ

Why is a version check reliable for this bug?

Because the flaw lives in the shipped diffpatch implementation, not in a configuration choice or an application-specific code shape. A build below 1.27.1 carries the bug, and the version is exactly what Gitea serves unauthenticated, so the version match is the detection.

Does the workflow send patches?

No. The exploit is a POST of crafted patches to the diffpatch API, and the timing-verification trick the public proofs of concept use is exploitation too. The workflow sends GET requests only and creates no accounts or repositories.

What does an affected verdict mean here?

It means any user with repository write access, which on default installs includes self-registered users, can plant an executable hook. CISA lists this on KEV with exploitation evidence, so pair the patch with a host-side hunt for unexpected executable files under repository hooks directories, especially post-index-change.

What is CVE-2026-60004?

Improper control of code generation in Gitea's diffpatch API: a bare clone's Git directory is the repository root, so a hook added by a patch becomes live code. Fixed in 1.27.1, listed on CISA KEV in August 2026.

Get a personalized demo

See Trickest in Action

A 30-minute walkthrough. We map the platform to your stack and answer pricing and deployment questions for your environment.