Vulnerabilities in pkg:pypi/python-sql

PACKAGE
Advisory Identifier: GHSA-pq9p-pc3p-9hm4
Advisory Summary

CVE-2024-9774 is a MODERATE (CVSS 6.5) sql injection vulnerability (CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences) affecting Python sql libraries in the PyPI ecosystem. The issue involves python-sql sql injection vulnerability. Remediation is available by upgrading affected packages to version 1.5.2.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/python-sql

1 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-pq9p-pc3p-9hm4 CVE-2024-9774 MODERATE python-sql SQL injection vulnerability

CVE-2024-9774 at a Glance

CVE Identifier CVE-2024-9774
GHSA Identifier GHSA-pq9p-pc3p-9hm4
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences
Affected Product Python sql
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.5

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

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

How to Fix CVE-2024-9774

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

python-sql fixed: 1.5.2
pip install python-sql>=1.5.2
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 python-sql

How to Check if You Are Affected

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

pip show python-sql

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences, where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as escape, meta, or control character sequences when they are sent to a downstream component. In Python sql, 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

A vulnerability was found in python-sql where unary operators do not escape non-Expression (like `And` and `Or`) which makes any system exposing those vulnerable to an SQL injection attack.

CVE-2024-9774 Affected Python sql Versions

1 component(s)
Fixed Versions:
1.5.2
Product / Package Ecosystem Affected Versions Fixed Version
python-sql
PyPI
< 1.5.2
1.5.2

References

Frequently Asked Questions

What is CVE-2024-9774?
CVE-2024-9774 is a security vulnerability in Python sql involving python-sql SQL injection vulnerability under CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences.
Which Python sql versions are affected?
Affected versions include releases prior to 1.5.2 across affected packages: python-sql.
What version fixes CVE-2024-9774?
Upgrading to 1.5.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is python-sql affected?
Yes, python-sql is affected in releases prior to 1.5.2. Upgrade your dependency to 1.5.2 or later.
What is the CVSS score of CVE-2024-9774?
CVE-2024-9774 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2024-9774?
CVE-2024-9774 is classified under CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences (The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as escape, meta, or control character sequences when they are sent to a downstream component.).
How can I check PyPI dependencies for CVE-2024-9774?
Run the dependency tree command: 'pip show python-sql'. 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-pq9p-pc3p-9hm4",
  "modified" : "2025-02-07T06:31:14Z",
  "published" : "2024-12-27T03:31:23Z",
  "aliases" : [ "CVE-2024-9774" ],
  "summary" : "python-sql SQL injection vulnerability",
  "details" : "A vulnerability was found in python-sql where unary operators do not escape non-Expression (like `And` and `Or`) which makes any system exposing those vulnerable to an SQL injection attack.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "python-sql"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.5.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-9774"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/security/cve/CVE-2024-9774"
  }, {
    "type" : "WEB",
    "url" : "https://bugs.tryton.org/python-sql/93"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2332734"
  }, {
    "type" : "WEB",
    "url" : "https://discuss.tryton.org/t/security-release-for-issue-93/7889"
  }, {
    "type" : "WEB",
    "url" : "https://discuss.tryton.org/t/security-release-for-issue-93/7889/3"
  }, {
    "type" : "WEB",
    "url" : "https://foss.heptapod.net/tryton/python-sql/-/commit/f20551bbb8b3b4c4dd0a2c3d36f377bff6f2f349"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tryton/python-sql"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2024/10/msg00023.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-150" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-12-27T18:02:41Z",
    "nvd_published_at" : "2024-12-27T02:15:07Z"
  }
}