← Back to SOC feed Coverage →

Potential Ruby Reverse Shell

sigma MEDIUM SigmaHQ
imProcessCreate
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at SigmaHQ →
Retrieved: 2026-03-25T02:50:08Z · Confidence: medium

Hunt Hypothesis

The hypothesis is that the detection of ruby execution with the backslash character may indicate an adversary attempting to establish a reverse shell to exfiltrate data or execute commands remotely. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential command and control activity early and prevent further compromise.

Detection Rule

Sigma (Original)

title: Potential Ruby Reverse Shell
id: b8bdac18-c06e-4016-ac30-221553e74f59
status: test
description: Detects execution of ruby with the "-e" flag and calls to "socket" related functions. This could be an indication of a potential attempt to setup a reverse shell
references:
    - https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
    - https://www.revshells.com/
author: '@d4ns4n_'
date: 2023-04-07
tags:
    - attack.execution
logsource:
    category: process_creation
    product: linux
detection:
    selection:
        Image|contains: 'ruby'
        CommandLine|contains|all:
            - ' -e'
            - 'rsocket'
            - 'TCPSocket'
        CommandLine|contains:
            - ' ash'
            - ' bash'
            - ' bsh'
            - ' csh'
            - ' ksh'
            - ' pdksh'
            - ' sh'
            - ' tcsh'
    condition: selection
falsepositives:
    - Unknown
level: medium

KQL (Azure Sentinel)

imProcessCreate
| where TargetProcessName contains "ruby" and (TargetProcessCommandLine contains " -e" and TargetProcessCommandLine contains "rsocket" and TargetProcessCommandLine contains "TCPSocket") and (TargetProcessCommandLine contains " ash" or TargetProcessCommandLine contains " bash" or TargetProcessCommandLine contains " bsh" or TargetProcessCommandLine contains " csh" or TargetProcessCommandLine contains " ksh" or TargetProcessCommandLine contains " pdksh" or TargetProcessCommandLine contains " sh" or TargetProcessCommandLine contains " tcsh")

False Positive Guidance

MITRE ATT&CK Context

Original source: https://github.com/SigmaHQ/sigma/blob/master/rules/linux/process_creation/proc_creation_lnx_ruby_reverse_shell.yml