SITF technique T-R012: Package Lifecycle Script Abuse
Component: RegistryStage: Discovery and Lateral MovementID: T-R012
Attacker leverages package manager lifecycle hooks (postinstall, preinstall) or language-specific initialization mechanisms (.pth files) to execute malicious code during package installation.
SITF technique T-R012 (Package Lifecycle Script Abuse) is a Discovery and Lateral Movement technique in the SDLC Infrastructure Threat Framework (SITF). It targets the Registry component (Container and artifact registries (NPM, Docker, PyPI)).
Risks that enable this technique
- Lifecycle scripts enabled by default in package managers
- No review or approval of install-time scripts
- Scripts execute with user privileges automatically
- Python .pth files execute on any interpreter startup
- No network restrictions during package installation
- Self-cleaning payloads evade post-install detection
Protective controls
- Disable lifecycle scripts during installation — Use --ignore-scripts flag for npm/yarn installations
OWASP SPVS: V2.6 3rd Party Library Audit; V3.1 Security of Pipeline Environment - Network isolation during package installation — Block outbound network access during install phase to prevent payload download
OWASP SPVS: V3.1 Security of Pipeline Environment; V4.4 Transition Security - Lockfile integrity verification — Use npm ci instead of npm install to enforce lockfile integrity
OWASP SPVS: V2.6 3rd Party Library Audit; V3.4 Integrity of Artifacts - Package version pinning with hash verification — Pin exact versions with integrity hashes to prevent substitution
OWASP SPVS: V2.6 3rd Party Library Audit; V3.4 Integrity of Artifacts - Python .pth file restrictions — Audit and restrict .pth file creation in site-packages directories
OWASP SPVS: V2.6 3rd Party Library Audit; V3.1 Security of Pipeline Environment
Detective controls
- Lifecycle script content analysis — SCA tools that flag packages with suspicious install scripts
OWASP SPVS: V2.6 3rd Party Library Audit; V5.4 Detection & Monitoring - Network monitoring during package installation — Detect unexpected outbound connections during npm/pip install
OWASP SPVS: V5.4 Detection & Monitoring - Process monitoring during installation — EDR/runtime agent monitoring for child processes spawned by package managers
OWASP SPVS: V5.4 Detection & Monitoring - File integrity monitoring for .pth files — Alert on .pth file creation or modification in Python environments
OWASP SPVS: V5.4 Detection & Monitoring
Observed in
- LiteLLM (October 2026) (incident)
- Miasma (Red Hat) (incident)
Explore
- Open T-R012 in the interactive technique library
- Map an attack using T-R012 in the SITF flow builder
- Previous Registry technique: T-R011 Namespace/Dependency Confusion
- Next Registry technique: T-R013 Version String Impersonation
How to reference
Cite as SITF technique T-R012 (Package Lifecycle Script Abuse), SDLC Infrastructure Threat Framework (SITF), https://wiz-sec-public.github.io/SITF/techniques/T-R012.html.