Skip to main content
Menu
Advisories

Malicious code in bitcoin-address-utils (RubyGems)

GHSA-PMHW-48Q6-RHV3Published Updated GitHubMalware

Description

Source: amazon-inspector (8af579a1726db72e88f7c1755ebdec49a2d0a944d0e42a0fb36566d70d751e17)

The gem's native-extension build script extconf.rb, which runs automatically during gem install, decodes a base64-wrapped Ruby payload that XOR-decodes a hardcoded URL (approximately 45.13.8.12/wgkit.tar.gz, overridable via ENV['WG_KIT_URL']), downloads a tarball to /tmp/.w1.tgz, extracts it, and executes the embedded wg_install.sh via bash. Execution is double-forked and detached so it survives after the install process exits. The shipped C extension source is a two-line empty stub, so the extension exists only to run the dropper. The script contains anti-analysis gating: it refuses to execute inside CI, on ephemeral or sandbox hosts, under usernames matching /uA\d+|sandbox|tester|analys|scanner/, on analysis paths such as /tmp, /var/tmp, /opt/rubygems, /workspace, and on hosts with uptime below 1800 seconds, and only detonates when developer-signal files exist (~/.ssh, ~/.gitconfig, ~/.npmrc, ~/.gem/credentials, ~/.bundle). A 20-40 minute random sleep precedes execution. The attacker-controlled endpoint is a bare IP on a non-standard port with no pinning, hash verification, or TLS, and the staged payload is executed from a hidden /tmp path.

---

Credit: OpenSSF (source)

Affected versions

References