Detection rules › Elastic
Unsigned or Untrusted PyInstaller Binary Execution
Detects unsigned or untrusted PyInstaller binaries creating _MEI zip files in temporary directories. Threat actors use PyInstaller to package malware with Python interpreters for execution on systems without Python.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution |
Telemetry coverage
| Platform | Record / event type |
|---|---|
| macOS | ESF event write (NOTIFY): Fires after a process writes data to a file. |
Rule body
[rule]
description = """
Detects unsigned or untrusted PyInstaller binaries creating _MEI zip files in temporary directories. Threat actors use
PyInstaller to package malware with Python interpreters for execution on systems without Python.
"""
id = "27243b25-8465-4fa5-8c9a-470deeb4d503"
license = "Elastic License v2"
name = "Unsigned or Untrusted PyInstaller Binary Execution"
os_list = ["macos"]
reference = ["https://www.jamf.com/blog/pyinstaller-malware-jamf-threat-labs/"]
version = "1.0.4"
query = '''
file where event.action == "modification" and file.extension == "zip" and
file.path like ("/private/tmp/_MEI*", "/tmp/_MEI*") and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
not process.executable like "/opt/homebrew/*"
'''
min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "Effective_process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.006"
name = "Python"
reference = "https://attack.mitre.org/techniques/T1059/006/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[internal]
min_endpoint_version = "8.16.0"
Stages and Predicates
Stage 1: file
file where event.action == "modification" and file.extension == "zip" and
file.path like ("/private/tmp/_MEI*", "/tmp/_MEI*") and
(process.code_signature.trusted == false or process.code_signature.exists == false) and
not process.executable like "/opt/homebrew/*"
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | starts_with | /opt/homebrew/ | excludes:process.executable field:"process.executable" value:"/opt/homebrew/" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"modification" |
file.extension | eq |
| field:"file.extension" kind:eq value:"zip" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
process.code_signature.exists | eq |
| field:"process.code_signature.exists" kind:eq value:"false" |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"false" |