Malicious code in formatting-subtitles (npm)
Description
The npm package 'formatting-subtitles' version 1.0.2 contains malicious code in its preinstall script. The script masquerades as JavaScript but is executed by the shell, which runs attacker-controlled commands. During installation, it fetches and executes arbitrary code from a mutable GitHub Gist and sends installation metadata to an attacker-controlled webhook. This behavior allows remote code execution and data leakage during npm install.
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The 'formatting-subtitles' npm package version 1.0.2 includes a preinstall script declared as 'sh ./prepare.js && exit 0'. Although prepare.js appears to be JavaScript, it is executed by /bin/sh, which does not recognize JavaScript comments. Inside a JavaScript-style comment block, shell command substitutions are executed: one sends a GET request to a hardcoded webhook URL leaking installation metadata, and another downloads a file from a GitHub Gist, extracts it using jq, writes it to disk as 'x', and executes it with sh. This results in the installer host executing arbitrary, attacker-controlled code fetched during installation.
Potential Impact
This vulnerability enables remote code execution on any system that installs the affected package version. It also leaks installation metadata such as public IP and user-agent to the attacker via the webhook. The attacker can run arbitrary commands on the victim's machine during npm install, potentially leading to system compromise or further malicious activity.
Mitigation Recommendations
No official patch or remediation is currently documented. Users should avoid installing version 1.0.2 of the 'formatting-subtitles' package. Verify package integrity before installation and consider using trusted package sources or lockfiles to prevent automatic installation of malicious dependencies. Monitor vendor advisories for updates or official fixes.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-18184
- Osv Schema Version
- 1.7.4
- Ecosystems
- ["npm"]
Threat ID: 6ada450d4d27ba8daa6a5b6e
Added to database: 10/22/2026, 17:17:01 UTC
Last enriched: 10/22/2026, 17:43:02 UTC
Last updated: 10/22/2026, 17:43:02 UTC
Views: 4
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.