
<https://sepses.org/resource/attack/attack-pattern--c5087385-9b7c-4488-9923-d9e370bf08df> <http://purl.org/dc/terms/contributor> "Pyae Heinn Kyaw, CSIRT @ Salesforce", "Ruben Groenewoud (@RFGroenewoud)" ;
	<http://purl.org/dc/terms/created> "2025-05-22T19:20:46.740+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
	<http://purl.org/dc/terms/description> """Adversaries may achieve persistence by leveraging Python’s startup mechanisms, including path configuration (`.pth`) files and the `sitecustomize.py` or `usercustomize.py` modules. These files are automatically processed during the initialization of the Python interpreter, allowing for the execution of arbitrary code whenever Python is invoked.(Citation: Volexity GlobalProtect CVE 2024)

Path configuration files are designed to extend Python’s module search paths through the use of import statements. If a `.pth` file is placed in Python's `site-packages` or `dist-packages` directories, any lines beginning with `import` will be executed automatically on Python invocation.(Citation: DFIR Python Persistence 2025) Similarly, if `sitecustomize.py` or `usercustomize.py` is present in the Python path, these files will be imported during interpreter startup, and any code they contain will be executed.(Citation: Python Site Configuration Hook)

Adversaries may abuse these mechanisms to establish persistence on systems where Python is widely used (e.g., for automation or scripting in production environments).  """ ;
	<http://purl.org/dc/terms/modified> "2025-10-21T02:35:20.850+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
	<http://purl.org/dc/terms/title> "Python Startup Hooks" ;
	<http://purl.org/dc/terms/version> "1.0" ;
	<https://sepses.org/vocab/ref/attack#hasDomain> "enterprise-attack" ;
	<https://sepses.org/vocab/ref/attack#isSubtechnique> true ;
	<https://sepses.org/vocab/ref/attack#platform> "Linux", "macOS", "Windows" ;
	a <https://sepses.org/vocab/ref/attack#Technique> .

