Malicious code in spectral-core (npm)
Description
spectral-core contains no library code: where an index.js is present (e.g. 3.0.12) it only exports the package name and version. It ships a binding.gyp (and package.json sets "gypfile": true), so npm runs node-gyp rebuild on install, and the binding.gyp declares a build action ("Finalizing spectral-core setup") that runs inline JavaScript with node -e. Versions 3.0.3 to 3.0.12 (3.0.8 was never published) were published on 2026-10-28 between 19:42 and 21:24 UTC, each with a different collection script. Depending on the version, the script:
- reads the environment of PID 1 (
/proc/1/environ; 3.0.4, 3.0.6) and of its own process (/proc/self/environ; 3.0.6), greps the environment forhtbandflag(3.0.4), and enumeratesprocess.envwithObject.entries(3.0.11, 3.0.12); - searches the filesystem for files named
*flag*or*HTB*and for files containingHTB{, and prints the first lines of/run/secrets/*(3.0.3); recursively lists/var/run/secrets(3.0.5); reads/flag.txt(3.0.9); - reads
AWS_CONTAINER_CREDENTIALS_RELATIVE_URIand the ECS container metadata URI variable (3.0.7), and fetches the ECS task metadata endpoint ($ECS_CONTAINER_METADATA_URI/task) with curl and posts the result (3.0.11); - reads
/fetch.sh,/run_test.shand/setup_test.sh(3.0.5) and/opt/ph/sitecustomize.py(3.0.12), lists/scripts(3.0.10) and/opt(3.0.11), and collects/etc/resolv.conf,ip neighandip routeoutput (3.0.6); - sends data off the host over HTTPS. In 3.0.7 and 3.0.9 to 3.0.12 the scanned code POSTs to webhook.site (path
/d6092bdc-05c0-45da-a280-c343ea6d6156in 3.0.7,/f604623f-fc78-4447-9225-6772f7f12cb1in 3.0.9 to 3.0.12). In 3.0.3 to 3.0.6 the destination is outside the scanned excerpt, but each version loadshttpsand a full-file static rule for webhook/collection services matched.
Version 3.0.6 also shipped a file named CTF_HANDOFF_CURSE_DEPENDENT_v2.md, and the strings searched for suggest the author was targeting a capture-the-flag environment. The script nevertheless runs on any machine where npm builds the package's binding.gyp during install, collects (depending on the version) environment variables, secret files, local scripts and ECS task metadata, and sends data to a third-party endpoint (webhook.site where the destination is visible). The same webhook.site endpoint /f604623f-... is used by @dmangal/curse-dependent-ecto@99999.0.0. All 2026 versions (0.0.0-stage and 3.0.1 to 3.0.12) were unpublished on 2026-10-28 at 22:29 UTC.
--- -= Per source details. Do not edit below this line.=-
Source: amazon-inspector (451c36f03e81be0ff6c85334587d7ff401de1e5134e179557ec4bc454cd7ba76)
The tarball ships only package.json and binding.gyp (plus a markdown file), with gypfile: true set in package.json so npm invokes node-gyp rebuild on install. binding.gyp declares a 'none'-type target with no native source files; its sole purpose is an inline action that runs node -e with an embedded script. At install time that script reads /proc/1/environ and /proc/self/environ (container/pod entrypoint environment variables, which routinely contain CI/CD secrets and cloud credentials), collects DNS/socket/ARP/route reconnaissance output, queries the AWS EC2 instance metadata service at 169.254.169.254 for user-data and meta-data, and POSTs the collected data to the hardcoded collector webhook.site/