CriticalCVE-2026-60004

    Gitea: Remote Code Execution via diffpatch Git Hook Installation (CVE-2026-60004)

    Published Last modified In CISA KEV since Sources: BSI, Hersteller, CVE.org, OSV, pwn.watch

    What is affected, what to do

    Gitea before 1.27.1 allows remote code execution via the diffpatch API through Git hook installation.

    The vulnerability is being actively exploited; treat it as a priority. Update Gitea to version 1.27.1. Immediate actions, mitigation and detection rules are in the runbook below.

    Affected
    • Gitea lt 1.17..1.27.1
    Fixed in
    • Gitea 1.27.1

    Not sure whether and how you are affected? Ask a question about this vulnerability

    Metrics

    9.8

    Priority

    XIEM Effective CVSS: highest available CVSS rating from NVD and vendor data.

    Source: Vendor (CNA), CVSS v3

    9.8

    CVSS v3

    Severity Critical on the scale from 0 to 10.

    Source: BSI, Hersteller, CVE.org, OSV, pwn.watch

    24.0 %

    EPSS score

    Elevated — model estimates 10-50% exploitation likelihood.

    Source: FIRST EPSS, percentile 97.8

    Show all metrics
    Severity
    Critical
    Priority (0–325)

    The priority score is a consolidated metric that condenses several individual signals into a single, action-guiding ranking: technical severity (CVSS), exploitation likelihood (EPSS), known-exploited status (KEV) and the context of the affected asset. The aim is to answer the only truly important question in vulnerability management: what first?

    Read in glossary
    250.26 Methodology
    Exploit maturity

    An exploit is code or a technique that specifically uses a concrete vulnerability to force unintended behaviour — such as executing code or escalating privileges. It is the tool that turns a theoretical flaw into a practical attack.

    Read in glossary
    actively exploitedSource: VulnCheck KEV (opens in a new tab) How we classify
    XIEM Effective CVSS

    XIEM® is the tiered managed-security operating model from NEOSEC and a registered trademark of NEOSEC GmbH. It extends classic SIEM — the central collection, normalisation and correlation of security-relevant events — with endpoint forensics, network visibility and deception technology, and consolidates them into three building tiers: Sentry, Orchestrate and Command.

    Read in glossary
    9.8 Methodology
    CVSS v3

    CVSS is the globally established, open standard for assessing the technical severity of a vulnerability on a scale from 0 to 10. It describes how easily a flaw can be exploited and what damage it can cause — but not how likely its actual exploitation is. CVSS and the complementary EPSS deliberately answer different questions.

    Read in glossary
    9.8
    EPSS score

    The EPSS score is the absolute model output for an individual vulnerability: the estimated probability of real-world exploitation within the next 30 days, expressed as a value between 0 and 1 (i.e. 0 % to 100 %). A score of 0.42 means „the model estimates a 42 % chance of real-world exploitation within 30 days“.

    Read in glossary
    24.0 %
    Elevated — model estimates 10-50% exploitation likelihood.
    EPSS percentile

    The EPSS percentile is the relative position of a vulnerability within all EPSS-scored CVEs, expressed as a value between 0 and 1. A percentile of 0.90 means „this CVE has a higher EPSS score than 90 % of all other scored CVEs“. Unlike the EPSS score, it is not a probability — but a positioning within a ranking.

    Read in glossary
    97.8
    Critical — this CVE ranks in the top fifth of all CVEs scored today (rank ≥ 80%).
    KEV status

    The KEV catalogue is a list maintained by the US authority CISA of vulnerabilities for which active exploitation in the wild has been confirmed. It answers not the question „how severe?“ but „is it already being attacked?“ — thereby sharply prioritising patching.

    Read in glossary
    Actively exploited
    Published
    In CISA KEV since

    The KEV catalogue is a list maintained by the US authority CISA of vulnerabilities for which active exploitation in the wild has been confirmed. It answers not the question „how severe?“ but „is it already being attacked?“ — thereby sharply prioritising patching.

    Read in glossary
    CWE

    CWE is a catalogue of typical weakness types in software and hardware — such as flawed input validation, unsafe memory handling or poor authentication. Where a CVE names a concrete vulnerability in a concrete product, a CWE describes the underlying class of defect.

    Read in glossary
    CWE-94

    Response and mitigation

    Why act now?

    Prioritisation rationale

    This flaw is network-reachable with effectively no barrier on instances that allow open registration, because a brand-new account with its own repository satisfies the write-access precondition. It leads straight to shell command execution as the Gitea service account. Exploitation likelihood is very high, placing it among the CVEs most likely to be exploited, although CISA does not flag known ransomware use. Self-hosted Git servers are prime supply-chain targets: source code, CI secrets, deploy keys and the ability to tamper with code make them critical for KRITIS operators and software vendors alike. Rate internet-exposed instances with open registration as P1 (patch within 24 h), and internal-only instances with a small trusted user base as P2, with the endpoint block applied immediately.

    1. Runbook step 1

      Immediate response (0-24 h)

      • Upgrade to Gitea 1.27.1. All releases from 1.17.0 up to (but not including) 1.27.1 are affected. For container deployments, pin the image to 1.27.1 rather than relying on latest. Confirm the running version with gitea --version or GET /api/v1/version.
      • Block the diffpatch endpoint at the reverse proxy until patched. Return 403 for POST /api/v1/repos/*/*/diffpatch. Legitimate use of this endpoint is rare, so blocking it costs little and closes the documented attack path.
      • Turn off open self-registration. In app.ini, set [service] DISABLE_REGISTRATION = true. The "repository write access" precondition is meaningless when anyone can sign up and create their own repo. That is why this flaw rates as unauthenticated.
      • Hunt for planted hooks. Inspect <REPO_ROOT>/*/*.git/hooks/ for anything Gitea did not create itself. The expected files are typically pre-receive, update, post-receive and proc-receive, plus the *.d/gitea subdirectories. Flag modified contents, recent mtimes or unknown scripts. Example: find /data/git/repositories -path '*/hooks/*' -type f -newermt '2026-08-01' -ls.
      • If compromise is suspected, isolate the host and rotate secrets. The service account can read every repository, the database credentials and the app.ini secrets (SECRET_KEY, INTERNAL_TOKEN, JWT_SECRET). It can also reach OAuth2 client secrets, deploy keys and Actions runner and CI tokens. Treat all of them as exposed.
      • Review recently created accounts and repositories. Look for throwaway accounts registered only to run the exploit.
    2. Runbook step 2

      Mitigation layers

      • Network segmentation: Keep the web UI (default 3000/TCP, or 443 behind a proxy) and SSH (22 or 2222/TCP) off the internet. Allow access only through VPN or ZTNA. Restrict the Gitea host's egress to the destinations it actually needs (mirror sources, SMTP, webhook targets). This blunts reverse shells and exfiltration.
      • WAF/reverse proxy rule: For nginx, use location ~* ^/api/v1/repos/[^/]+/[^/]+/diffpatch { return 403; }. Optionally inspect patch bodies for hooks/ or ../ paths. A Suricata rule can combine http.method; content:"POST"; http.uri; content:"/diffpatch"; with http.request_body; content:"hooks/";.
      • Configuration hardening: Enforce [security] DISABLE_GIT_HOOKS = true so users cannot edit hooks through the UI. Do not assume this setting stops the diffpatch path; it does not replace the upgrade. Also set ENABLE_PUSH_CREATE_USER/ORG = false.
      • Endpoint hardening: Run Gitea as a dedicated unprivileged user with no sudo rights and no Docker socket access. Where your hook usage allows, mount repository volumes noexec (test this first). Under systemd, apply NoNewPrivileges=true and ProtectSystem=strict, and limit ReadWritePaths to the data directory.
      • IAM/least privilege: Cut repository write permissions back to the people who genuinely need them. Inventory personal access tokens with write:repository scope and revoke stale ones. Enforce 2FA for admins.
    3. Runbook step 3

      Detection rules

      • Proxy/web access logs: Until you have patched, investigate every POST /api/v1/repos/*/*/diffpatch. SPL example: index=proxy uri_path="/api/v1/repos/*/diffpatch" http_method=POST | stats count by src_ip, user, uri_path. Escalate hits from freshly registered accounts.
      • EDR process ancestry (Sysmon EID 1 / Linux EDR): Treat gitea → git → sh/bash/dash → curl/wget/nc/python/perl as high severity. KQL example: DeviceProcessEvents | where InitiatingProcessParentFileName in~ ("gitea","git") and FileName in~ ("bash","sh","nc","curl","wget","python3") and ProcessCommandLine !has "gitea hook". Legitimate hooks invoke gitea hook --config=....
      • auditd/FIM: Add the watch -w /data/git/repositories -p wa -k gitea_hooks and filter on paths containing /hooks/. Sigma shape: logsource: linux/file_event, TargetFilename|contains: '.git/hooks/', Image|endswith: '/git', with an allowlist for Gitea's standard hook files.
      • Network telemetry (Zeek/Suricata): Watch for new outbound connections from the Gitea host to unfamiliar destinations, especially long-lived TCP sessions on unusual ports shortly after a diffpatch request. DNS lookups for paste or tunnelling services are also suspicious.
      • Gitea application log: Correlate /diffpatch entries in the router log with the requesting user. Repeated git apply or patch failures suggest exploit trial and error.

    Detection rules

    No NEOSEC detection rule is available for this vulnerability yet.

    Classification under NIS2 and CRA

    Rule-based classification from exploitation status and severity. It does not replace a case-by-case assessment.

    NIS2

    NIS2 is EU Directive (EU) 2022/2555 to raise the level of cybersecurity across the Union. It substantially broadens obligations compared with the first NIS directive: more sectors, mandatory risk management, staged reporting duties and personal accountability of senior management.

    Read in glossary
    Actively exploited: treat the vulnerability as a priority in vulnerability handling under Art. 21(2)(e) NIS2. If it is exploited in your environment, check the reporting obligation under Art. 23 (early warning within 24 hours).
    CRA

    The CRA is EU Regulation (EU) 2024/2847 setting horizontal cybersecurity requirements for „products with digital elements“ — from industrial controllers and software to connected consumer devices. For the first time manufacturers must ensure security across the entire product lifecycle, handle vulnerabilities and provide security updates.

    Read in glossary
    Since 11.09.2026, manufacturers of affected products with digital elements must report actively exploited vulnerabilities under Art. 14 CRA, with an early warning within 24 hours via ENISA's single reporting platform.
    ISO/IEC 27001

    ISO/IEC 27001 is the internationally leading standard for an information security management system (ISMS). It describes a risk-based, process-oriented framework to systematically plan, implement, review and improve information security.

    Read in glossary
    Control A.8.8, management of technical vulnerabilities: assess relevance to your systems, plan remediation and keep evidence.

    Description

    Gitea before 1.27.1 allows remote code execution via the diffpatch API through Git hook installation.

    Source: BSI WID Portal, BSI CSAF, GitHub Security Advisories, cvelistv5, OSV (Open Source Vulnerabilities), CISA KEV Catalog, NVD (NIST), CVE.org (MITRE), pwn.watch

    Affected products

    The following versions are affected. Older releases of the same product line are also vulnerable unless stated otherwise.

    Affected products
    Affected versionsFixed in
    GiteaGitea
    • 1.17 – < 1.27.1
    • 1.27.1
    giteagitea
    • 1.17.0 – < 1.27.1
    • 1.27.1
    Open SourceGitea
    • < 1.27.1
    • 1.27.1
    gocode.gitea.io/gitea
    • 1.17.0
    • —
    gogitea.dev
    • —
    • —

    Vendors and products

    Weakness classes (CWE)

    • CWE-94Improper Control of Generation of Code ('Code Injection')

      Base

      The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.

      Entry at MITRE CWE-94

    Public exploit references

    Publicly reported proof-of-concepts, exploit modules and detection templates for this vulnerability. NEOSEC links to the original sources only and does not provide any exploit code.

    Public exploit references
    CISA KEV CatalogCISA Known Exploited Vulnerability (opens in a new tab)cisa.govactively exploited
    PoC-in-GitHub (nomi-sec)CVE-2026-60004-PoC (opens in a new tab)github.comPoC (publicly reported)reported, not verified
    PoC-in-GitHub (nomi-sec)CVE-2026-60004-Gitea-RCE-PoC (opens in a new tab)github.comPoC (publicly reported)reported, not verified
    PoC-in-GitHub (nomi-sec)CVE-2026-60004-Gitea-Validator (opens in a new tab)github.comPoC (publicly reported)reported, not verified
    PoC-in-GitHub (nomi-sec)cve-2026-60004 (opens in a new tab)github.comPoC (publicly reported)reported, not verified
    PoC-in-GitHub (nomi-sec)CVE-2026-60004-poc-gitea (opens in a new tab)github.comPoC (publicly reported)reported, not verified
    PoC-in-GitHub (nomi-sec)CVE-2026-60004-gitea-0day (opens in a new tab)github.comPoC (publicly reported)reported, not verified
    PoC-in-GitHub (nomi-sec)CVE-2026-60004 (opens in a new tab)github.comPoC (publicly reported)reported, not verified
    PoC-in-GitHub (nomi-sec)CVE-2026-60004 (opens in a new tab)github.comPoC (publicly reported)reported, not verified
    PoC-in-GitHub (nomi-sec)CVE-2026-60004-POC (opens in a new tab)github.comPoC (publicly reported)reported, not verified
    PoC-in-GitHub (nomi-sec)CVE-2026-60004 (opens in a new tab)github.comPoC (publicly reported)reported, not verified
    PoC-in-GitHub (nomi-sec)CVE-2026-60004 (opens in a new tab)github.comPoC (publicly reported)reported, not verified
    PoC-in-GitHub (nomi-sec)CVE-2026-60004 (opens in a new tab)github.comPoC (publicly reported)reported, not verified

    References & sources

    Changes to this CVE

    Who changed this CVE and when: NVD (analysis, affected products, CVSS), the CVE publisher (CNA) and additional providers such as CISA (ADP).

    1. CISA KEV entry updated9119a7d8…

      4 individual changes: Date Added, Due Date, Required Action, Vulnerability Name

      Show 4 original changes
      Individual changes of this event as published by NVD
      TypeActionBeforeAfter
      Date Addedadded
      —
      2026-08-25
      Due Dateadded
      —
      2026-08-25
      Required Actionadded
      —
      2026-08-25
      Vulnerability Nameadded
      —
      2026-08-25

      Source identifier: 9119a7d8-5eab-497f-8521-727c672e3725

    2. Record modifiedCISA ADP

      CISA assessment (SSVC): exploitation: active, automatable: yes

      Show 2 original changes
      Individual changes of this event as published by NVD
      TypeActionBeforeAfter
      Referenceadded
      —
      https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2026-60004
      SSVC assessmentadded
      —
      {"id":"CVE-2026-60004","role":"CISA Coordinator","options":[{"exploitation":"active"},{"automatable":"yes"},{"technicalImpact":"total"}],"version":"2.0.3","timestamp":"2026-08-26T20:21:46.783249Z"}

      Source identifier: 134c704f-9b21-4f2e-91b3-4a467353bcc0

    Linked advisories

    Embed badge

    Show the severity and KEV status of this vulnerability on your site – with a link back here. The image is updated hourly.

    Badge preview for CVE-2026-60004
    <a href="https://intel.neosec.eu/en/cve/CVE-2026-60004"><img src="https://intel.neosec.eu/badge/cve/CVE-2026-60004.svg?lang=en" alt="CVE-2026-60004 – NEOSEC Intel" height="20"></a>