cvelo
P2 · HighMalware

Malicious code in formatting-subtitles (npm)

  • GHSA-2cph-9873-fh57

Description

package.json declares `preinstall: sh./prepare.js && exit 0`. prepare.js is shaped like JavaScript (ending with `console.log('hello world')`) but is executed by /bin/sh, which does not treat `/**... */` as a comment. Inside that block, sh evaluates two `$(...)` command substitutions: one issues a GET to the hardcoded collector https://webhook.site/9e8c8742-3102-4716-aa8b-e150e9e84fe7/stats_1, and the other downloads https://api.github.com/gists/da04f14c93acbe9a7aef827be0a2e91c, extracts a file via jq, writes it to disk as `x`, and runs it with `sh x`. On `npm install`, the installer host fetches and executes arbitrary, unpinned, attacker-controlled content from a mutable GitHub Gist, and the webhook.site beacon discloses the install (and curl-visible metadata such as public IP and user-agent) to the attacker. The JS-comment-wrapping of the shell payload is a deliberate cover story so prepare.js reads as a trivial hello-world when viewed as JavaScript. --- Credit: [OpenSSF](https://github.com/ossf/malicious-packages) ([source](https://github.com/ossf/malicious-packages/blob/f17c406fb7ee5243da902499814340765fd9b86a/osv/malicious/npm/formatting-subtitles/MAL-2026-18184.json))

Text from the GitHub Advisory record.

Recommendation

Remove the package and rotate any secret the machine that installed it could reach. There is no version to update to.

Affected

  • formatting-subtitlesnpm

    No versions listed

Timeline

  1. Published

Related news

No article from the followed outlets names this vulnerability.