Safeguard
Vulnerability Analysis•

CVE-2022-1884: Critical Command Execution in Gogs on Windows

CVE-2022-1884 is a critical command execution flaw in Gogs 0.12.7 and earlier on Windows, scored 9.8. No fixed version was confirmed, so check the project.

Safeguard Security Team
4 min read

CVE-2022-1884 is a critical severity remote command execution flaw in Gogs versions up to and including 0.12.7 when deployed on a Windows server, scored 9.8 by NVD. It abuses file upload path handling to write into the git directory. I could not confirm a fixed version, so check the project.

What's affected

The record says gogs/gogs versions up to and including 0.12.7 are affected when deployed on a Windows server. The tree_path parameter is not properly validated during file uploads, so a file can be written into the repository's git directory, including its config file. If a particular git setting for the SSH command is then set, that can lead to remote command execution. The vector is CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.

The only reference is a huntr bounty page, which would not load for me, so I could not read any maintainer statement. The record gives no fixed version. Check the Gogs release notes and the bounty report for the current status before you rely on any version number.

The record also lists Windows as a platform. Nothing I read says Linux deployments are affected, but I cannot rule that out either, so do not read the platform note as a guarantee.

Weakness class: CWE-78, CWE-77.

How to check if you're exposed

Gogs can report its version from the command line:

./gogs --version

The web admin dashboard also shows the version. Anything at or below 0.12.7 on Windows is in scope. Then check whether the instance is reachable by people who should not have accounts, since the vector assumes no privileges, although the record describes a file upload, which in practice needs some way to reach the upload feature.

What to do now

  1. Find every Gogs instance and note its version and operating system.
  2. Check the Gogs project's releases and security notes for a fix for this CVE, and upgrade when one is named.
  3. Until then, restrict access to Windows hosted instances to a VPN or an allowlist of addresses.
  4. Turn off open registration, so strangers cannot create accounts.
  5. Review repositories for unexpected changes to git configuration files.

Why it matters

The record's example sets the path to the git directory name followed by a trailing dot. Windows commonly ignores trailing dots, which would explain how a check for the exact directory name can be bypassed, although I could not read the report to confirm that is the mechanism. An uploaded file then lands inside the git directory, and git runs a configured command when it needs to talk over SSH. The record files this as CWE-78 and CWE-77: OS command injection and the more general command injection.

The lesson is that path rules differ by operating system, and that security checks written for one filesystem can miss alternate spellings on another. Windows trims trailing dots and spaces, treats case as equal and has short names, so each is worth a test.

Self hosted git servers hold source code and often credentials, and a compromise there reaches build systems. Keep them off the public internet when you can.

This CVE is not listed in the CISA Known Exploited Vulnerabilities catalog, and none of the pages I read state that it is exploited in the wild. That is a statement about what is known, not a reason to delay the fix.

Quick check

Is there a fixed version?

I could not confirm one. The record only says versions up to and including 0.12.7 are affected, and its single reference could not be read.

Does it affect Linux?

The record describes Windows deployments. Nothing I read confirms Linux is safe, so check the project.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

We email you a link to confirm, and only then add you to the list. Unsubscribe in one click. Privacy

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.