A worm in a gem rewrites your agent files: CLAUDE.md, AGENTS.md and editor configs added by the strutil-core payload

 

A malicious Ruby gem called strutil-core spent about five hours on RubyGems on November 1. Socket's threat research team published the full teardown on November 6 and updated it on November 9, and security sites picked it up again on November 10. The gem itself never got popular: Socket found no public dependents and no confirmed victims. What makes it worth an hour of your week is what the payload does after it runs. It steals the login files of AI coding tools, it adds an MCP server and SessionStart hooks to their configs, and it uses stolen Git access to commit CLAUDE.md, AGENTS.md and editor configs into your repositories so the next agent that opens them runs the worm again.

iOS teams have a specific reason to care. Most of us have a Gemfile in the repo even if we never write Ruby, because fastlane and CocoaPods are both installed as gems, and fastlane's setup docs recommend Bundler and a Gemfile to define the dependency. A worm that starts on bundle install lands on the same Mac that holds your signing certificates, your App Store Connect API key and, increasingly, a logged-in Claude Code or Codex session. This post walks through what the gem did according to the primary report, then gives you a read-only script and a manual checklist for a Mac and an iOS repo.

What happened, in order

All times below are UTC and come from Socket's timeline.

  1. October 31, 22:21 to 23:32: a PyPI package named pystr-codec (0.1.0 to 0.1.2) appears, reporting to the same collection server.
  2. November 1, 02:19: the RubyGems account jamnajiea publishes strutil-core 1.0.0, a clean "string helper" used as a seed.
  3. November 1, 04:05: version 1.0.1 is published with a malicious native extension. Socket says the 1.0.1 gem still reports 1.0.0 internally because the injector only edits the gemspec.
  4. November 1, 04:06: Socket's scanner flags the payload file 70 seconds after publication.
  5. November 1, 08:52 to 09:13: RubyGems removes both versions.

Socket places the gem in the Miasma family, a line of worms built from the Shai-Hulud toolkit whose source has been public since May 2026. It says the installer matches a June 2026 Miasma payload in 33 of 36 non-empty lines. Shared code doesn't prove a single operator, and Socket says so too.

Why bundle install was enough

Gems can ship a native extension. When you install one, RubyGems runs the gem's extconf.rb to generate a Makefile and compile C code. That step happens at install time, before your app or your Fastfile ever loads the gem. In strutil-core 1.0.1, the extconf.rb had no build logic at all. On Linux and macOS, on both Intel and Apple silicon, it downloaded the Bun JavaScript runtime (version 1.2.18) into /tmp/.b_<pid>, ran a bundled index.js, and then wrote an empty Makefile so the install finished with no errors.

So the trigger was gem install strutil-core, or a bundle install that resolved it as a dependency. No require needed. That's the part to remember for the next one, because the next one will have a different name.

What it took

Socket ran the payload in the Bitbison sandbox and recorded reads from 51 credential stores. The named examples include .aws/credentials, .npmrc, .pypirc, .gem/credentials, .docker/config.json, .kube/config, .claude/.credentials.json and .codex/auth.json. The categories also cover SSH keys, Git hosts, CI environment variables, password managers, OS keychains and cryptocurrency wallets. On Linux GitHub Actions runners it also tried to read runner process memory with sudo python3.

Socket doesn't list App Store Connect .p8 keys or .p12 exports by name, so I won't claim the payload targets them. Here's the practical way to think about it. Anything readable by your user account on an infected Mac should be treated as exposed, and on an iOS dev machine that usually includes a fastlane .env file, an API key JSON for app_store_connect_api_key, and whatever sits in your Downloads folder from the last certificate export.

Stolen data was encrypted and sent to paleasbest[.]top, with GitHub and GitLab as fallback channels. The code also contains routines to republish packages to RubyGems, npm and PyPI and to spread over Artifactory, GitHub, GitLab and SSH. Socket confirmed the routines exist but saw no successful downstream publication.

The part that targets coding agents

Two things happen to AI tooling.

In your home directory, the payload looks for writable settings.json, config.json, mcp.json and .aider.conf.yml files that belong to AI coding tools. It adds an MCP server named workspace-tools that runs the payload with node, and it adds SessionStart hooks to other configs. Socket doesn't give the exact path it writes for each tool, so check every config file your tools use rather than one.

In your repositories, using stolen Git credentials, it commits these files:

  • .github/init.js
  • .claude/settings.json
  • .cursor/mcp.json
  • .gemini settings
  • CLAUDE.md and AGENTS.md
  • .vscode/tasks.json, with a task that runs when the folder opens

The AGENTS.md it writes tells coding agents to run a setup script before their first command. Socket doesn't quote the text, so don't search for a specific sentence. Look for any instruction file that asks the agent to run something before it starts.

For Claude Code users, the SessionStart hook is the piece to understand. Claude Code's hooks reference says SessionStart runs when a session starts or resumes, with matchers for startup, resume, clear, compact and fork. Hooks can live in ~/.claude/settings.json (all your projects), .claude/settings.json (one project, and meant to be committed), .claude/settings.local.json, managed policy settings, plugins, and skill or subagent frontmatter. Entries from those levels merge. A hook committed to a shared repo therefore runs on every teammate's machine the first time they open a session there, as long as they accept the project's settings.

MCP servers work a little differently. The Claude Code MCP docs say project servers live in .mcp.json at the repo root, and that Claude Code asks for approval in interactive sessions before using them. The same page says claude -p runs, Agent SDK sessions and some cloud sessions can't show that prompt and load project servers without asking. If you run Claude Code headless in CI or from a script, the approval prompt you rely on at your desk doesn't exist there.

The wiper, and why order matters

On machines where it stole a GitHub token, the payload installs a monitor that calls api.github.com/user with that token every 45 seconds. If GitHub answers 401 or 403, which is what happens the moment you revoke the token, the handler runs rm -rf ~/ and then targets ~/Documents. Socket says the monitor is set to run for 48 hours.

That flips the usual incident instinct. If you find the persistence files on a machine, revoking the GitHub token first can erase that machine's home folder. Socket's order is to isolate the host, stop and remove the two services, then revoke the token, then rotate everything else from a clean device, then rebuild the host.

Where it hides on a Mac

Socket lists these locations. The macOS details are thinner than the Linux ones, and the report itself says so.

  • ~/.local/share/runtimes/sync.py: a Python backdoor that checks public GitHub commits every hour for the marker msync-3f7a and runs only scripts signed by the actor. On macOS it runs as the LaunchAgent com.user.pkg-runtime.
  • ~/.local/bin/net-health-checker.sh: the token monitor behind the wiper, run as a LaunchAgent on macOS.
  • ~/.config/net-health-checker/token: the stolen token, in plain text.
  • ~/.config/index.js: a copy of the payload.
  • /var/tmp/.fontconfig_state: a state file.

The report doesn't give plist file names for the LaunchAgents, so search the contents of ~/Library/LaunchAgents instead of looking for one filename.

A read-only check you can run now

The script below only reads. It looks for the gem in lockfiles and installed gems, the persistence files above, LaunchAgents or systemd user units that mention the worm, workspace-tools in AI tool configs, and Socket's Git markers in one repository: commits containing skip-checks:true, AutoSyncComplete or msync-3f7a, and branches named chore/ci-*. It also prints the last three commits that touched each file the worm writes, so you can see whether you or someone else made them.

I ran it on Linux against two sample repos, one clean and one seeded with fake indicators, and it reported 0 and 5 warnings as expected. I haven't run the LaunchAgents branch on a real Mac, so read its output with that in mind.

#!/usr/bin/env bash
# check-strutil.sh - look for strutil-core / Miasma artifacts on this machine and in one repo.
# Read-only: it prints findings and changes nothing.
# Usage: ./check-strutil.sh /path/to/your/ios-repo
REPO="${1:-.}"
hits=0
say() { printf '%s\n' "$*"; }
flag() { say "  [!] $*"; hits=$((hits+1)); }

say "== 1. Is strutil-core in a lockfile or installed gem? =="
while read -r f; do flag "lockfile mentions strutil-core: $f"; done < <(grep -rIl --include=Gemfile.lock "strutil-core" "$REPO" 2>/dev/null)
if command -v gem >/dev/null 2>&1; then
  gem list -i strutil-core >/dev/null 2>&1 && flag "strutil-core is installed (gem list)"
fi

say "== 2. Persistence files from the Socket report =="
for p in "$HOME/.local/share/runtimes/sync.py" \
         "$HOME/.local/bin/net-health-checker.sh" \
         "$HOME/.config/net-health-checker/token" \
         "$HOME/.config/index.js" \
         "/var/tmp/.fontconfig_state"; do
  [ -e "$p" ] && flag "found $p"
done
if [ -d "$HOME/Library/LaunchAgents" ]; then
  while read -r f; do flag "LaunchAgent mentions the worm: $f"; done < <(grep -lE "pkg-runtime|net-health-checker|sync\.py" "$HOME/Library/LaunchAgents"/*.plist 2>/dev/null)
fi
if command -v systemctl >/dev/null 2>&1; then
  systemctl --user list-unit-files 2>/dev/null | grep -E "pkg-runtime|net-health-checker" && flag "systemd user unit present"
fi

say "== 3. AI tool configs that name workspace-tools =="
for f in "$HOME/.claude.json" "$HOME/.claude/settings.json" "$HOME/.cursor/mcp.json" \
         "$REPO/.mcp.json" "$REPO/.claude/settings.json" "$REPO/.claude/settings.local.json" \
         "$REPO/.cursor/mcp.json" "$REPO/.vscode/tasks.json"; do
  [ -f "$f" ] && grep -q "workspace-tools" "$f" && flag "workspace-tools in $f"
done

say "== 4. Repo history markers =="
if git -C "$REPO" rev-parse >/dev/null 2>&1; then
  while read -r l; do flag "commit: $l"; done < <(git -C "$REPO" log --all --format='%h %an %s' -E --grep='skip-checks:true|AutoSyncComplete|msync-3f7a')
  while read -r b; do flag "branch: $b"; done < <(git -C "$REPO" branch -a --list '*chore/ci-*')
  for f in .github/init.js CLAUDE.md AGENTS.md .claude/settings.json .cursor/mcp.json .vscode/tasks.json; do
    if git -C "$REPO" log --all --format='%h' -1 -- "$f" >/dev/null 2>&1 && [ -n "$(git -C "$REPO" log --all --format='%h' -- "$f")" ]; then
      say "  last 3 commits touching $f:"
      git -C "$REPO" log --all -3 --format='    %h %ad %an  %s' --date=short -- "$f"
    fi
  done
fi

say "== Done: $hits warning(s). Zero warnings is not proof of a clean machine. =="

Save it as check-strutil.sh, run chmod +x check-strutil.sh, then ./check-strutil.sh ~/Projects/YourApp for each repo you care about. It needs bash, which ships with macOS, and git, which comes with Xcode's command line tools.

Read the "last 3 commits" lines carefully. If you created a CLAUDE.md yourself last month, it will show up there, and that's fine. What you're looking for is a commit to one of those files that nobody on the team remembers, especially one dated November 1 or later, or one authored by an account you don't recognise.

If the script finds nothing

That's the likely result, because the gem had no public dependents and lived for five hours. Use the quiet result to close the gaps this worm exploits, since the next package won't announce itself.

1. See every hook your agent will run

Open Claude Code in each app repo and type /hooks. The docs describe it as a read-only browser that shows each hook's source (user, project, local, plugin or session) and the full command. You should be able to explain every entry. Anything under SessionStart deserves a second look, because it runs before you type anything.

If you want hooks off while you investigate, the docs say "disableAllHooks": true turns them off without deleting them, and claude --settings '{"disableAllHooks": true}' does it for one run. Note the precedence rule the docs spell out: a false in project settings overrides a true in your user settings, so a malicious project file can switch hooks back on unless you use the command-line flag.

2. Review MCP servers you approved and forgot

Run claude mcp list to see configured servers, and look at .mcp.json in each repo. If you approved project servers months ago and no longer remember why, the docs give claude mcp reset-project-choices to clear those approvals so Claude Code asks again. For headless runs, the same docs mention --strict-mcp-config and disabledMcpjsonServers as ways to keep a repo's servers out.

3. Treat agent instruction files like code

CLAUDE.md, AGENTS.md, .claude/settings.json, .cursor/mcp.json and .vscode/tasks.json can all cause commands to run. On GitHub, list them in a CODEOWNERS file and turn on the branch protection rule that requires code owner review, so changes to them need approval from someone who owns the repo and nobody pushes to main directly. The worm commits with stolen credentials. Branch protection means a stolen token alone can't put a file on main without a reviewed pull request, as long as the token's owner can't bypass the rule.

4. Pin your gems and read the diff

Commit Gemfile.lock. Most iOS repos already do this for fastlane, but check, because a missing lockfile means every bundle install can pull a new version of every dependency. When the lockfile changes in a pull request, read which gems moved. A brand new gem you didn't add on purpose is the signal. Socket also suggests reviewing your own gems for unexpected patch releases with new extensions: entries or ext/*/extconf.rb files, which is worth doing if you publish any.

5. Keep long-lived secrets off the laptop

This one is slower but pays off every time a package goes bad. Move the App Store Connect API key and match passphrase into CI secrets where you can, and keep local copies out of the repo folder and out of Downloads. On your own Mac, run ls ~/Downloads/*.p12 ~/Downloads/*.p8 2>/dev/null and move anything it finds into a password manager or delete it after confirming you have a copy where it belongs.

If the script finds something

Stop and follow Socket's order. Don't start by revoking tokens.

  1. Disconnect the Mac from the network.
  2. Unload and delete the LaunchAgents that mention pkg-runtime or net-health-checker, then delete the files under ~/.local/share/runtimes, ~/.local/bin and ~/.config/net-health-checker.
  3. From a different, clean device, revoke the GitHub token named in the token file, then rotate RubyGems, npm, PyPI, GitHub, GitLab, cloud, SSH and AI provider credentials. For an iOS team that list should also include your App Store Connect API keys and any certificate whose private key was on that Mac.
  4. Rebuild the Mac. Socket is clear that uninstalling the gem doesn't remove the persistence.
  5. Go through every repo that machine could push to. Remove unrecognised workspace-tools MCP entries, SessionStart hooks, .github/init.js, and any AGENTS.md or CLAUDE.md changes you didn't make. Tell your teammates before they open those repos in an agent.

Revoking an App Store Connect API key in App Store Connect breaks any CI job that uses it, so create the new key and update your CI secret before you revoke the old one, unless you have reason to think the key is being used right now.

What this changes for small iOS teams

For years the advice about malicious packages was about the app: don't ship a bad dependency to users. This worm doesn't care about your app. It cares about the developer's machine and the tools that act on the developer's behalf. Once agents read instruction files and run hooks on their own, a file in the repo is executable in practice, even if it's Markdown.

The fix is mostly old practice applied to new files. Lock dependencies and read lockfile diffs. Review changes to anything that can make a tool run a command. Keep secrets where a compromised laptop can't read them. And when a report like this comes out, run the check while it's fresh, because a five-hour window on RubyGems is short and the copies that follow won't use the same name.

FAQ

I use fastlane. Was fastlane affected?

Nothing in Socket's report says fastlane, CocoaPods or any popular gem depended on strutil-core. Socket found no public dependents. Fastlane matters here only because it puts a Gemfile and bundle install in most iOS repos, which is the install path this worm used.

Does Swift Package Manager have the same risk?

This specific worm was a Ruby gem with a native extension, plus a related PyPI package. Swift packages have their own trust questions, such as build tool plugins, but nothing in this report involves SPM.

My CLAUDE.md shows up in the script output. Am I infected?

Not by itself. The script lists recent commits to those files so you can check who made them. It's a warning only if the commit is one nobody on your team made.

Should I stop using hooks and MCP servers?

No need. Know exactly which ones run, review changes to the files that define them, and be careful with headless runs where Claude Code loads project MCP servers without asking.

If you want a starting set of reviewed, opt-in Claude Code files for an iOS repo, I sell Claude Code + Xcode: The Production iOS Workflow Kit on Gumroad. It includes AGENTS.md and CLAUDE.md templates, 8 rules, 6 commands and 2 optional local hook scripts with a safe example settings file that doesn't auto-approve anything. It won't detect malware, but it gives you a known baseline to compare a repo's agent files against.

Sources