Potential Mythic Medusa Python Payload


Description

Identifies the creation of a Python script that starts with the Mythic Medusa obfuscation stub. When the Medusa builder is asked to obfuscate the agent it emits a two line loader, "import base64, itertools" followed by an exec() of the XOR encrypted and base64 encoded agent body, which gives the file a much higher entropy than regular Python source. Package managers, source control and IDEs writing legitimate Python sources are excluded.

Query · eql

file where event.action in ("creation", "overwrite") and

 /* Medusa default obfuscation stub */
 file.Ext.header_bytes : "696d706f7274206261736536342c2069" and file.Ext.entropy >= 5.2
Raw source Potential Mythic Medusa Python Payload · Elastic TOML
Esc
Published by elastic/protections-artifacts ↗, licensed under Elastic License 2.0 ↗. Reproduced here unmodified.
[rule]
description = """
Identifies the creation of a Python script that starts with the Mythic Medusa obfuscation stub. When the Medusa builder
is asked to obfuscate the agent it emits a two line loader, "import base64, itertools" followed by an exec() of the XOR
encrypted and base64 encoded agent body, which gives the file a much higher entropy than regular Python source. Package
managers, source control and IDEs writing legitimate Python sources are excluded.
"""
id = "96414692-301d-4de0-92e1-448eaa5b3010"
license = "Elastic License v2"
name = "Potential Mythic Medusa Python Payload"
os_list = ["windows"]
reference = [
    "https://github.com/MythicAgents/Medusa",
    "https://github.com/MythicAgents/Medusa/blob/main/Payload_Type/medusa/medusa/mythic/agent_functions/builder.py",
]
version = "1.0.1"

query = '''
file where event.action in ("creation", "overwrite") and

 /* Medusa default obfuscation stub */
 file.Ext.header_bytes : "696d706f7274206261736536342c2069" and file.Ext.entropy >= 5.2
'''

min_endpoint_version = "8.10.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[optional_actions]]
action = "rollback"
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/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"
[[threat.technique.subtechnique]]
id = "T1027.013"
name = "Encrypted/Encoded File"
reference = "https://attack.mitre.org/techniques/T1027/013/"



[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "8.10.0"

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.