Malicious Code Detected in TensorFlow.js Package: Security Risk Alert

tensorflowjs Updated 02 Oct 2025

Summary

12/08/2025
CRITICAL
No i
Critical
Not published

MAL-2025-6829: Malicious code in tensorflowjs (npm). Affects tensorflowjs versions 0.6.8 – 0.7.0. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

TensorFlow.js is a popular library for machine learning in JavaScript, enabling developers to build and train models directly in the browser or in Node.js. It is widely used for various applications, including image recognition and natural language processing. However, the package has been compromised, introducing significant security risks due to malicious code embedded within it.

Vulnerability Detail

The vulnerability stems from malicious code that has been intentionally obfuscated within the TensorFlow.js package. This code allows for arbitrary command execution via the 'child_process.spawn' method, which can lead to unauthorized access and control over the system where the package is installed. The presence of a suspicious 'postinstall' script further exacerbates the risk, as it executes automatically upon installation, potentially compromising the user's environment.

How To Fix

This package is malicious. Remove it and rotate any credentials it could have accessed.

npm uninstall tensorflowjs

If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, avoid using the TensorFlow.js package until a secure version is confirmed. Additionally, consider using alternative libraries for machine learning tasks that do not have known vulnerabilities.

Conclusion

The TensorFlow.js package has been compromised with malicious code that poses a serious security threat. It is essential for users to take immediate action by uninstalling the affected version and updating to a secure release. Utilizing tools like Vulert can help monitor and manage vulnerabilities effectively.

See every vulnerability recorded for tensorflowjs →

Share this vulnerability

FAQ

The vulnerability involves malicious code that allows for arbitrary command execution, posing a significant security risk.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Visit Vulert Scanner to check your application without any signup.

Immediately uninstall the affected version using 'npm uninstall tensorflowjs' and install the latest secure version with 'npm install tensorflowjs@latest'.

Regularly monitor your dependencies using tools like Vulert and keep your packages updated to the latest versions to mitigate risks.

Failure to address this vulnerability could lead to unauthorized access to your system, data breaches, and potential exploitation by malicious actors.

How To Fix

This package is malicious. Remove it and rotate any credentials it could have accessed.

npm uninstall tensorflowjs

If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback