CVE-2026-128084: sqlite3-ruby: Possible SQL query truncation when a string is 4 GiB or larger
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.
Published Nov 13, 2026
Affected packages
sqlite3
- Ecosystem
- RubyGems
- Affected
- <= 2.10.1
- Fixed in
- 2.10.2
- Check
bundle info sqlite3
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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_paramand 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.
Credited to luke-elttam.
References
- https://github.com/sparklemotion/sqlite3-ruby/security/advisories/GHSA-4fqr-96q8-xrfx
- https://github.com/sparklemotion/sqlite3-ruby/pull/762
- https://github.com/sparklemotion/sqlite3-ruby/commit/41059aa3ccc2c0f910d6df4fccfe36b3c3c6c649
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/sqlite3/GHSA-4fqr-96q8-xrfx.yml
- https://github.com/sparklemotion/sqlite3-ruby/releases/tag/v2.10.2
- https://github.com/advisories/GHSA-4fqr-96q8-xrfx
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More RubyGems vulnerabilities
All RubyGems entriesGHSA-mwm8-39rw-8826
sqlite3-ruby: Use-After-Free in SQLite Aggregate Arguments in Heap-Allocated Argument Array
medium6.3Oct 2, 2026CVE-2026-54619
sqlite3-ruby has Use-After-Free When Redefining SQLite Functions with Different Arity
low2.0Jul 28, 2026CVE-2026-54620
sqlite3-ruby has Use-After-Free in SQLite Aggregate Function Callbacks
low2.0Jul 28, 2026
