Sigma rule: Python Spawning Pretty TTY Via PTY Module

A detection rule from the SigmaHQ repository, shown as its author published it. Dataset version ref-9af493dc9b14, updated 2024-11-04T00:00:00.000Z.

Rule

Title
Python Spawning Pretty TTY Via PTY Module
Status
test
Level
medium
Author
Nextron Systems
Date
2022-06-03
Modified
2024-11-04
File
rules/linux/process_creation/proc_creation_lnx_python_pty_spawn.yml
Commit
ccbb0369507f796db0b0ae6854c8a2be471b9d84

Detects a python process calling to the PTY module in order to spawn a pretty tty which could be indicative of potential reverse shell activity.

Log source

product
linux
category
process_creation

Detection

selection_img:
    - Image|endswith:
          - '/python'
          - '/python2'
          - '/python3'
    - Image|contains:
          - '/python2.'  # python image is always of the form ../python3.10; ../python is just a symlink
          - '/python3.'
selection_cli_import:
    CommandLine|contains:
        - 'import pty'
        - 'from pty '
selection_cli_spawn:
    CommandLine|contains: 'spawn'
condition: all of selection_*

False positives (as the rule lists them)

  • Unknown

Tags

  • attack.execution
  • attack.t1059

MITRE ATT&CK ids this rule names

Related rules

References

Read on 2026-11-03T00:58:21.399Z under licence sigma-drl-1.1@d5f4c36a from https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/linux/process_creation/proc_creation_lnx_python_pty_spawn.yml

Sources and licences

  • SigmaHQ

    "Python Spawning Pretty TTY Via PTY Module" by Nextron Systems (SigmaHQ). Rule: https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/linux/process_creation/proc_creation_lnx_python_pty_spawn.yml.
    Licensed under the Detection Rule License (DRL) 1.1: https://github.com/SigmaHQ/Detection-Rule-License

    Detection Rule License (DRL) 1.1

Cite this page

Dragons Eye Ransomware Tracker, "Sigma rule: Python Spawning Pretty TTY Via PTY Module",
entity page, dataset version ref-9af493dc9b14, updated 2024-11-04T00:00:00.000Z,
https://ransomware-tracker.com/detections/sigma/c4042d54-110d-45dd-a0e1-05c47822c937 (accessed 2026-11-03).
Underlying source: SigmaHQ rule c4042d54-110d-45dd-a0e1-05c47822c937, commit ccbb0369507f796db0b0ae6854c8a2be471b9d84.

Pages change. The dataset version identifies the data, but no archive of old versions is kept, so this citation cannot be replayed later.