{"id":"MAL-2026-17588","summary":"Malicious code in blockchain-sync-utils (RubyGems)","details":"RubyGems runs this gem's native extension script `ext/blockchain-sync-utils/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.\n\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (78a8b7d5a56c33e17464f8129001559f02bd245cd299cb8cb07ccc334eb5af65)\nThe gem's native-extension build script (ext/.../extconf.rb) is a dropper rather than a real build step. The accompanying C source is a no-op stub, so the extension exists only to run install-time code. The script decodes a base64-wrapped Ruby payload and eval()s it inside a detached double-fork (Process.setsid), after gating on anti-analysis checks (CI environment variables, hostname regex, /proc/uptime greater than 1800 seconds, jittered sleep) and on the presence of developer-credential artifacts on the host (~/.ssh, ~/.gitconfig, ~/.npmrc, ~/.gem/credentials, ~/.bundle) so the payload only fires on real developer workstations. The payload's destination URL is stored as a hex blob XORed with a 4-byte key and resolves to http://45.138.122.177:8092/wgkit.tar.gz; the decoded command curls that tarball to /tmp/.w1.tgz, extracts it to /tmp/.w1, and executes bash /tmp/.w1/wg_install.sh. Installing the gem runs attacker-controlled shell code on the installer's machine from a bare-IP endpoint over plain HTTP, with no pinning or integrity check and with explicit sandbox evasion.\n","modified":"2026-10-05T23:45:05.999442922Z","published":"2026-10-05T09:30:00Z","database_specific":{"iocs":{"ips":["45.138.12.177"],"urls":["http://45.138.12.177:8092/wgkit.tar.gz"],"files":[{"digests":{"sha256":"4c4f9bbbc7fb381c1185255fef4698474ba78f8758aed6618e59933678f9cad0"},"note":"Native extension script that RubyGems runs at install time. It gates on the environment and starts the payload.","paths":["ext/blockchain-sync-utils/extconf.rb"],"source":"PACKAGE_ARCHIVE"},{"source":"DROPPED","note":"Second-stage archive and install script downloaded and run by the payload.","paths":["/tmp/.w1.tgz","/tmp/.w1/wg_install.sh"]}]},"malicious-packages-origins":[{"source":"amazon-inspector","versions":["1.0.0"],"id":"IN-MAL-2026-021068","import_time":"2026-10-05T16:22:56.279235652Z","modified_time":"2026-10-05T15:59:31Z","sha256":"78a8b7d5a56c33e17464f8129001559f02bd245cd299cb8cb07ccc334eb5af65"}]},"references":[{"type":"PACKAGE","url":"https://rubygems.org/gems/blockchain-sync-utils/versions/1.0.0"},{"type":"REPORT","url":"https://safedep.io/rubygems-crypto-gems-install-time-reverse-shell/"}],"affected":[{"package":{"name":"blockchain-sync-utils","ecosystem":"RubyGems","purl":"pkg:gem/blockchain-sync-utils"},"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."},{"cweId":"CWE-506","description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code"}],"indicators":{"evidence_files":[{"path":"ext/blockchain-sync-utils/extconf.rb","sha256":"4c4f9bbbc7fb381c1185255fef4698474ba78f8758aed6618e59933678f9cad0","tlsh":"ac51da568b8395f54db1d0d004395412fb66bb0d6068ac64f3de0868bb4af2ac4f02fd"}]},"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/rubygems/blockchain-sync-utils/MAL-2026-17588.json"}}],"schema_version":"1.9.0","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"},{"name":"SafeDep","contact":["https://safedep.io"],"type":"FINDER"}]}