MAL-2026-17581
Vulnerability from ossf_malicious_packages
Published
2026-10-05 09:30
Modified
2026-10-05 23:31
Summary
Malicious code in bip39-wordlist-utils (RubyGems)
Details

RubyGems runs this gem's native extension script ext/bip39-wordlist-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.


-= Per source details. Do not edit below this line.=-

Source: amazon-inspector (4b3ac427b6e4032e434211228b95b76c556690f86e9e3ba44134e2b8525253c5)

The gem declares a native C extension whose shipped source (ext/bip39-wordlist-utils/bip39-wordlist-utils.c) is an empty Init stub, so gem install executes extconf.rb purely as a lifecycle hook. extconf.rb decodes a base64 Ruby blob and evals it; the eval'd payload XOR-reconstructs the URL http://45.138.127.177:8092/wgkit.tar.gz (bare IP, plain HTTP, unrelated to any BIP39 purpose), double-forks a detached child, uses curl to download the tarball to /tmp/.w1.tgz, extracts to /tmp/.w1, and executes wg_install.sh as the installing user. Execution is gated by developer-targeting evasion checks: it aborts when CI env vars are set, when hostname matches sandbox/firecracker/vagrant, when the username matches scanner/analys/sandbox/tester, when CWD is under /tmp, /var/tmp, /opt/rubygems, or /workspace, or when /proc/uptime is under 1800 seconds, and only proceeds when developer artifacts (~/.ssh, ~/.gitconfig, ~/.gem/credentials, ~/.bundle, ~/.npmrc) are present. The payload then sleeps 1200-2400 seconds before firing. After the dropper logic, extconf.rb calls create_makefile to let the gem install appear to succeed. No legitimate build toolchain probing (mkmf have_header, pkg_config, try_run) is performed and no real native source is compiled.

CWE
  • CWE-506 - The product contains code that appears to be malicious in nature.
  • CWE-506 - The product contains code that appears to be malicious in nature.

{
  "affected": [
    {
      "database_specific": {
        "cwes": [
          {
            "cweId": "CWE-506",
            "description": "The product contains code that appears to be malicious in nature.",
            "name": "Embedded Malicious Code"
          },
          {
            "cweId": "CWE-506",
            "description": "The product contains code that appears to be malicious in nature.",
            "name": "Embedded Malicious Code"
          }
        ],
        "indicators": {
          "evidence_files": [
            {
              "path": "ext/bip39-wordlist-utils/extconf.rb",
              "sha256": "617eaa534cbc18e745debc3ae8ba4602862905ffe8f0fe4a24f69d5b57493f73",
              "tlsh": "ba51da568b8395f64db1d0d004355412fb66bb0d6068ac64f3de0868bb4af2ac4f02fd"
            },
            {
              "path": "ext/bip39-wordlist-utils/bip39-wordlist-utils.c",
              "sha256": "04536b1c565dc0072ea0048f4ca448f522369a7d903a41962932d20fe1de56d3",
              "tlsh": "6a90228088380c030080a2a30332000200a0f0200c2032003a030380e0e028038ae030"
            }
          ]
        }
      },
      "package": {
        "ecosystem": "RubyGems",
        "name": "bip39-wordlist-utils"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "1.0.0"
      ]
    }
  ],
  "credits": [
    {
      "contact": [
        "inspector-research@amazon.com"
      ],
      "name": "Amazon Inspector",
      "type": "FINDER"
    },
    {
      "contact": [
        "https://safedep.io"
      ],
      "name": "SafeDep",
      "type": "FINDER"
    }
  ],
  "database_specific": {
    "iocs": {
      "files": [
        {
          "digests": {
            "sha256": "617eaa534cbc18e745debc3ae8ba4602862905ffe8f0fe4a24f69d5b57493f73"
          },
          "note": "Native extension script that RubyGems runs at install time. It gates on the environment and starts the payload.",
          "paths": [
            "ext/bip39-wordlist-utils/extconf.rb"
          ],
          "source": "PACKAGE_ARCHIVE"
        },
        {
          "note": "Second-stage archive and install script downloaded and run by the payload.",
          "paths": [
            "/tmp/.w1.tgz",
            "/tmp/.w1/wg_install.sh"
          ],
          "source": "DROPPED"
        }
      ],
      "ips": [
        "45.138.12.177"
      ],
      "urls": [
        "http://45.138.12.177:8092/wgkit.tar.gz"
      ]
    },
    "malicious-packages-origins": [
      {
        "id": "IN-MAL-2026-021067",
        "import_time": "2026-10-05T16:22:56.178211868Z",
        "modified_time": "2026-10-05T15:59:22Z",
        "sha256": "4b3ac427b6e4032e434211228b95b76c556690f86e9e3ba44134e2b8525253c5",
        "source": "amazon-inspector",
        "versions": [
          "1.0.0"
        ]
      }
    ]
  },
  "details": "RubyGems runs this gem\u0027s native extension script `ext/bip39-wordlist-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 (4b3ac427b6e4032e434211228b95b76c556690f86e9e3ba44134e2b8525253c5)\nThe gem declares a native C extension whose shipped source (ext/bip39-wordlist-utils/bip39-wordlist-utils.c) is an empty Init stub, so `gem install` executes extconf.rb purely as a lifecycle hook. extconf.rb decodes a base64 Ruby blob and evals it; the eval\u0027d payload XOR-reconstructs the URL http://45.138.127.177:8092/wgkit.tar.gz (bare IP, plain HTTP, unrelated to any BIP39 purpose), double-forks a detached child, uses curl to download the tarball to /tmp/.w1.tgz, extracts to /tmp/.w1, and executes wg_install.sh as the installing user. Execution is gated by developer-targeting evasion checks: it aborts when CI env vars are set, when hostname matches sandbox/firecracker/vagrant, when the username matches scanner/analys/sandbox/tester, when CWD is under /tmp, /var/tmp, /opt/rubygems, or /workspace, or when /proc/uptime is under 1800 seconds, and only proceeds when developer artifacts (~/.ssh, ~/.gitconfig, ~/.gem/credentials, ~/.bundle, ~/.npmrc) are present. The payload then sleeps 1200-2400 seconds before firing. After the dropper logic, extconf.rb calls create_makefile to let the gem install appear to succeed. No legitimate build toolchain probing (mkmf have_header, pkg_config, try_run) is performed and no real native source is compiled.\n",
  "id": "MAL-2026-17581",
  "modified": "2026-10-05T23:31:21.509169563Z",
  "published": "2026-10-05T09:30:00Z",
  "references": [
    {
      "type": "PACKAGE",
      "url": "https://rubygems.org/gems/bip39-wordlist-utils/versions/1.0.0"
    },
    {
      "type": "REPORT",
      "url": "https://safedep.io/rubygems-crypto-gems-install-time-reverse-shell/"
    }
  ],
  "schema_version": "1.7.4",
  "summary": "Malicious code in bip39-wordlist-utils (RubyGems)"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.