Sigma rule: Python Path Configuration File Creation - MacOS
A detection rule from the SigmaHQ repository, shown as its author published it. Dataset version ref-cb1dc66acd44, updated 2024-04-25T00:00:00.000Z.
Rule
- Title
- Python Path Configuration File Creation - MacOS
- Status
- test
- Level
- medium
- Author
- Andreas Braathen (mnemonic.io)
- Date
- 2024-04-25
- File
- rules-threat-hunting/macos/file/file_event/file_event_macos_python_path_configuration_files.yml
- Commit
- ccbb0369507f796db0b0ae6854c8a2be471b9d84
Detects creation of a Python path configuration file (.pth) in Python library folders, which can be maliciously abused for code execution and persistence.
Modules referenced by these files are run at every Python startup (v3.5+), regardless of whether the module is imported by the calling script.
Default paths are '\lib\site-packages\*.pth' (Windows) and '/lib/pythonX.Y/site-packages/*.pth' (Unix and macOS).
Log source
- product
- macos
- category
- file_event
Detection
selection:
TargetFilename|re: '(?i)/lib/python3\.([5-9]|[0-9]{2})/site-packages/' # Unix and macOS
TargetFilename|endswith: '.pth'
condition: selectionFalse positives (as the rule lists them)
- Although .pth files are discouraged due to potential security implications, these are legitimate files by specification.
Tags
- attack.execution
- attack.t1059.006
- detection.threat-hunting
MITRE ATT&CK ids this rule names
Related rules
References
- https://www.volexity.com/blog/2024/04/12/zero-day-exploitation-of-unauthenticated-remote-code-execution-vulnerability-in-globalprotect-cve-2024-3400/
- https://www.virustotal.com/gui/file/3de2a4392b8715bad070b2ae12243f166ead37830f7c6d24e778985927f9caac
- https://docs.python.org/3/library/site.html
Read on 2026-11-03T00:58:21.399Z under licence sigma-drl-1.1@d5f4c36a from https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules-threat-hunting/macos/file/file_event/file_event_macos_python_path_configuration_files.yml
Sources and licences
SigmaHQ
"Python Path Configuration File Creation - MacOS" by Andreas Braathen (mnemonic.io) (SigmaHQ). Rule: https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules-threat-hunting/macos/file/file_event/file_event_macos_python_path_configuration_files.yml.
Licensed under the Detection Rule License (DRL) 1.1: https://github.com/SigmaHQ/Detection-Rule-License
Cite this page
Dragons Eye Ransomware Tracker, "Sigma rule: Python Path Configuration File Creation - MacOS",
entity page, dataset version ref-cb1dc66acd44, updated 2024-04-25T00:00:00.000Z,
https://ransomware-tracker.com/detections/sigma/4f394635-13ef-4599-b677-3353e0f84f55 (accessed 2026-11-03).
Underlying source: SigmaHQ rule 4f394635-13ef-4599-b677-3353e0f84f55, 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.