Cloudanix VulnDB

CVE-2022-25648

Critical · 9.8

CVSS

9.8

EPSS

4.9%

Published

Apr 19, 2022

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A flaw in a popular Ruby library for working with git lets attackers run their own commands on the computer if the software receives specially crafted input.

Exploit Available
Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
Trivial
Impact
Remote Code Execution
Component
Library
Class
Command Injection
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Unsanitized remote parameter in fetch() allows arbitrary git flags to be passed to the underlying git fetch subcommand, enabling command injection.

Why it matters to the business

Attackers can execute arbitrary commands on servers running affected ruby-git versions, resulting in full system compromise, data exfiltration, or lateral movement. The vulnerability has been public for over four years with public exploits available, though no widespread ransomware or named APT campaigns are recorded.

How an attack unfolds

An attacker supplies a malicious remote value containing git flags such as --upload-pack to the fetch method; the library passes the value directly to the git binary, causing the injected command to execute with the privileges of the calling process.

How to fix it

Upgrade ruby-git to the commit 546bc038ff6604f8304fdeca738c2a7c20cbacc8 (version 1.11.0 or later). If immediate upgrade is not possible, sanitize all remote and option parameters before passing them to fetch or switch to a different git library.

How to confirm the fix worked

Verify the installed ruby-git gem version is 1.11.0 or newer; re-run unit tests covering fetch with remote parameters; attempt a safe PoC injection in a non-production environment and confirm the command is rejected.

Typical attack path

  1. Locate an application that invokes ruby-git fetch(remote, opts) with attacker-controlled input
  2. Craft a remote string containing git argument injection payloads (e.g., --upload-pack='sh -c ...')
  3. Trigger the fetch call via network request, API, or scheduled job
  4. Execute arbitrary OS commands and establish persistence or exfiltrate data

How to detect it

Search application and system logs for ruby processes invoking git fetch with unexpected flags or shell metacharacters in the remote argument; inspect for child processes such as sh or curl spawned immediately after git operations.

  • fetch.*--upload-pack
  • git fetch.*[;&|`$]
  • ruby.*git.*fetch.*origin

What your security team should do

  • Upgrade all instances of ruby-git to the fixed commit immediately
  • Audit code for direct use of fetch with untrusted remote values
  • Add runtime monitoring for unexpected child processes spawned by ruby processes
  • Review dependency manifests for transitive ruby-git usage across the ecosystem

The record

The package git before 1.11.0 are vulnerable to Command Injection via git argument injection. When calling the fetch(remote = 'origin', opts = {}) function, the remote parameter is passed to the git fetch subcommand in a way that additional flags can be set. The additional flags can be used to perform a command injection.

Affected packages

Ecosystem Package Introduced Fixed
RubyGems git 0 1.11.0
Bitnami git 0 1.11.0
Debian:10 ruby-git 0 1.2.8-1+deb10u1
Debian:11 ruby-git 0 No fix
Debian:12 ruby-git 0 1.13.1-1
Debian:13 ruby-git 0 1.13.1-1
Debian:14 ruby-git 0 1.13.1-1
Mageia:8 ruby-git 0 1.6.0-1.1.mga8
Red Hat:satellite:6.12::el8 candlepin 0 0:4.1.15-1.el8sat
Red Hat:satellite:6.12::el8 candlepin-selinux 0 0:4.1.15-1.el8sat
Red Hat:satellite:6.12::el8 foreman 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-cli 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-debug 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-dynflow-sidekiq 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-ec2 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-gce 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-journald 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-libvirt 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-openstack 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-ovirt 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-postgresql 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-service 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-telemetry 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 foreman-vmware 0 0:3.3.0.17-1.el8sat
Red Hat:satellite:6.12::el8 python-django 0 0:3.2.14-2.el8pc
Red Hat:satellite:6.12::el8 python39-django 0 0:3.2.14-2.el8pc
Red Hat:satellite:6.12::el8 rubygem-git 0 0:1.11.0-1.el8sat
Red Hat:satellite:6.12::el8 rubygem-nokogiri 0 0:1.13.8-1.el8sat
Red Hat:satellite:6.12::el8 rubygem-nokogiri-debuginfo 0 0:1.13.8-1.el8sat
Red Hat:satellite:6.12::el8 rubygem-nokogiri-debugsource 0 0:1.13.8-1.el8sat
Red Hat:satellite:6.12::el8 rubygem-rails-html-sanitizer 0 0:1.4.3-2.el8sat
Red Hat:satellite:6.12::el8 rubygem-sinatra 0 1:2.2.0-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-cli 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-debug 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-dynflow-sidekiq 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-ec2 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-gce 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-journald 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-libvirt 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-openstack 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-ovirt 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-postgresql 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-service 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-telemetry 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 foreman-vmware 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_capsule:6.12::el8 python-django 0 0:3.2.14-2.el8pc
Red Hat:satellite_capsule:6.12::el8 python39-django 0 0:3.2.14-2.el8pc
Red Hat:satellite_capsule:6.12::el8 rubygem-nokogiri 0 0:1.13.8-1.el8sat
Red Hat:satellite_capsule:6.12::el8 rubygem-nokogiri-debuginfo 0 0:1.13.8-1.el8sat
Red Hat:satellite_capsule:6.12::el8 rubygem-nokogiri-debugsource 0 0:1.13.8-1.el8sat
Red Hat:satellite_capsule:6.12::el8 rubygem-sinatra 0 1:2.2.0-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-cli 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-debug 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-dynflow-sidekiq 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-ec2 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-gce 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-journald 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-libvirt 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-openstack 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-ovirt 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-postgresql 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-service 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-telemetry 0 0:3.3.0.17-1.el8sat
Red Hat:satellite_utils:6.12::el8 foreman-vmware 0 0:3.3.0.17-1.el8sat
Rocky Linux:8 libdb 0 0:5.3.28-42.el8_4
Ubuntu:16.04:LTS ruby-git 0 No fix
Ubuntu:18.04:LTS ruby-git 0 No fix
Ubuntu:20.04:LTS ruby-git 0 No fix
Ubuntu:22.04:LTS ruby-git 0 No fix
Ubuntu:24.04:LTS ruby-git 0 No fix
Ubuntu:24.10 ruby-git 0 No fix
Ubuntu:25.04 ruby-git 0 No fix
Ubuntu:25.10 ruby-git 0 No fix
Ubuntu:Pro:16.04:LTS ruby-git 0 No fix
Ubuntu:Pro:18.04:LTS ruby-git 0 No fix
Ubuntu:Pro:20.04:LTS ruby-git 0 No fix

Related vulnerabilities