Skip to content

Commit 98c0bfd

Browse files
rhiannon-iosimi
authored andcommitted
Create 2025-08-22-rubygems-security-response.md
1 parent c86d7a2 commit 98c0bfd

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
---
2+
title: How RubyGems.org Protects Our Community’s Critical OSS Infrastructure
3+
layout: post
4+
author: Marty Haught
5+
author_email: [email protected]
6+
---
7+
8+
Recently, Socket.dev published [research](https://socket.dev/blog/60-malicious-ruby-gems-used-in-targeted-credential-theft-campaign) highlighting malicious gems
9+
designed to steal social media credentials. We wanted to use this as an
10+
opportunity to share more about how RubyGems.org security operates, how
11+
we proactively handled this incident (and others), and the work our team
12+
is doing each day to keep the ecosystem safe.
13+
14+
# How We Detect Malicious Gems
15+
16+
**RubyGems.org security uses a proactive and multi-layered approach:**
17+
18+
1. **Automated detection:** Every gem upload is analyzed using both
19+
static and dynamic code analysis, including behavioral checks and
20+
metadata review. Much of this capability comes from Mend.io’s
21+
supply chain security tooling (originally built by our own Maciej
22+
Mensfeld, a maintainer on the RubyGems team).
23+
24+
2. **Risk scoring:** Each package is given a score. Higher-risk gems
25+
are escalated for manual review by a member of our security team.
26+
27+
3. **Retroactive scanning:** As detection techniques improve, older
28+
packages are automatically rescanned, which allows us to catch
29+
threats that may have slipped through in the past. (This is how we
30+
found the threat actor that Socket.dev later investigated.)
31+
32+
4. **External sources:** We sometimes receive alerts from vulnerability
33+
databases, industry partners, and cross-registry collaborations,
34+
which help us identify patterns across ecosystems.
35+
36+
Through steps 1 - 3, our team detects the majority (roughly 70-80%) of
37+
malicious packages before they are ever reported to us or the public.
38+
39+
# What Happens When We Flag a Gem
40+
41+
**Once a gem is flagged, we:**
42+
43+
1. **Verify:** A RubyGems security engineer reviews the code to confirm
44+
malicious intent (about 95% of flagged packages prove to be
45+
legitimate).
46+
47+
2. **Double-check:** When there’s any doubt, we seek a second opinion
48+
within the team.
49+
50+
3. **Remove:** Confirmed malicious gems are removed via a standardized
51+
process in our admin panel.
52+
53+
4. **Document:** Every action is logged with reasoning for
54+
traceability.
55+
56+
5. **Protect further:** In some cases, we preemptively block suspicious
57+
gem names (for example, ones mimicking company internals) to
58+
prevent possible abuse.
59+
60+
# This Incident
61+
62+
**This is the timeline of the actions our team took concerning the
63+
incident reported by Socket.dev:**
64+
65+
- **July 20, 2025 --** Our systems flagged suspicious gems, and the
66+
team confirmed malicious credential-stealing behavior. We would
67+
like to specifically credit RubyGems maintainer Maciej Mensfeld
68+
for this.
69+
70+
- **July 23--28 --** We removed nearly all of the affected packages
71+
and terminated the associated accounts. We would like to
72+
acknowledge again Maciej Mensfeld for his security work here, as
73+
well as Josef Šimánek, who provided a second opinion and helped
74+
with package removal.
75+
76+
- **August 7 --** Socket.dev published their report and notified us of
77+
16 additional gems from related accounts, which we also removed.
78+
79+
In total, we removed all malicious packages from this threat actor,
80+
including two not covered in the original report.
81+
82+
Socket.dev has also [published an updated accounting](https://socket.dev/blog/follow-up-on-malicious-ruby-gems-campaign) of this incident
83+
after talking directly with our team and clarifying key details about
84+
our response.
85+
86+
**It's also important to note:** this campaign involved a small number
87+
of gems. Widely used and trusted packages were not affected.
88+
89+
# Community Reporting & Collaboration
90+
91+
We welcome and encourage researchers and community members to work with
92+
us by reporting issues through these channels:
93+
94+
- **Email:** You can also reach us at
95+
96+
97+
- **Slack:** Join the [Bundler
98+
Slack](https://join.slack.com/t/bundler/shared_invite/zt-1rrsuuv3m-OmXKWQf8K6iSla4~F1DBjQ)
99+
to connect with the RubyGems.org team and community of committers
100+
and developers.
101+
102+
Once we receive reports, we acknowledge them, review them quickly, and
103+
follow up with the person who made the report. We are grateful for every
104+
contribution that helps keep RubyGems and the Ruby ecosystem secure.
105+
106+
# The Reality of Supply Chain Security
107+
108+
RubyGems.org is smaller than ecosystems like
109+
[npm](https://github.com/npm) but malicious activity is
110+
still a serious threat. On average, we remove about one malicious or
111+
spam package per week, though that number can spike higher.
112+
113+
This work is resource-intensive. Most of our efforts are currently
114+
supported by sponsors, including [Mend.io](http://mend.io)
115+
and [Alpha-Omega](https://alpha-omega.dev/), but a
116+
significant portion of time comes from contributions by volunteer
117+
maintainers. Many of these maintainers have personally dedicated over a
118+
decade to this critical work, driven by their passion and commitment to
119+
keeping the Ruby ecosystem secure.
120+
121+
**If your company depends on RubyGems.org, consider supporting its
122+
maintenance and security directly through our [RubyGems Supporter
123+
Program](https://rubycentral.org/news/rubygems-org-funding-model-a-new-path-for-community-led-growth/).**
124+
Community funding enables us to continue to invest in the people,
125+
infrastructure, and security work that keep RubyGems safe and keep
126+
RubyGems.org a community-led service.
127+
128+
# In Closing
129+
130+
**This recent incident shows our security systems working as intended:**
131+
threats were detected, removed, and contained before they could cause
132+
widespread harm.
133+
134+
Security in open source will always be a shared effort. We want to thank
135+
Socket.dev for their research, as well as the broader community for
136+
continuing to report issues.
137+
138+
You are welcome to reach out to us through the above channels if you
139+
have any additional questions.
140+
141+
*RubyGems Security Team*

0 commit comments

Comments
 (0)