Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-58624

CVE-2026-58624: Apache MINA SSHD RCE Vulnerability

CVE-2026-58624 is a remote code execution flaw in Apache MINA SSHD that allows authenticated users to write files at arbitrary locations. This article covers technical details, affected versions, and patches.

Published:

CVE-2026-58624 Overview

CVE-2026-58624 is an improper input validation vulnerability [CWE-20] in the sshd-git component of Apache MINA SSHD, a Java library implementing client-side and server-side Secure Shell (SSH). The flaw exists in the GitPgmCommandFactory, which lets SSH clients remotely execute git commands via the JGit library against server-hosted repositories. The factory failed to restrict which JGit commands an authenticated user could invoke, permitting commands such as git archive --output that write files to arbitrary filesystem locations. Only servers that explicitly configure GitPgmCommandFactory are affected. Fixed versions are Apache MINA SSHD 2.19.0 and 3.0.0-M5.

Critical Impact

An authenticated SSH user can write arbitrary files on the server through unrestricted JGit command execution, enabling integrity and availability compromise on affected deployments.

Affected Products

  • Apache MINA SSHD versions prior to 2.19.0
  • Apache MINA SSHD 3.0.0 milestones prior to 3.0.0-M5
  • Any SSH server implementation using the org.apache.sshd:sshd-git component with GitPgmCommandFactory configured

Discovery Timeline

  • 2026-07-20 - CVE-2026-58624 published to NVD
  • 2026-07-21 - Last updated in NVD database

Technical Details for CVE-2026-58624

Vulnerability Analysis

Apache MINA SSHD ships an optional sshd-git module that exposes git operations to SSH clients. The GitPgmCommandFactory class parses the command string sent by an authenticated client over the SSH channel and dispatches it to JGit for execution. The factory did not enforce an allowlist of safe commands or sanitize command arguments before invocation.

Because JGit exposes a broad range of porcelain commands through its command-line interface layer, an authenticated user could invoke commands well beyond simple repository interaction. The git archive command, in particular, accepts an --output argument that specifies a destination file path. When JGit executes this command server-side, it writes the archive to the attacker-controlled path with the privileges of the SSH server process.

The vulnerability requires valid SSH credentials, limiting exploitation to authenticated users. The impact is restricted to integrity and availability rather than confidentiality, since the attacker writes files rather than reads server data directly.

Root Cause

The root cause is missing input validation on the command dispatched to JGit. GitPgmCommandFactory trusted the client-supplied command string and passed the full argument list to JGit without filtering. No allowlist restricted which subcommands were permitted, and no sanitizer stripped filesystem-writing flags such as --output.

Attack Vector

An attacker authenticates to the target Apache MINA SSHD server using valid credentials. The attacker then requests execution of a JGit command through the SSH channel, for example git archive --output=/path/to/target/file HEAD. The server invokes JGit, which writes the resulting archive to the attacker-specified location, potentially overwriting configuration files, web content, cron entries, or binaries writable by the SSH server process. See the Apache Mailing List Thread and the OpenWall OSS Security Post for the vendor advisory.

Detection Methods for CVE-2026-58624

Indicators of Compromise

  • Unexpected files appearing outside configured git repository directories, particularly .tar, .zip, or archive-format files owned by the SSH server user
  • SSH session logs showing git archive invocations with --output arguments pointing to non-repository paths
  • Modification of system files, web roots, or startup scripts by the account running the Apache MINA SSHD process

Detection Strategies

  • Enable command auditing on the Apache MINA SSHD server and alert on git subcommands other than the intended allowlist (for example, anything beyond git log, git archive, git status)
  • Monitor JGit invocations for arguments containing --output, absolute paths, or path traversal sequences such as ..
  • Correlate SSH authentication events with filesystem write events outside declared repository directories using host-based telemetry

Monitoring Recommendations

  • Forward Apache MINA SSHD application logs and host filesystem audit events to a centralized logging platform for retrospective analysis
  • Track the version of the deployed sshd-git component and alert when versions prior to 2.19.0 or 3.0.0-M5 are observed in production inventories
  • Baseline the set of files written by the SSH server process and alert on deviations

How to Mitigate CVE-2026-58624

Immediate Actions Required

  • Upgrade Apache MINA SSHD to version 2.19.0 or 3.0.0-M5 on all servers using the sshd-git component
  • If upgrade is not immediately possible, disable or remove GitPgmCommandFactory from the SSH server configuration
  • Audit filesystem contents in directories writable by the SSH server user for unauthorized files created since deployment of the vulnerable component

Patch Information

Apache MINA SSHD 2.19.0 and 3.0.0-M5 resolve CVE-2026-58624 by restricting GitPgmCommandFactory to a small allowlist of non-destructive commands such as git log. The git archive command remains available, but its --output argument is ignored and the archive is always streamed back through the SSH channel to the client rather than written to the server filesystem.

Workarounds

  • Replace GitPgmCommandFactory with a custom CommandFactory implementation that enforces a strict command allowlist and rejects arguments such as --output
  • Run the Apache MINA SSHD process under a dedicated, unprivileged account with filesystem write access limited to the intended repository directories
  • Restrict SSH access to the affected server to trusted users only, and rotate any credentials suspected of misuse

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.