VeriKQL by Kaushik Saha

T1546.018 Python Startup Hooks

PersistencePrivilege Escalationon attack.mitre.org

ATT&CK Enterprise 20.0 · 20.1 released, update in review

How MITRE detects it

DET0258 Linux Python Startup Hook Persistence via .pth and Customize Files (T1546.018)

AN0713 Linux

Defender observes unauthorized modification or creation of Python hook files such as `.pth`, `sitecustomize.py`, or `usercustomize.py` in Python `site-packages`, `dist-packages`, or user paths. This is often correlated with subsequent unexpected interpreter execution (e.g., python3 running without user interaction), changes in interpreter behavior (e.g., malicious imports), and outbound connections initiated from Python. Defender links write/modify actions on hook files with execve of python process and/or anomalous child process or network activity.

MITRE log sourceIn Microsoft Sentinel
auditd:SYSCALLexecve: execve where exe=/usr/bin/python3 or similar interpreterNot mapped to Sentinel yet.
auditd:PATHwrite or create events on *.pth, sitecustomize.py, usercustomize.py in site-packages or dist-packagesNot mapped to Sentinel yet.
auditd:CONFIG_CHANGEchmod or chown of hook files indicating privilege escalation or execution permission changeNot mapped to Sentinel yet.
NSM:Flowhttp::request: Outbound HTTP initiated by Python interpreterNot mapped to Sentinel yet.

Content Hub rules tagged with it (0)

No Content Hub rule is tagged with this technique.

Rules tagged with this technique (or a sub-technique) in their metadata. Whether one fits your connectors is the coverage view (M2).

In Sigma rules

No SigmaHQ rule names it in their tags outright.

Community rules, not Microsoft's, and not checked by VeriKQL (Sigma is not KQL). From SigmaHQ/sigma at f083329, under the Detection Rule License (DRL) 1.1; each rule is credited to its author.

Mitigations

MITRE ATT&CK® is a registered trademark of The MITRE Corporation. VeriKQL is not affiliated with or endorsed by MITRE. ATT&CK data © The MITRE Corporation, used under its terms of use.