---
id: "TECH-202611-e3mx3j"
page: "https://infrastack.ai/live/TECH-202611-e3mx3j"
kind: "technique"
aliases: []
title: "RubyGems runs a gem's code on install even without an install script, and gem plugins run again on every gem command (even gem list); stable RubyGems has no way to turn this off (Aikido)"
severity: "medium"
cvss: null
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "RubyGems", "fixed": [], "affected": "4.0.x (no opt-out); 4.1.0.beta3 opt-out off by default", "ecosystem": "rubygems"}, {"name": "Bundler", "fixed": [], "affected": "4.0.x", "ecosystem": "rubygems"}]
ecosystems: []
tags: ["early-warning", "technique"]
not_affected_if: []
published_at: null
first_seen_at: "2026-11-09T12:28:43+00:00"
updated_at: "2026-11-09T12:30:02+00:00"
sources: [{"source": "analyst", "url": null, "first_seen_at": "2026-11-09T12:28:43+00:00"}]
exploit_sources: []
---

# RubyGems runs a gem's code on install even without an install script, and gem plugins run again on every gem command (even gem list); stable RubyGems has no way to turn this off (Aikido)

Link for people: https://infrastack.ai/live/TECH-202611-e3mx3j (this .md is for agents)

Aikido Security research (published 5 Nov 2026, updated 9 Nov): a Ruby gem can run code on your machine through native extension build files declared in its gemspec (extconf.rb, mkrf_conf.rb, Rakefile), which RubyGems runs during gem install / bundle install, and through lib/rubygems_plugin.rb, which loads at the end of the install and again on every later gem command, including gem list, gem search and gem -v. Stable RubyGems and Bundler 4.0.x offer no way to disable either; RubyGems/Bundler 4.1.0.beta3 adds opt-out settings that are off by default. Reported to RubyGems security on 27 Oct 2026. The extension path was used by the malicious strutil-core 1.0.1 gem (tracked separately); four old research-style gems that phone home on install (xmastree, ancient-city-ruby, hacky, et_phone_home) were still installable on 4 Nov. Any developer machine or CI job that installs gems is exposed. No CVE.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- rubygems:RubyGems affected 4.0.x (no opt-out); 4.1.0.beta3 opt-out off by default fixed no fixed version listed
- rubygems:Bundler affected 4.0.x fixed no fixed version listed

## How to check

Grep Gemfile.lock for xmastree (0.0.1, 0.0.2), ancient-city-ruby (2013.1), hacky (0.0.2), et_phone_home (0.1.0). Network/DNS hits to cryptic-ocean-8847.herokuapp.com, stark-samurai-8122.herokuapp.com, appfolio.herokuapp.com/upload, 176.31.142.25. List installed gems without using gem commands: ruby -e 'Gem.path.each { |p| puts Dir.glob("#{p}/gems/*") }'. List plugin dirs: ruby -e 'Gem.path.each { |p| puts Gem.plugindir(p) }' and look for unexpected rubygems_plugin.rb files. Review extconf.rb/mkrf_conf.rb/Rakefile in new or unfamiliar gems.

## Fix

Remove any of the four gems (gem uninstall NAME --all --executables, drop from Gemfile) and remove unneeded plugins from the plugin dirs. To stop install-time code: gem update --system 4.1.0.beta3, then gem install --no-build-extension --no-install-plugin, bundle config set --global no_build_extension true and no_install_plugin true; in CI set BUNDLE_NO_BUILD_EXTENSION=true and BUNDLE_NO_INSTALL_PLUGIN=true (only skip extension builds in jobs that don't load the app). Restore needed extensions afterwards with gem pristine <gem> --extensions. Inspect new gems with gem fetch + gem unpack in a clean environment. Note: this only blocks install-time code; a malicious gem still runs when the app loads it.

## Timeline

- 2026-11-09T12:28:43+00:00 analyst

## Documents

- [describes] @AikidoSecurity: Our researcher Hunter found that a gem can run code on your machine without an i https://x.com/AikidoSecurity/status/2119762205277118492
- [describes] @AikidoSecurity: Aikido Device Protection checks gem install and bundle install on Ruby 3 and lat https://x.com/AikidoSecurity/status/2119762207638536680
- [describes] Even gem list can run someone else's code (Aikido) https://www.aikido.dev/blog/gem-list-runs-someone-elses-code

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
