heroui logo

Suspicious Child Process of Homebrew's Bundled Ruby Interpreter

Elastic Detection Rules

View Source
Summary
This detection rule flags a suspicious child process spawned by Homebrew’s bundled Ruby interpreter (path ending in /Homebrew/vendor/portable-ruby/.../bin/ruby) during macOSbrew activities (brew install, reinstall, or upgrade) when a cask’s preflight or postflight block executes Ruby code or shell commands. A malicious third-party tap or a compromised/typosquatted cask could leverage these inline Ruby blocks to execute code with the installing user’s privileges. The rule concentrates on the plausible commands such a hook would invoke, including network and scripting tools, osascript prompts, or shell-outs, as well as persistence or credential access attempts. It looks for a child process whose parent is the portable Ruby binary and whose command context matches a wide set of behaviors: network clients (curl, wget, nc), scripting interpreters (bash/sh/zsh/dash, python*, perl, node, sqlite3), osascript usage (do shell script, display dialog, hidden answer), launchctl for persistence (load/bootstrap/submit/enable), security or dscl credential operations (find-generic-password, find-internet-password, dump-keychain, export, dscl -authonly), and shell- or base64-driven commands executed from temporary or shared directories (e.g., /tmp, /Users/Shared). The rule also considers unsigned or non-signed binaries, excluding the legitimate Homebrew portable-ruby path to reduce false positives. Mapping-wise, it targets MITRE ATT&CK Initial Access (Supply Chain Compromise / Compromise Software Supply Chain) and Execution (Command and Scripting Interpreter). Investigative guidance emphasizes identifying the installed cask and tap, inspecting the child process’s full command line for external network activity or shell-out behavior, verifying tap history, correlating with subsequent persistence or credential access, and preserving artifacts for analysis. False positives can arise from legitimate vendor helpers or Homebrew internals; in such cases scope exclusions to the specific cask executable path are recommended. Remediation guidance includes containment, capturing the process tree and relevant metadata, avoiding uninstall/reinstall during investigation, and credential rotation if credentials were accessed.
Categories
  • Endpoint
  • macOS
Data Sources
  • Process
ATT&CK Techniques
  • T1195
  • T1195.002
  • T1059
Created: 2026-08-07