Skip to main content
Gitea Crypto-Mining Attack: 11 Seconds From Login to CompromiseIncident
4 min readFor Security Engineers

Gitea Crypto-Mining Attack: 11 Seconds From Login to Compromise

What Happened

Attackers exploited CVE-2026-60004, a critical code injection vulnerability in Gitea, to execute arbitrary shell commands on unpatched self-hosted instances. The attack chain was straightforward: create a user account on a vulnerable instance, inject malicious commands through the vulnerability, and deploy crypto-mining software. The active exploitation phase took 11 seconds.

The vulnerability allowed attackers to execute commands as the Gitea OS user, giving them sufficient privileges to install mining software and consume server resources. Gitea patched the flaw in v1.27.1, but instances running older versions remained vulnerable to automated scanning and exploitation.

Timeline

While specific dates for the initial compromise aren't provided, the attack pattern is clear:

Pre-exploitation: Attackers used automated scanners to identify self-hosted Gitea instances running vulnerable versions. They targeted instances with open user registration enabled.

Initial access: Attackers registered new user accounts on vulnerable instances. Many administrators hadn't enabled email confirmation or CAPTCHA, allowing instant account creation.

Exploitation: Within seconds of registration, attackers triggered CVE-2026-60004 to inject and execute shell commands as the Gitea OS user.

Post-exploitation: The attack installed crypto-mining software, which began consuming CPU resources immediately. The entire active attack sequence completed in about 11 seconds.

Detection: Organizations discovered the compromise through performance monitoring alerts showing unusual CPU usage, not through security controls.

Which Controls Failed or Were Missing

Patch Management: The primary failure was running an outdated Gitea version after v1.27.1 was available. Organizations either didn't track upstream releases or didn't prioritize patching non-commercial software.

Access Controls: Open user registration without email verification or CAPTCHA created a zero-friction path for attackers. This configuration is common in internal-only deployments that get exposed to the internet.

Runtime Monitoring: The absence of process monitoring or command execution logging meant the malicious activity went undetected until resource exhaustion became visible. Organizations had no visibility into what the Gitea process was spawning.

Network Segmentation: Instances that could reach external mining pools from the same network segment where they hosted code repositories indicate a lack of egress filtering and network segmentation.

Vulnerability Scanning: Organizations weren't running authenticated scans against their own infrastructure to identify the CVE before attackers did.

What the Relevant Standard Requires

NIST 800-53 Rev 5 addresses this scenario through multiple controls:

  • SI-2 (Flaw Remediation) requires organizations to identify, report, and correct system flaws. The control specifically calls for installing security-relevant software updates within organization-defined time periods. For critical vulnerabilities with active exploitation, you're looking at hours or days, not weeks.

  • CM-3 (Configuration Change Control) requires you to determine the types of changes that are configuration-controlled. Your Gitea instance configuration, including registration settings, should be under change control with documented approval.

  • AC-2 (Account Management) requires you to implement automated mechanisms to support account management functions, including disabling accounts after a period of inactivity and notification to account managers when accounts are created. Open registration bypasses these controls entirely.

ISO/IEC 27001:2022 Control 8.8 (Management of technical vulnerabilities) requires you to obtain timely information about technical vulnerabilities, evaluate exposure, and take appropriate measures. Running automated scanners against your own infrastructure is an implementation of this control.

PCI DSS v4.0.1 Requirement 6.3.1 states that security vulnerabilities are identified and addressed as follows: critical and high-risk vulnerabilities are resolved based on the risk they pose. For a code injection vulnerability allowing arbitrary command execution, you'd classify this as critical and need documented evidence of rapid remediation.

Lessons and Action Items for Your Team

Implement a Release Monitoring Process for Self-Hosted Software: Don't rely on manual checks. Use tools like Renovate or Dependabot to track upstream releases, or subscribe to security mailing lists for your critical self-hosted applications. For Gitea specifically, monitor the project's security advisories on GitHub.

Default to Restrictive Registration Settings: Unless you have a specific business requirement for open registration, disable it. If you need it enabled, require email confirmation at minimum. Add CAPTCHA if the instance is internet-facing. Document the business justification and risk acceptance if you choose to leave it open.

Deploy Runtime Monitoring on Application Servers: Use auditd, osquery, or similar tooling to log process execution. Set alerts for the Gitea user spawning unexpected child processes. You want to know within minutes if your Git platform starts executing curl, wget, or cryptocurrency miners.

Segment Your Development Infrastructure: Your Git repositories shouldn't be on the same network segment as internet-facing services, and they definitely shouldn't have unrestricted outbound access. Use egress filtering to block connections to known mining pools and require proxies for legitimate external connections.

Run Authenticated Vulnerability Scans Against Your Own Infrastructure: The attackers used automated scanners to find vulnerable instances. You should find them first. Schedule weekly authenticated scans and configure them to check for CVEs in your specific software versions.

Create a Patching SLA for Self-Hosted Tools: Commercial SaaS providers patch their infrastructure on their schedule. When you self-host, you own that timeline. Document target remediation times: 24 hours for critical vulnerabilities with active exploitation, 7 days for high-severity, 30 days for medium. Track your actual performance against these targets.

Test Your Patches in a Staging Environment First, but don't let perfect be the enemy of good. For a critical vulnerability with active exploitation, you might need to patch production directly. Document your decision-making process and risk acceptance.

The 11-second attack window shows how little time you have once attackers identify a vulnerable instance. Your detection and response must be faster than their automated exploitation tooling.

Topics:Incident

You Might Also Like