CVE-2026-52806 Elastic Security · Elastic

Detect CVE-2026-52806: Gogs RCE via git rebase --exec Argument Injection in PR Merge in Elastic Security

Detects exploitation of CVE-2026-52806, a critical command injection vulnerability (CWE-77) in Gogs versions prior to 0.14.3. An attacker can inject arbitrary shell commands via the git rebase --exec argument during pull request merge operations, leading to remote code execution on the Gogs server. A public PoC is available.

MITRE ATT&CK

Tactic
Execution Persistence Lateral Movement

Elastic Detection Query

Elastic Security (Elastic)
eql
sequence by host.name with maxspan=30s
  [process where event.type == "start"
   and (
     (process.name == "git" and process.args : "rebase" and process.args : "--exec")
     or
     (process.parent.name : ("gogs", "gogs.exe") and process.name : ("bash", "sh", "curl", "wget", "nc", "ncat", "python*", "perl"))
   )
  ]
  [process where event.type == "start"
   and process.parent.name : ("git", "gogs", "gogs.exe")
   and process.name : ("bash", "sh", "curl", "wget", "nc", "python*", "perl", "cmd.exe", "powershell.exe")
  ]
critical severity high confidence

EQL sequence detection correlating a git rebase --exec invocation with a subsequent suspicious child process on the same host within 30 seconds, indicating successful command injection exploitation of Gogs.

Data Sources

Elastic Endpoint SecurityAuditbeatWinlogbeat

Required Tables

logs-endpoint.events.process*auditbeat-*winlogbeat-*

False Positives & Tuning

  • Legitimate git rebase --exec workflows where the exec command is benign and expected
  • Developer tooling that wraps git rebase and spawns shell scripts as part of normal operation
  • Automated git hooks or post-merge scripts that spawn curl or wget for notifications

Other platforms for CVE-2026-52806


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Simulate git rebase --exec argument injection via crafted PR branch name

    Expected signal: Process creation event: git with args [rebase, --exec, id > /tmp/cve_rce_proof.txt, target]; child process creation: sh -c 'id > /tmp/cve_rce_proof.txt'; file creation event at /tmp/cve_rce_proof.txt

  2. Test 2Gogs suspicious child process simulation — reverse shell via curl

    Expected signal: Process creation event showing bash or curl with parent process name 'gogs'; network connection attempt from gogs-named process to 127.0.0.1:9999

  3. Test 3Persistence via cron injection post-Gogs RCE simulation

    Expected signal: Process creation: git rebase --exec with crontab modification command; crontab process invocation; file write to /tmp/cve_persist_marker.txt; audit log entry for crontab modification

Unlock Pro Content

Get the full detection package for CVE-2026-52806 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections