heroui logo

Python Spawning Pretty TTY Via PTY Module

Sigma Rules

View Source
Summary
This detection rule monitors for potentially malicious activity involving Python processes leveraging the PTY (pseudo-terminal) module to create an interactive terminal session, which is a common technique used by attackers to establish reverse shells. The rule specifically looks for instances where a Python process calls the PTY module through its import statements, and then invokes the 'spawn' command in the command line arguments. Such behavior may indicate that an attacker is attempting to execute a command in a hidden terminal that can allow for unauthorized access and control of the system. The detection focuses on the process creation events in a Linux environment, where only specific Python executable paths along with targeted command line inputs (like 'import pty' and 'spawn') will trigger alerts. It has a medium severity level, which indicates a significant risk, although it may also capture potential false positives due to legitimate use of the PTY module in various scripts.
Categories
  • Linux
  • Endpoint
Data Sources
  • Process
  • Command
Created: 2022-06-03