Malicious code in bitcion (RubyGems)
Description
RubyGems runs this gem's native extension script ext/bitcion/extconf.rb during gem install. The script exits without action on CI runners and sandboxes, based on CI environment variables, the hostname, the username and the working directory. It continues if the system uptime is over 30 minutes and the home directory holds .ssh, .gitconfig, .npmrc, .gem/credentials or .bundle. It then decodes a Base64 Ruby payload and forks twice into a detached process. After 20 to 40 minutes the payload downloads http://45.138.12.177:8092/wgkit.tar.gz to /tmp/.w1.tgz with curl, extracts it to /tmp/.w1/, runs wg_install.sh with bash and deletes both. The payload stores the URL XOR-encoded with the key usv\x9a. The Ruby code in lib/ is a decoy. The RubyGems account reqthrottle_3474 published this gem and 41 others with the same loader on 2026-10-05.
--- -= Per source details. Do not edit below this line.=-
Source: amazon-inspector (2227467459663a7608a52405af03fbfbf6f9a25a02dcac5490c29480a846b61d)
The gem advertises itself as a BIP-39 mnemonic word list but ships a non-functional native extension (ext/bitcion/bitcion.c is a 46-byte empty Init_Bitcion stub) whose only purpose is to make RubyGems invoke ext/bitcion/extconf.rb at gem install time. extconf.rb base64-decodes a Ruby payload and eval()s it inside a detached forked child. The payload reconstructs the URL 45.138.128.177/
Source: ossf-package-analysis (ef0f9a0614561d3fa298e8a94e27e744b75464bd1ef2c800b3a9a02b427d1111)
The OpenSSF Package Analysis project identified 'bitcion' @ 1.0.0 (rubygems) as malicious.
It is considered malicious because:
- The package executes one or more commands associated with malicious behavior.