Skip to content
Info disclosure Disclosed report Intermediate CVE-2024-5206

scikit-learn sensitive data leakage vulnerability

The TfidfVectorizer stored all tokens from training data in its stop_words_ attribute instead of only the subset needed for TF-IDF. An attacker with access to the fitted model could recover sensitive tokens such as passwords or keys that were meant to be discarded.

scikit-learn/scikit-learn

Originally disclosed on huntr

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. The vulnerability arises from the unexpected storage of all tokens present in the training data within the stop_words_ attribute, rather than only storing the subset of tokens required for the TF-IDF technique to function. This behavior leads to the potential leakage of sensitive information, as the stop_words_ attribute could contain tokens that were meant to be discarded and not stored, such as passwords or keys. The impact of this vulnerability varies based on the nature of the data being processed by the vectorizer.

From the GitHub Advisory Database (GHSA-jw8x-6495-233v, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the code populated stop_words_ with every token from the training data rather than only the tokens needed for the TF-IDF calculation.

Impact

Sensitive tokens such as passwords or keys could leak to anyone able to access the fitted model, with the severity depending on the data processed.

What the attacker needed

Access to a fitted model; sensitive tokens in training data

The fix

It was fixed in version 1.5.0 by changing the attribute to store only the required subset of tokens.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A text-processing tool keeps a list of words it saw while learning from data. It was supposed to keep only a small useful subset, but it kept everything, including secrets like passwords that happened to appear in the text. Anyone who could inspect the saved model could read those secrets.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.