{"id":"2d2f44ff-4611-4778-a8fc-323a0e9850cc","title":"Inline Python Execution - Spawn Shell Via OS System Library","description":"Detects execution of inline Python code via the \"-c\" in order to call the \"system\" function from the \"os\" library, and spawn a shell.\n","author":"Li Ling, Andy Parkidomo, Robert Rakowski, Blake Hartstein (Bloomberg L.P.)","status":"test","level":"high","date":"2024-09-02","modified":"","tags":["attack.execution","attack.t1059"],"technique_ids":["T1059"],"logsource":{"category":"process_creation","product":"linux"},"falsepositives":["Unknown"],"references":["https://gtfobins.github.io/gtfobins/python/#shell"],"source_path":"rules/linux/process_creation/proc_creation_lnx_python_shell_os_system.yml","source_sha256":"069a50387e5f7a29ae2bf38d0052ad5e1aa6b2c3269879d2c9ea59f98df3c271","source_url":"https://github.com/anpa1200/sigma/blob/b249e9683190cffdcaf188ccbfb90bf4759844e1/rules/linux/process_creation/proc_creation_lnx_python_shell_os_system.yml","license":"Detection Rule License 1.1","license_url":"https://github.com/SigmaHQ/Detection-Rule-License/blob/main/LICENSE.Detection.Rules.md","yaml":"title: Inline Python Execution - Spawn Shell Via OS System Library\nid: 2d2f44ff-4611-4778-a8fc-323a0e9850cc\nstatus: test\ndescription: |\n    Detects execution of inline Python code via the \"-c\" in order to call the \"system\" function from the \"os\" library, and spawn a shell.\nreferences:\n    - https://gtfobins.github.io/gtfobins/python/#shell\nauthor: Li Ling, Andy Parkidomo, Robert Rakowski, Blake Hartstein (Bloomberg L.P.)\ndate: 2024-09-02\ntags:\n    - attack.execution\n    - attack.t1059\nlogsource:\n    category: process_creation\n    product: linux\ndetection:\n    selection_img:\n        - Image|endswith:\n              - '/python'\n              - '/python2'\n              - '/python3'\n        - Image|contains:\n              - '/python2.'  # python image is always of the form ../python3.10; ../python is just a symlink\n              - '/python3.'\n    selection_cli:\n        CommandLine|contains|all:\n            - ' -c '\n            - 'os.system('\n        CommandLine|contains:\n            - '/bin/bash'\n            - '/bin/dash'\n            - '/bin/fish'\n            - '/bin/sh'\n            - '/bin/zsh'\n    condition: all of selection_*\nfalsepositives:\n    - Unknown\nlevel: high\n","validation":"yaml_parsed_not_backend_compiled_or_live_validated","techniques":[{"key":"enterprise/T1059","id":"T1059","name":"Command and Scripting Interpreter","page":"techniques/enterprise/T1059/"}],"data_path":"data/detection-rules/2d2f44ff-4611-4778-a8fc-323a0e9850cc.json","kind":"sigma"}
