Sensitive Data Leakage in scikit-learn's TfidfVectorizer - CVE-2024-5206

scikit-learn Updated 02 Oct 2025

Summary

06/06/2024
N/A
No i
Medium
4.7

CVE-2024-5206: A sensitive data leakage vulnerability was identified in scikit-learn's TfidfVectorizer, specifically in versions up to and including 1.4.1.post1, which was fixed in version 1.5.0. Affects scikit-learn versions < 70ca21f106b603b611da73012c9ade7cd8e438b8. 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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

scikit-learn is a widely used open-source machine learning library in Python, providing simple and efficient tools for data mining and data analysis. It features various algorithms for classification, regression, clustering, and dimensionality reduction. The library's TfidfVectorizer is a crucial component that transforms text data into a format suitable for machine learning models by converting a collection of raw documents to a matrix of TF-IDF features. However, a vulnerability has been identified in this component that could lead to the unintended exposure of sensitive information.

Vulnerability Detail

A sensitive data leakage vulnerability was identified in scikit-learn's TfidfVectorizer, specifically in versions up to and including 1.4.1.post1. The issue arises from the unexpected storage of all tokens present in the training data within the 'stop_words_' attribute, instead of only storing the necessary tokens for the TF-IDF technique. This behavior can lead to the leakage of sensitive information, such as passwords or keys, which were meant to be discarded. The impact of this vulnerability varies based on the nature of the data processed by the vectorizer.

How To Fix

No fixed version is published for this vulnerability.

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

Workaround

If upgrading is not immediately possible, consider implementing a workaround by manually filtering out sensitive tokens from your training data before passing it to the TfidfVectorizer. For example, you can create a list of sensitive words and remove them from your dataset prior to vectorization.

Conclusion

The CVE-2024-5206 vulnerability in scikit-learn's TfidfVectorizer poses a significant risk of sensitive data leakage. Users are strongly advised to upgrade to version 1.5.0 or later to mitigate this risk. In the meantime, implementing manual data filtering can serve as a temporary workaround.

See every vulnerability recorded for scikit-learn →

Share this vulnerability

FAQ

CVE-2024-5206 is a vulnerability in scikit-learn's TfidfVectorizer that can lead to sensitive data leakage.

Versions up to and including 1.4.1.post1 are affected by this vulnerability.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

As a temporary measure, manually filter out sensitive tokens from your training data before using TfidfVectorizer.

The vulnerability could lead to the unintended exposure of sensitive information, such as passwords or API keys, which could be exploited by malicious actors.

Related vulnerabilities

Recent vulnerabilities recorded for scikit-learn.

How To Fix

No fixed version is published for this vulnerability.

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