Vulnerabilities in pkg:pypi/js2py

PACKAGE
Advisory Identifier: GHSA-h95x-26f3-88hr
Advisory Summary

CVE-2024-28397 is a HIGH (CVSS 8.8) remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Js2py libraries in the PyPI ecosystem. The issue involves js2py allows remote code execution. Remediation is available in the latest vendor maintenance releases.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/js2py

1 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-h95x-26f3-88hr CVE-2024-28397 HIGH js2py allows remote code execution

CVE-2024-28397 at a Glance

CVE Identifier CVE-2024-28397
GHSA Identifier GHSA-h95x-26f3-88hr
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Js2py
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.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:R/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 Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2024-28397

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

js2py fixed: Latest secure release
pip install js2py>=Latest secure release
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 js2py

How to Check if You Are Affected

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

pip show js2py

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

Note: The pip show js2py 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 Js2py, 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

An issue in the component `js2py.disable_pyimport()` of js2py up to v0.74 allows attackers to execute arbitrary code via a crafted API call.

CVE-2024-28397 Affected Js2py Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
js2py
PyPI
≤ 0.74

References

Frequently Asked Questions

What is CVE-2024-28397?
CVE-2024-28397 is a security vulnerability in Js2py involving js2py allows remote code execution under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Js2py versions are affected?
Affected versions include releases prior to current release patches across affected packages: js2py.
What version fixes CVE-2024-28397?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is js2py affected?
Yes, js2py is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2024-28397?
CVE-2024-28397 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-28397?
CVE-2024-28397 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-2024-28397?
Run the dependency tree command: 'pip show js2py'. 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-h95x-26f3-88hr",
  "modified" : "2024-07-05T17:36:08Z",
  "published" : "2024-06-20T18:34:08Z",
  "aliases" : [ "CVE-2024-28397" ],
  "summary" : "js2py allows remote code execution",
  "details" : "An issue in the component `js2py.disable_pyimport()` of js2py up to v0.74 allows attackers to execute arbitrary code via a crafted API call.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "js2py"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "0.74"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-28397"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PiotrDabkowski/Js2Py/pull/323"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Marven11"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Marven11/CVE-2024-28397-js2py-Sandbox-Escape"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/PiotrDabkowski/Js2Py"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-20T19:19:56Z",
    "nvd_published_at" : "2024-06-20T17:15:50Z"
  }
}