title: Hunt - Python Startup Hook Creation
id: e229b088-94e8-4254-8bfb-fc1e03173def
status: experimental
description: Detects creation of Python customization or path startup hooks.
author: MagicSword OpenAttacks catalog
date: 2026-11-06
references:
  - https://github.com/elastic/detection-rules/blob/main/rules/linux/persistence_site_and_user_customize_file_creation.toml
  - https://github.com/splunk/security_content/blob/develop/detections/endpoint/python_site_hooks_creation_during_package_installation.yml
falsepositives:
  - Legitimate Python package installation and environment management
level: medium
logsource:
  category: file_event
detection:
  selection_named_hook:
    TargetFilename|endswith:
      - /sitecustomize.py
      - /usercustomize.py
  selection_pth:
    TargetFilename|contains:
      - /site-packages/
      - /dist-packages/
    TargetFilename|endswith: .pth
  condition: 1 of selection_*
