Detectionhightest

Python Reverse Shell Execution Via PTY And Socket Modules

Detects the execution of python with calls to the socket and pty module in order to connect and spawn a potential reverse shell.

Convert In Phoenix Studio

Open this Sigma rule in the converter with the YAML preloaded and ready for backend selection.

Launch
@d4ns4n_, Nasreddine Bencherchali (Nextron Systems)Created Mon Apr 24Updated Mon Nov 0432e62bc7-3de0-4bb1-90af-532978fe42c0linux
Log Source
LinuxProcess Creation
ProductLinux← raw: linux
CategoryProcess Creation← raw: process_creation

Events generated when a new process is spawned on the system. Covers command-line arguments, parent/child relationships, and process metadata.

Detection Logic
Detection Logic1 selector
detection:
    selection:
        Image|contains: 'python'
        CommandLine|contains|all:
            - ' -c '
            - 'import'
            - 'pty'
            - 'socket'
            - 'spawn'
            - '.connect'
    condition: selection
False Positives
Unknown

False positive likelihood has not been assessed. Additional context may be needed during triage.

MITRE ATT&CK
Rule Metadata
Rule ID
32e62bc7-3de0-4bb1-90af-532978fe42c0
Status
test
Level
high
Type
Detection
Created
Mon Apr 24
Modified
Mon Nov 04
Path
rules/linux/process_creation/proc_creation_lnx_python_reverse_shell.yml
Raw Tags
attack.execution
View on GitHub