Vulnerabilities in pkg:pypi/joblib

PACKAGE
Advisory Identifier: GHSA-6hrg-qmvc-2xh8
Advisory Summary

CVE-2022-21797 is a CRITICAL (CVSS 9.8) joblib vulnerable to arbitrary code vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Joblib libraries in the PyPI ecosystem. The issue involves joblib vulnerable to arbitrary code execution. Remediation is available by upgrading affected packages to version 1.2.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/joblib

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/joblib. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-6hrg-qmvc-2xh8 CVE-2022-21797 CRITICAL joblib vulnerable to arbitrary code execution

CVE-2022-21797 at a Glance

CVE Identifier CVE-2022-21797
GHSA Identifier GHSA-6hrg-qmvc-2xh8
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Joblib
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-21797

To remediate this vulnerability, upgrade all affected Joblib dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

joblib fixed: 1.2.0
pip install joblib>=1.2.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show joblib

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2022-21797, inspect your installed packages using pip:

pip show joblib

Analyze the terminal output to locate any version of Joblib in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.0), your application is affected.

Note: The pip show joblib command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Joblib, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

The package joblib from 0 and before 1.2.0 is vulnerable to Arbitrary Code Execution via the `pre_dispatch` flag in `Parallel()` class due to the `eval()` statement.

CVE-2022-21797 Affected Joblib Versions

1 component(s)
Fixed Versions:
1.2.0
Product / Package Ecosystem Affected Versions Fixed Version
joblib
PyPI
< 1.2.0
1.2.0

References

NVD — CVE-2022-21797 NVD
https://nvd.nist.gov/vuln/detail/CVE-2022-21797
Joblib Source Repository REPOSITORY
https://github.com/joblib/joblib/issues/1128
Joblib Source Repository REPOSITORY
https://github.com/joblib/joblib/pull/1321
Joblib Source Repository REPOSITORY
https://github.com/joblib/joblib/pull/1327
Joblib Source Repository REPOSITORY
https://github.com/joblib/joblib/pull/1352
Security Fix Commit FIX COMMIT
https://github.com/joblib/joblib/commit/6638b9e9711ad1ebbf6dd95aa7cee0dca9897b42
Security Fix Commit FIX COMMIT
https://github.com/joblib/joblib/commit/b90f10efeb670a2cc877fb88ebb3f2019189e059
Joblib Security Information SECURITY
https://security.snyk.io/vuln/SNYK-PYTHON-JOBLIB-3027033
Joblib Security Information SECURITY
https://security.gentoo.org/glsa/202401-01
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MJ5XTJS6OKJRRVXWFN5J67K3BYPEOBDF
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BVOMMW37OXZWU2EV5ONAAS462IQEHZOF
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/MJ5XTJS6OKJRRVXWFN5J67K3BYPEOBDF
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BVOMMW37OXZWU2EV5ONAAS462IQEHZOF
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2023/03/msg00027.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2022/11/msg00020.html
Joblib Source Repository REPOSITORY
https://github.com/pypa/advisory-database/tree/main/vulns/joblib/PYSEC-2022-288.yaml
Joblib Source Repository REPOSITORY
https://github.com/joblib/joblib

Frequently Asked Questions

What is CVE-2022-21797?
CVE-2022-21797 is a security vulnerability in Joblib involving joblib vulnerable to arbitrary code execution under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Joblib versions are affected?
Affected versions include releases prior to 1.2.0 across affected packages: joblib.
What version fixes CVE-2022-21797?
Upgrading to 1.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is joblib affected?
Yes, joblib is affected in releases prior to 1.2.0. Upgrade your dependency to 1.2.0 or later.
What is the CVSS score of CVE-2022-21797?
CVE-2022-21797 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-21797?
CVE-2022-21797 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check PyPI dependencies for CVE-2022-21797?
Run the dependency tree command: 'pip show joblib'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-6hrg-qmvc-2xh8",
  "modified" : "2024-09-23T19:29:43Z",
  "published" : "2022-09-27T00:00:22Z",
  "aliases" : [ "CVE-2022-21797" ],
  "summary" : "joblib vulnerable to arbitrary code execution",
  "details" : "The package joblib from 0 and before 1.2.0 is vulnerable to Arbitrary Code Execution via the `pre_dispatch` flag in `Parallel()` class due to the `eval()` statement.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "joblib"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-21797"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/joblib/joblib/issues/1128"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/joblib/joblib/pull/1321"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/joblib/joblib/pull/1327"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/joblib/joblib/pull/1352"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/joblib/joblib/commit/6638b9e9711ad1ebbf6dd95aa7cee0dca9897b42"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/joblib/joblib/commit/b90f10efeb670a2cc877fb88ebb3f2019189e059"
  }, {
    "type" : "WEB",
    "url" : "https://security.snyk.io/vuln/SNYK-PYTHON-JOBLIB-3027033"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/202401-01"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MJ5XTJS6OKJRRVXWFN5J67K3BYPEOBDF"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BVOMMW37OXZWU2EV5ONAAS462IQEHZOF"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/MJ5XTJS6OKJRRVXWFN5J67K3BYPEOBDF"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BVOMMW37OXZWU2EV5ONAAS462IQEHZOF"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/03/msg00027.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2022/11/msg00020.html"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/joblib/PYSEC-2022-288.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/joblib/joblib"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-09-30T04:44:04Z",
    "nvd_published_at" : "2022-09-26T05:15:00Z"
  }
}