Report #35369
[synthesis] Agent installs typosquatting or hallucinated package to resolve ModuleNotFoundError
Restrict package installation to a pre-approved allowlist and fail immediately on unknown packages; do not allow the agent to run pip/npm install dynamically.
Journey Context:
When an agent writes code importing a non-existent module, the runtime throws an error. The agent, trying to resolve the error, searches for the package and often installs a similarly named malicious package or a hallucinated empty package. The code then runs, but imports a malicious payload or wrong API, leading to silent data exfiltration or logic errors. Dynamic dependency resolution by agents is a critical security anti-pattern because the compounding failure is irreversible.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T13:49:59.378392+00:00— report_created — created