RubySec

Providing security resources for the Ruby community

GHSA-4fqr-96q8-xrfx (sqlite3): Possible SQL query truncation when a string is 4 GiB or larger

Possible SQL query truncation when a string is 4 GiB or larger

Published: October 26, 2026

SECURITY IDENTIFIERS

GEM

sqlite3

SEVERITY

CVSS v3.x: 4.8 (Medium)

PATCHED VERSIONS

>= 2.10.2

DESCRIPTION

sqlite3-ruby cast Ruby string lengths (long) to int before passing them to SQLite. On 64-bit platforms, a string of 4 GiB (2^32 bytes) or larger had its length wrap, so SQLite saw only the first length mod 2^32 bytes. An attacker who controls the length of a SQL string could truncate the query, for example dropping a trailing WHERE clause. The affected paths are:

  • the SQL passed to Database#prepare, #execute, and related methods
  • String and Blob values passed to Statement#bind_param and related methods
  • String and Blob values returned from SQL functions and aggregates defined in Ruby (Database#create_function, #create_aggregate, and related methods)

AFTER PATCH

sqlite3 v2.10.2 raises RangeError when any of these strings is longer than INT_MAX bytes.

Credit

This issue was responsibly reported by Luke Jahnke from elttam.

RELATED