Vulnerability GHSA-4fqr-96q8-xrfx

Medium Risk
MEDIUM RISK
CVSS Score: 4.8
Score Range: 4.0–6.9
Medium severity vulnerabilities (CVSS 4.0–6.9). Important issues that meaningfully reduce security confidence.
1 hour ago
November 13, 2026 at 06:57 PM UTC
sqlite3-ruby: Possible SQL query truncation when a string is 4 GiB or larger
0.0.0 - 0.1.1 and 1.3.3.beta.1 and 1.3.3 - 1.4.4 and 1.5.0.rc1 and 1.5.0.rc2 and 1.5.0 - 1.5.4 and 1.6.0.rc1 and 1.6.0.rc2 and 1.6.0 - 1.6.4 and 1.6.5.rc1 and 1.6.5 - 2.0.4 and 2.1.0.rc1 and 2.1.0.rc2 and 2.1.0.rc3 and 2.1.0 - 2.4.1 and 2.5.0.rc1 and 2.5.0 - 2.9.1 and 2.9.2.rc2 and 2.9.2 - 2.10.1
0.0.0 - 0.1.1 and 1.3.3.beta.1 and 1.3.3 - 1.4.4 and 1.5.0.rc1 and 1.5.0.rc2 and 1.5.0 - 1.5.4 and 1.6.0.rc1 and 1.6.0.rc2 and 1.6.0 - 1.6.4 and 1.6.5.rc1 and 1.6.5 - 2.0.4 and 2.1.0.rc1 and 2.1.0.rc2 and 2.1.0.rc3 and 2.1.0 - 2.4.1 and 2.5.0.rc1 and 2.5.0 - 2.9.1 and 2.9.2.rc2 and 2.9.2 - 2.10.1

Summary

sqlite3-ruby: Possible SQL query truncation when a string is 4 GiB or larger

Details

Summary

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)

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

Severity

The sqlite3-ruby maintainers have evaluated this as medium severity (CVSS 4.8). Exploitation requires an attacker to get at least 4 GiB into a single SQL string or bound value. Most deployments reject a request body that large before the application sees it, and the server must hold several copies of the string in memory.

A truncated bound value is only a prefix of the attacker's input, so the bind paths matter only where the application validated the full value. A truncated SQL string is more serious: when the attacker's input is inlined into the SQL, the clauses that follow it are dropped. If a dropped clause contained a bind placeholder, binding raises SQLite3::RangeException instead of running the query.

Mitigation

Upgrade to sqlite3 v2.10.2 or later.

As a workaround for earlier versions, reject SQL strings and bound values of 4 GiB or larger before passing them to sqlite3-ruby, or limit request body size well below 4 GiB.

Credit

This issue was responsibly reported by Luke Jahnke from elttam.

Related Vulnerabilities

Other vulnerabilities affecting the same packages

Medium Risk
1 month ago
sqlite3-ruby: Use-After-Free in SQLite Aggregate Arguments in Heap-Allocated Argument Array
1.4.0 - 1.4.4 and 1.5.0.rc1 and 1.5.0.rc2 and 1.5.0 - 1.5.4 and 1.6.0.rc1 and 1.6.0.rc2 and 1.6.0 - 1.6.4 and 1.6.5.rc1 and 1.6.5 - 2.0.4 and 2.1.0.rc1 and 2.1.0.rc2 and 2.1.0.rc3 and 2.1.0 - 2.4.1 and 2.5.0.rc1 and 2.5.0 - 2.9.1 and 2.9.2.rc2 and 2.9.2 - 2.9.5 GHSA-mwm8-39rw-8826
1.4.0 - 1.4.4 and 1.5.0.rc1 and 1.5.0.rc2 and 1.5.0 - 1.5.4 and 1.6.0.rc1 and 1.6.0.rc2 and 1.6.0 - 1.6.4 and 1.6.5.rc1 and 1.6.5 - 2.0.4 and 2.1.0.rc1 and 2.1.0.rc2 and 2.1.0.rc3 and 2.1.0 - 2.4.1 and 2.5.0.rc1 and 2.5.0 - 2.9.1 and 2.9.2.rc2 and 2.9.2 - 2.9.5 GHSA-mwm8-39rw-8826
Low Risk
3 months ago
sqlite3-ruby has Use-After-Free in SQLite Aggregate Function Callbacks
2.1.0 - 2.4.1 and 2.5.0.rc1 and 2.5.0 - 2.9.1 and 2.9.2.rc2 and 2.9.2 - 2.9.4 GHSA-j7fr-3v8c-3qc3
2.1.0 - 2.4.1 and 2.5.0.rc1 and 2.5.0 - 2.9.1 and 2.9.2.rc2 and 2.9.2 - 2.9.4 GHSA-j7fr-3v8c-3qc3
Low Risk
3 months ago
sqlite3-ruby has Use-After-Free When Redefining SQLite Functions with Different Arity
0.0.0 - 0.1.1 and 1.3.3.beta.1 and 1.3.3 - 1.4.4 and 1.5.0.rc1 and 1.5.0.rc2 and 1.5.0 - 1.5.4 and 1.6.0.rc1 and 1.6.0.rc2 and 1.6.0 - 1.6.4 and 1.6.5.rc1 and 1.6.5 - 2.0.4 and 2.1.0.rc1 and 2.1.0.rc2 and 2.1.0.rc3 and 2.1.0 - 2.4.1 and 2.5.0.rc1 and 2.5.0 - 2.9.1 and 2.9.2.rc2 and 2.9.2 - 2.9.4 GHSA-28hh-pr2h-2w89
0.0.0 - 0.1.1 and 1.3.3.beta.1 and 1.3.3 - 1.4.4 and 1.5.0.rc1 and 1.5.0.rc2 and 1.5.0 - 1.5.4 and 1.6.0.rc1 and 1.6.0.rc2 and 1.6.0 - 1.6.4 and 1.6.5.rc1 and 1.6.5 - 2.0.4 and 2.1.0.rc1 and 2.1.0.rc2 and 2.1.0.rc3 and 2.1.0 - 2.4.1 and 2.5.0.rc1 and 2.5.0 - 2.9.1 and 2.9.2.rc2 and 2.9.2 - 2.9.4 GHSA-28hh-pr2h-2w89
Low Risk
4 years ago
SQLite3 addresses vulnerability in packaged version of libsqlite
1.5.0 GHSA-mgvv-5mxp-xq67
1.5.0 GHSA-mgvv-5mxp-xq67
View all vulnerabilities for these packages

Impacted packages

Timeline

Published
1 hour ago
November 13, 2026 at 06:57 PM UTC
Fixed (2.10.2)
17 days ago
October 26, 2026 at 09:35 PM UTC
Last Modified
1 hour ago
November 13, 2026 at 07:15 PM UTC