{"id":"MAL-2026-17583","summary":"Malicious code in bitcion (RubyGems)","details":"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.\n\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (2227467459663a7608a52405af03fbfbf6f9a25a02dcac5490c29480a846b61d)\nThe 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 http://45.138.128.177:8092/wgkit.tar.gz by XOR-decoding a hex blob with the key 'usv\\x9a', downloads the tarball to /tmp/.w1.tgz over plain HTTP, extracts it, and executes /tmp/.w1/wg_install.sh via bash. Execution is gated on anti-analysis checks: negative signals skip the drop (CI environment variables; hostnames matching uvm/firecracker/sandbox/vagrant; usernames matching uA#/sandbox/tester/analys/scanner; cwd under /tmp or /opt/rubygems; machine uptime under 30 minutes) and positive developer signals are required (presence of ~/.ssh, ~/.gitconfig, ~/.npmrc, ~/.gem/credentials, ~/.bundle). A randomized 20-40 minute sleep is inserted before the fetch to further evade sandbox observation. The combination of hollow native stub, obfuscated bare-IP control-plane over plain HTTP, forked/detached execution, and developer-vs-sandbox targeting is intentional supply-chain malware delivering arbitrary attacker-controlled code onto the installer's host.\n\n## Source: ossf-package-analysis (ef0f9a0614561d3fa298e8a94e27e744b75464bd1ef2c800b3a9a02b427d1111)\nThe OpenSSF Package Analysis project identified 'bitcion' @ 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:23.208105242Z","published":"2026-10-05T08:00:27Z","database_specific":{"iocs":{"files":[{"paths":["ext/bitcion/extconf.rb"],"source":"PACKAGE_ARCHIVE","digests":{"sha256":"68c1a394b319756377eae535c741d259972bfaf94407bd63c10a0d63fb237dd7"},"note":"Native extension script that RubyGems runs at install time. It gates on the environment and starts the payload."},{"paths":["/tmp/.w1.tgz","/tmp/.w1/wg_install.sh"],"source":"DROPPED","note":"Second-stage archive and install script downloaded and run by the payload."}],"ips":["45.138.12.177"],"urls":["http://45.138.12.177:8092/wgkit.tar.gz"]},"malicious-packages-origins":[{"versions":["1.0.0"],"id":"IN-MAL-2026-021054","import_time":"2026-10-05T16:22:55.162115714Z","modified_time":"2026-10-05T15:57:27Z","sha256":"2227467459663a7608a52405af03fbfbf6f9a25a02dcac5490c29480a846b61d","source":"amazon-inspector"},{"modified_time":"2026-10-05T08:00:27Z","sha256":"ef0f9a0614561d3fa298e8a94e27e744b75464bd1ef2c800b3a9a02b427d1111","source":"ossf-package-analysis","versions":["1.0.0"],"import_time":"2026-10-06T00:50:49.826731623Z"}]},"references":[{"type":"PACKAGE","url":"https://rubygems.org/gems/bitcion/versions/1.0.0"},{"type":"REPORT","url":"https://safedep.io/rubygems-crypto-gems-install-time-reverse-shell/"}],"affected":[{"package":{"name":"bitcion","ecosystem":"RubyGems","purl":"pkg:gem/bitcion"},"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"}],"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/rubygems/bitcion/MAL-2026-17583.json","indicators":{"evidence_files":[{"tlsh":"8b51db568b8395f54db1d0d044355412fb667b0d6068ac64f3de086cbb5af2ac4f02fd","path":"ext/bitcion/extconf.rb","sha256":"68c1a394b319756377eae535c741d259972bfaf94407bd63c10a0d63fb237dd7"},{"sha256":"c7be99666aab919dad673371d9deed4ec623c221c32bdea207b2b7b4ba6e0a08","path":"ext/bitcion/bitcion.c"}]}}}],"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"}]}