CVE-2026-5917: libgit2 v0.27.0-v1.9.0 Shell Command Injection via ssh_libssh2 Backend

Published Aug 11, 2026
·
Updated

libgit2 versions v0.27.0 through v1.9.0 built with the libssh2 SSH backend (USESSH=libssh2) contain a shell command injection vulnerability that allows remote attackers to execute arbitrary commands on an SSH server by supplying a repository path containing unescaped shell metacharacters such as single quotes, semicolons, or pipes. The genproto() function in sshlibssh2.c inserts the repository path directly into a shell command string without escaping special characters before passing it to libssh2channelexec(), enabling an attacker to craft a malicious submodule URL in a .gitmodules file that, when processed during a recursive clone, causes the remote server's shell to interpret injected commands under the victim's SSH user account.

Affected Software

1 affected component
libgit2 libgit2>=0.27.0<=1.9.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade libgit2 to a version that resolves this vulnerability.

    Fixed in v0.27.0-v1.9.0Patch Shell Command Injection via ssh_libssh2 Backend
  2. Configuration

    Do not use the libssh2 SSH backend (USE_SSH=libssh2), since libgit2 versions v0.27.0 through v1.9.0 built with USE_SSH=libssh2 contain a shell command injection vulnerability. Use a non-libssh2 SSH backend instead.

    libgit2 (USE_SSH=libssh2) USE_SSH = libssh2 disabled / non-libssh2
  3. Compensating control

    If recursive clone processing of attacker-controlled .gitmodules files is possible, prevent untrusted repository path values (that could include shell metacharacters like single quotes, semicolons, or pipes) from being used in libgit2 operations performed with the libssh2 backend.

Event History

Aug 11, 2026
CVE Published
via MITRE·09:40 PM
Data Sourced
via MITRE·09:40 PM
DescriptionSeverityWeakness
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-5917?

CVE-2026-5917 has a critical severity rating of 9.6.

2

How do I fix CVE-2026-5917?

To mitigate CVE-2026-5917, upgrade libgit2 to version 1.9.1 or later.

3

What causes the CVE-2026-5917 vulnerability?

CVE-2026-5917 is caused by a shell command injection vulnerability in libgit2 when using the libssh2 backend.

4

Who is affected by CVE-2026-5917?

All users of libgit2 versions v0.27.0 through v1.9.0 built with the libssh2 SSH backend are affected by CVE-2026-5917.

5

Can CVE-2026-5917 lead to remote code execution?

Yes, CVE-2026-5917 allows remote attackers to execute arbitrary commands on an SSH server.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203