{"id":"MAL-2026-17587","summary":"Malicious code in bitcoin-rpc-lite (RubyGems)","details":"RubyGems runs this gem's native extension script `ext/req_throttle_mini/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, forks twice into a detached process, waits 20 to 40 minutes and opens a reverse shell that connects `/bin/sh` to 45.138.12.177 on TCP port 8089. The shell reconnects every 30 seconds. 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.\n\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (4567a3469d6774fbe9be233375145274adf41f8e7a20521724a9a15606351044)\nThe gem declares ext/req_throttle_mini/extconf.rb as a native extension, but the ext/ directory ships no C/C++/Rust sources — the extension manifest exists solely to execute Ruby code during `gem install`. The script performs anti-analysis environment gating (skipping execution when CI env vars are set, hostnames match ephemeral/sandbox patterns such as uvm/firecracker/sandbox/vagrant, usernames look auto-generated, cwd is under /opt/rubygems or /tmp, system uptime is under 1800 seconds, or no developer artifacts like ~/.ssh or ~/.gem/credentials are present), then double-forks a detached background process that sleeps for a randomized 20-40 minutes before eval'ing a base64-decoded Ruby payload. The decoded payload opens a TCP socket to the hardcoded remote 45.138.12.177:8089, spawns /bin/sh via IO.popen, and bridges shell stdio over the socket in a reconnect loop, providing persistent remote shell access on the installer's host. The script closes with a trivial `require 'mkmf'; create_makefile('bitcoin_rpc_lite_native')` stub to make the extension build appear to succeed.\n\n## Source: ossf-package-analysis (19d7f07424a56c9dfe8fe3eb99a1ebd1d5d2a252b468cc86eae4e04c1adc7e7d)\nThe OpenSSF Package Analysis project identified 'bitcoin-rpc-lite' @ 1.0.0 (rubygems) as malicious.\n\nIt is considered malicious because:\n\n- The package executes one or more commands associated with malicious behavior.\n","modified":"2026-10-06T01:00:16.927396319Z","published":"2026-10-05T07:50:39Z","database_specific":{"malicious-packages-origins":[{"source":"amazon-inspector","versions":["1.0.0"],"id":"IN-MAL-2026-021038","import_time":"2026-10-05T16:22:54.007848437Z","modified_time":"2026-10-05T15:55:08Z","sha256":"4567a3469d6774fbe9be233375145274adf41f8e7a20521724a9a15606351044"},{"modified_time":"2026-10-05T07:50:39Z","sha256":"19d7f07424a56c9dfe8fe3eb99a1ebd1d5d2a252b468cc86eae4e04c1adc7e7d","source":"ossf-package-analysis","versions":["1.0.0"],"import_time":"2026-10-06T00:50:51.910745358Z"}],"iocs":{"files":[{"note":"Native extension script that RubyGems runs at install time. It gates on the environment and starts the payload.","paths":["ext/req_throttle_mini/extconf.rb"],"source":"PACKAGE_ARCHIVE","digests":{"sha256":"10218e975f54a4f11fe3954e1b584a5f05054003bf5773c3c2b8cceaa74ba763"}}],"ips":["45.138.12.177"]}},"references":[{"type":"PACKAGE","url":"https://rubygems.org/gems/bitcoin-rpc-lite/versions/1.0.0"},{"type":"REPORT","url":"https://safedep.io/rubygems-crypto-gems-install-time-reverse-shell/"}],"affected":[{"package":{"name":"bitcoin-rpc-lite","ecosystem":"RubyGems","purl":"pkg:gem/bitcoin-rpc-lite"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1.0.0"],"database_specific":{"cwes":[{"name":"Embedded Malicious Code","cweId":"CWE-506","description":"The product contains code that appears to be malicious in nature."},{"description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code","cweId":"CWE-506"}],"indicators":{"evidence_files":[{"path":"ext/req_throttle_mini/extconf.rb","sha256":"10218e975f54a4f11fe3954e1b584a5f05054003bf5773c3c2b8cceaa74ba763","tlsh":"9751775acf8359e55aa1c0c045798012faa3ab0a50646875f3ee0868ff59b26c0f12fe"}]},"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/rubygems/bitcoin-rpc-lite/MAL-2026-17587.json"}}],"schema_version":"1.9.0","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"},{"name":"OpenSSF: Package Analysis","contact":["https://github.com/ossf/package-analysis","https://openssf.slack.com/channels/package_analysis"],"type":"FINDER"},{"name":"SafeDep","contact":["https://safedep.io"],"type":"FINDER"}]}