AAK-STARTUP-HOOK-SITECUSTOMIZE-001
sitecustomize or usercustomize module where Python imports it at every start
| Field | Value |
|---|---|
| Severity | HIGH |
| Category | SUPPLY_CHAIN |
| Shipped | v0.6.28 |
| Scanner | agent_audit_kit/scanners/startup_hooks.py |
| OWASP MCP | MCP04:2025 (Software Supply Chain Attacks & Dependency Tampering) |
| OWASP Agentic | ASI04 (Agentic Supply Chain Vulnerabilities), ASI05 (Unexpected Code Execution) |
| Incident | litellm 1.107.0, 21 Oct 2026 (OSV MAL-2026-2144) |
What it catches
Python's site module imports sitecustomize, and then usercustomize, at
every interpreter start, before any script runs. A module of either name on the
path runs in every Python process of that environment or image. litellm 1.107.0
installed a sitecustomize.py that started a background process fetching and
running remote code every hour.
The rule reports every form Python can import, at the top of a site-packages or dist-packages directory:
sitecustomize.py, or a sourcelesssitecustomize.pyc- an extension module (
sitecustomize.cpython-312-x86_64-linux-gnu.so,.pyd) - a package:
sitecustomize/__init__.py - a compiled copy in
__pycache__. Python loads that copy only beside its source, so on its own it shows the module was installed there. LiteLLM's clean-up advice was to delete both.
The same names are reported in a directory a Dockerfile puts on PYTHONPATH:
the directory under the scan root when the root is an unpacked image, or a
build-context directory that a COPY or ADD places at that path.
What it does not catch
- A
PYTHONPATHset outside a Dockerfile: an image's config, a compose file, a CI job or a shell. - The standard library directory, where Debian and Ubuntu ship a
sitecustomize.pyof their own.
How to fix
Read the module. If no package you installed on purpose, and no file of your
own, put it there, delete it and any __pycache__ copy, rebuild the environment
or image from a pinned lockfile, and rotate every credential it could reach. A
hook of your own belongs in your application's start-up code, where it is seen
and tested.
Registry reference
This section is generated from the rule registry (agent_audit_kit/rules/builtin.py) when the documentation is built, so it follows the scanner. The rest of the page is hand-written; where the two disagree, the registry is what runs.
- Severity
- HIGH
- Category
- Supply Chain (
supply-chain) - Scanner
agent_audit_kit/scanners/startup_hooks.py- Auto-fixable
- No.
- SARIF name
PythonSitecustomizeHook
What it detects
A sitecustomize or usercustomize module sits in a site-packages or dist-packages directory, or in a directory a Dockerfile puts on PYTHONPATH. Python's site module imports both at every interpreter start, before any script runs, so whatever the module does runs in every Python process of that environment or image. litellm 1.107.0 (21 Oct 2026, OSV MAL-2026-2144) installed a sitecustomize.py that started a daemon fetching and running remote code every hour.
How to fix (registry)
Read the module. If no package you installed on purpose, and no file of your own, put it there, delete it and any __pycache__ copy, rebuild the environment or image from a pinned, known-good lockfile, and rotate every credential it could reach. A hook of your own belongs in your application's start-up code, where it is visible and tested; if you keep this one, exclude its path with --ignore-paths.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-STARTUP-HOOK-SITECUSTOMIZE-001
Limitations
Reports sitecustomize and usercustomize as a .py or a sourceless .pyc, an extension module (.so, .pyd), a package with an __init__.py or __init__.pyc, or a compiled copy in __pycache__ (which Python loads only beside its source, so it shows the module was there), at the top of a site-packages or dist-packages directory that AAK-STARTUP-HOOK-PTH-001's walk reaches, or in a directory a Dockerfile's ENV PYTHONPATH names, read as a path under the scan root (an unpacked image) or as a build-context directory that a COPY or ADD puts at that path, the context taken to be the Dockerfile's own directory. A PYTHONPATH set anywhere else (an image's config, a compose file, a CI job, a shell) is not read, and neither is the standard library directory, where Debian and Ubuntu ship a sitecustomize.py of their own. A file named in data/startup_hook_allowlist.json with the same normalised content is not reported; none is listed today. A PYTHONPATH directory is read only where it resolves inside the scan root, so a path with .. past the root, or through a symlink out of it, is not read, and a module that is a symlink is read as AAK-STARTUP-HOOK-PTH-001 reads a startup file. A file over 1 MB is refused, which marks the scan incomplete, and a FIFO or a device in its place is skipped.
References
- OWASP MCP Top 10: MCP04:2025 (Software Supply Chain Attacks & Dependency Tampering)
- OWASP Agentic Top 10: ASI04 (Agentic Supply Chain Vulnerabilities), ASI05 (Unexpected Code Execution (RCE))
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-SUPPLY-05 (Dangerous Install Script)
- Incidents and advisories: BERRIAI-LITELLM-2026-10-21
- CSA AI Controls Matrix (AICM): STA-08, IVS-04