CVE-2026-52806: Gogs <= 0.14.2 - Authenticated RCE via git rebase Argument Injection

2026-08-18 Gogs PoC Public

Description

Gogs is an open source self-hosted Git service. Prior to 0.14.3, Gogs allows authenticated users to achieve Remote Code Execution (RCE) on the server by creating a pull request with a specially crafted branch name that injects the --exec flag into the git rebase command during the "Rebase before merging" merge operation.

PoC

id: CVE-2026-52806

info:
  name: Gogs <= 0.14.2 - Authenticated RCE via git rebase Argument Injection
  author: DhiyaneshDk,pdteam
  severity: critical
  description: |
    Gogs is an open source self-hosted Git service. Prior to 0.14.3, Gogs allows authenticated users to achieve Remote Code Execution (RCE) on the server by creating a pull request with a specially crafted branch name that injects the --exec flag into the git rebase command during the "Rebase before merging" merge operation.
  impact: |
    Authenticated users can execute arbitrary code on the server, potentially leading to full system compromise.
  remediation: This vulnerability is fixed in 0.14.3.
  reference:
    - https://www.cve.org/CVERecord?id=CVE-2026-52806
    - https://github.com/portbuster1337/CVE-2026-52806
    - https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/http/gogs_rebase_rce.rb
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
    cvss-score: 9.9
    cve-id: CVE-2026-52806
    epss-score: 0.07934
    epss-percentile: 0.94431
    cwe-id: CWE-77
    cpe: cpe:2.3:a:gogs:gogs:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 1
    vendor: gogs
    product: gogs
    shodan-query: title:"Sign In - Gogs"
    google-query: intitle:"Sign In - Gogs"
    fofa-query: title="sign in - gogs"
  tags: cve,cve2026,gogs,rce,argument-injection,git,authenticated,passive,vkev

http:
  - method: GET
    path:
      - "{{BaseURL}}/user/login"

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - '<meta property="og:description" content="Gogs is a painless self-hosted Git service.">'
          - '<meta name="description" content="Gogs is a painless self-hosted Git service" />'
          - "<title>Sign In - Gogs</title>"
        condition: or

      - type: status
        status:
          - 200

      - type: dsl
        dsl:
          - compare_versions(gogs_version, '<= 0.14.2')

    extractors:
      - type: regex
        name: gogs_version
        part: body
        group: 1
        regex:
          - 'Version: (\d+\.\d+\.\d+)'
        internal: true

      - type: regex
        group: 1
        regex:
          - 'Version: (\d+\.\d+\.\d+)'
        part: body
# digest: 4a0a004730450221008facd2ac15ff89324eb25d10f5b65d1f81f0648d4e65189a5d2e00c58d996d55022033b05e08b44326b195c5e176ff49782a9614c2595495a3229d4560af8a82a7c8:922c64590222798bb761d5b6d8e72950

# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.

References

Related Vulnerabilities