Saturday, July 13, 2024

Gogs Vulnerabilities Let Attackers Hack Instances & Steal Source Code

Gogs is a standard open-source code hosting system used by many developers.

Several Gogs vulnerabilities have been discovered recently by the cybersecurity researchers at SonarSource. 

Gogs can be hacked through these flaws, which put its instances at risk of source code theft, backdoor implantation as well as code removal.

Gogs Vulnerabilities

Despite Gogs’ widespread use, with more than 44,000 GitHub stars and 90 million Docker image downloads, these vulnerabilities remain unpatched.

This finding highlights the need to secure development tools and self-hosted code repositories.

"Is Your System Under Attack? Try Cynet XDR: Automated Detection & Response for Endpoints, Networks, & Users!"- Free Demo

The Gogs’ built-in SSH server contains an Argument Injection Vulnerability that allows authenticated attackers to execute any command on the server.

The vulnerability exploits the ‘–split-string‘ option in the ‘env’ command to bypass security measures.

As a result, this vulnerability continues to be unpatched even in the latest Gogs release (0.13.0).

This security issue is consequently exposed in about 7,300 open Gogs instances on Shodan that largely endangers source code integrity and server protection for several organizations using Gogs for code hosting, reads SonarSource report.

Shodan report (Source – Sonar)

In order to exploit the Gogs SSH server vulnerability, three conditions must be met:- 

  • The built-in SSH server needs to be switched on.
  • There is a necessity for an authentic SSH key.
  • The use of “env -–split-string” compatible version.

Exploitable set-ups typically employ GNU core-utils in Ubuntu or Debian, while Alpine Linux-based Docker images and Windows installations are not affected.

If registration is enabled, attackers can easily create accounts and add SSH keys. Admins can confirm this vulnerability by checking their SSH settings in the admin panel and look if ‘env –help’ shows ‘–split-string’ among its options.

Gogs maintainers ceased communication after initially accepting vulnerability reports, leaving all four reported issues unpatched in the latest version. 

As a result, users must implement their own mitigations to protect their installations.


Here below we have mentioned all the recommendations and mitigations provided by the security analysts:-

  • Disable the built-in SSH server
  • Disable user registration
  • Switch to Gitea
  • Argument Injection in the built-in SSH server
  • Argument Injection when tagging new releases

Are you from SOC/DFIR Teams? - Sign up for a free ANY.RUN account! to Analyse Advanced Malware Files


Latest articles

mSpy Data Breach: Millions of Customers’ Data Exposed

mSpy, a widely used phone spyware application, has suffered a significant data breach, exposing...

Advance Auto Parts Cyber Attack: Over 2 Million Users Data Exposed

RALEIGH, NC—Advance Stores Company, Incorporated, a prominent commercial entity in the automotive industry, has...

Hackers Using ClickFix Social Engineering Tactics to Deploy Malware

Cybersecurity researchers at McAfee Labs have uncovered a sophisticated new method of malware delivery,...

Coyote Banking Trojan Attacking Windows Users To Steal Login Details

Hackers use Banking Trojans to steal sensitive financial information. These Trojans can also intercept...

Hackers Created 700+ Fake Domains to Sell Olympic Games Tickets

As the world eagerly anticipates the Olympic Games Paris 2024, a cybersecurity threat has...

Japanese Space Agency Spotted zero-day via Microsoft 365 Services

The Japan Aerospace Exploration Agency (JAXA) has revealed details of a cybersecurity incident that...

Top 10 Active Directory Management Tools – 2024

Active Directory Management Tools are essential for IT administrators to manage and secure Active...
Tushar Subhra Dutta
Tushar Subhra Dutta
Tushar is a Cyber security content editor with a passion for creating captivating and informative content. With years of experience under his belt in Cyber Security, he is covering Cyber Security News, technology and other news.

Free Webinar

Low Rate DDoS Attack

9 of 10 sites on the AppTrana network have faced a DDoS attack in the last 30 days.
Some DDoS attacks could readily be blocked by rate-limiting, IP reputation checks and other basic mitigation methods.
More than 50% of the DDoS attacks are employing botnets to send slow DDoS attacks where millions of IPs are being employed to send one or two requests per minute..
Key takeaways include:

  • The mechanics of a low-DDoS attack
  • Fundamentals of behavioural AI and rate-limiting
  • Surgical mitigation actions to minimize false positives
  • Role of managed services in DDoS monitoring

Related Articles