module
Python Site-Specific Hook Persistence
| Disclosed | Created |
|---|---|
| Sep 29, 2012 | Jan 7, 2026 |
Disclosed
Sep 29, 2012
Created
Jan 7, 2026
Description
This module leverages Python's startup mechanism, where some files can be automically processed during the initialization of the Python interpreter. One of those files are startup hooks (site-specific, dist-packages). If these files are present in site-specific or dist-packages directories, any lines beginning with import will be executed automatically. This creates a persistence mechanism, if an attacker has established access to target machine with sufficient permissions.
Author
msutovsky-r7
Platform
Linux,OSX,Windows
Architectures
cmd
References
Module Options
To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':
Rapid7 Labs
2026 Global Threat Landscape Report
The predictive window has collapsed. Exploitation follows disclosure in days. See how attackers are accelerating and how to stay ahead.