Sigma rule: Inline Python Execution - Spawn Shell Via OS System Library

A detection rule from the SigmaHQ repository, shown as its author published it. Dataset version ref-a5380cd5a1d6, updated 2024-09-02T00:00:00.000Z.

Rule

Title
Inline Python Execution - Spawn Shell Via OS System Library
Status
test
Level
high
Author
Li Ling, Andy Parkidomo, Robert Rakowski, Blake Hartstein (Bloomberg L.P.)
Date
2024-09-02
File
rules/linux/process_creation/proc_creation_lnx_python_shell_os_system.yml
Commit
ccbb0369507f796db0b0ae6854c8a2be471b9d84

Detects execution of inline Python code via the "-c" in order to call the "system" function from the "os" library, and spawn a shell.

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:
    CommandLine|contains|all:
        - ' -c '
        - 'os.system('
    CommandLine|contains:
        - '/bin/bash'
        - '/bin/dash'
        - '/bin/fish'
        - '/bin/sh'
        - '/bin/zsh'
condition: all of selection_*

False positives (as the rule lists them)

  • Unknown

Tags

  • attack.execution
  • attack.t1059

MITRE ATT&CK ids this rule names

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_shell_os_system.yml

Sources and licences

  • SigmaHQ

    "Inline Python Execution - Spawn Shell Via OS System Library" by Li Ling, Andy Parkidomo, Robert Rakowski, Blake Hartstein (Bloomberg L.P.) (SigmaHQ). Rule: https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/linux/process_creation/proc_creation_lnx_python_shell_os_system.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: Inline Python Execution - Spawn Shell Via OS System Library",
entity page, dataset version ref-a5380cd5a1d6, updated 2024-09-02T00:00:00.000Z,
https://ransomware-tracker.com/detections/sigma/2d2f44ff-4611-4778-a8fc-323a0e9850cc (accessed 2026-11-03).
Underlying source: SigmaHQ rule 2d2f44ff-4611-4778-a8fc-323a0e9850cc, 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.